Set.menu.item

From AGI Wiki
Jump to navigationJump to search

The set.menu.item command adds a menu item to a menu.

Syntax

set.menu.item(msg mA, ctl cB);
set.menu.item("menu item text", ctl cB);

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.item command adds new menu item mA to a menu. The menu item is assigned to controller cB. If the player selects the menu item, the appropriate controller evaluation table entry is set to TRUE, which can then be tested by using the controller command.

Menu items are displayed under the menu in the order that they are added with the set.menu.item command. The first entry item determines the width of the entire menu box. If any later menu item entries are longer than the first, the menu window will not draw correctly. You should pad the first menu item entry enough spaces so it is at least as long as all other entries.

Additional information can be found in the Menus in AGI topic.

Possible Errors

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

Example

Code:
[ 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.item(c20);  [ disable the separators
submit.menu();      [ submit menu to agi

Technical Information

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

See Also

Player Input Commands
Menus in AGI
set.key
set.menu