Submit.menu

From AGI Wiki
Jump to navigationJump to search

The submit.menu command enables the use of menus after they have been created with the set.menu and set.menu.item commands.

Syntax

submit.menu();

Remarks

This command commits a previously created menu system to memory by setting the the room.0 memory pointer. When the menu system is submitted, AGI sets the first item of the first menu to the current item.

Once a menu system has been submitted, it cannot be modified. No menus or menu items can be added, modified or deleted. Future calls to submit.menu are ignored if a menu has already been submitted.

See the Menus in AGI topic for additional information on how menus work in AGI.

Possible Errors

Do NOT call this command until a menu system has been created. If called without first creating a menu, AGI will point to an invalid memory address and crash AGI if you later try to access the menu with the menu.input command.

Do NOT call submit.menu more than once. AGI does not check if a menu has already been submitted when the command runs, and it will reset the room.0 memory pointer again, which will waste memory, and could lead to memory overflow.

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: 158 (0x9E hex)

See Also

Player Input Commands
menu.input
Menus in AGI