Set.menu

From AGI Wiki
Jump to navigationJump to search

The set.menu command adds a menu to the menu system.

Syntax

set.menu(msg mA);
set.menu("menu text");

Remarks

In AGI menus are the displayed along the top of the menu bar, and each menu may have zero or more menu items, which are the drop-down list of items to choose from. The set.menu command adds new menu mA to the menu structure. Menus will be displayed on the menu bar in the order that they are added with the set.menu command. A single space is added between each menu.

The items that will be in the drop down list for the menu must be added in order immediately after the menu is is created. The order of menus and menu items cannot be changed once they are created.

Care should be taken to ensure all the menus added will fit on the menu bar. A single space is added between menu entries, so for the menus to fit, the total number of characters in all menus plus the number of menus should not exceed 40.

Unlike menu items, menus are not selectable, i.e. they cannot be assigned to controllers. One or more set.menu.item commands should follow the set.menu command. Menus with no items added will be disabled automatically by AGI and cannot be selected.

Calls to set.menu after the menu system is added (by calling the submit.menu command) are ignored.

Possible Errors

Do not include a line break in a menu; the extra lines will display on the line below the menu, and will not automatically erase, unless covered up by another menu selection.

Example

Code:

<syntaxhighlight lang="agi"> [ build a simple menu system set.menu("Info"); set.menu.item("About ", c0); set.menu.item("Help ", c1); set.menu("File"); set.menu.item("Save Game <F5>", c2); set.menu.item("Restore Game <F7>", c3); set.menu.item("-------------------", c20); set.menu.item("Restart Game <F9>", c4); set.menu.item("-------------------", c20); set.menu.item("Quit <Alt Z>", c5); [ disable the separators disable.item(c20);

[ submit menu to agi submit.menu() </syntaxhighlight>

Technical Information

Required Interpreter Version: Available in version 2.272 and above.
Byte-Code Value: 156 (0x9C hex)

See Also

Player Input Commands
Menus in AGI
set.menu.item