Script Demo - Map Menu

From Cube Wiki
Revision as of 17:59, 12 December 2014 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When using the complete function of the

  • map,
  • sp,
  • dmsp,
  • ffa,
  • insta and
  • capture

aliases you always use an up-to-date list of maps (=*.ogz files). This means they will auto-complete even your just saved mapname. The console uses TAB-completion for all commands and aliases, the complete command gives you TAB-completion on the first argument as files of the configured extension - ogz's in packages/base for the aforementioned aliases.

The menus do not auto-update themselves; these lists are editorial only - meaning they are a selection made by a human. You can easily add your favourite creations, downloads and coop-edit maps by adding them to the map name lists in data/menus.cfg.

Look for the line reading

newgui maps

insert after the line with rpgmaps = " (line 49 in 2006-12-04 release)

personalmaps = "my_personal_favourite_map_nr_1 my_personal_favourite_map_nr_2 my_personal_favourite_map_nr_3"

and inside the newgui maps block

guitab personal
  guilist [
    guilist [ genmapitems $personalmaps ]
    showmapshot
  ]

The whole block should look (something) like this

newgui maps [
    guilist [
      guilist [
        genmapitems $mainmaps
        guibutton "thor" "map thor" "map"
      ]
      showmapshot
    ]
    guitab more
    guilist [
      guilist [ genmapitems $moremaps1 ]
      guilist [ genmapitems $moremaps2 ]
      showmapshot
    ]
// my personal maps here ::
    guitab personal
      guilist [
      guilist [ genmapitems $personalmaps ]
      showmapshot
    ]
// :: my personal maps here
    guitab old
    guilist [
      guilist [ genmapitems $oldmaps ]
      showmapshot
    ]
    guitab capture
    guilist [
      guilist [ genmapitems $capturemaps ]
      showmapshot
    ]
    guitab rpg_test
    guilist [
      guilist [ genmapitems $rpgmaps ]
      showmapshot
    ]
]

Assuming the maps you entered truely exist in packages/base your menu modification will work.