Scripting Menus

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

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

Menu configuration and personalization

The games menus are completely organized in data/menus.cfg. Providing yourself with a backup of a working copy - you can edit it to fit your needs.

If you think that is too much of a hassle, then there are several menu translations and ScriptPAKs that further modify your menu on quadropolis scripts.

Caution : The water-edition (2006-09-12) is the last to use the 2D style menus, the gui-edition (2006-12-04) is the first to use the 3D style menus. Be sure to check your local documentation ... code here is for the new GUI-style only!


The respective commands for menu construction are:

newgui S

Creates a new menu with name N. All following menuitem/gui* commands will apply to this menu

// for 3D style check documentation - multiple types available : radio, button, slider, image, text, ...
// as an example of a simple menu :
newgui about [
    guitext "Sauerbraten engine"
    guitext "by Wouter van Oortmerssen"
    guitext "with contributions from Eihrul, Gilt and others"
    guitext "(for a full list of contributors see the readme)"
    guitext "http://sauerbraten.org/"
]

See data/menus.cfg for further examples. If the block starts with the special character "^", then this will be evaluated as a command when being displayed. This allows you to create menu items that depend on changing gamestate. Also usable for dynamic stuff (as seen in menus.cfg) is the getalias command. For a really dynamic usage of the GUI menus check-out QCSP - the 'Q' CubeScript PAK.

// 3D style
showgui N
// error in documentation :
showgui servers
// not "showservermenu" as the docs still say from 2D times :-P

Displays the menu with name N previously defined, and allows the user to pick an item with the mouse cursor. Upon clicking the highlighted item, the associated action will be executed. Pressing ESC will cancel the menu.


To show you how easy things can be done : some examples

  • sure you can switch your team by menu,
 but what about more options? What about switching between complete identities?
 a persona switcher via menu
  • An even less elaborate example,
 If you're annoyed at "e" toggling editmode just about every time you get hectic during a game ...
 ... then try out something like this :
 keyboard layout switcher