Enable.item
The enable.item command enables a menu item that has been previously disabled.
Syntax
enable.item(ctl cA);
Remarks
This command will enable all menu items that match controller cA. Enabled items can be selected by the player. Use the disable.item command to disable menu items.
If the item is already enabled, or the controller is not assigned to a menu item, this command has no effect.
If multiple controllers use controller cA, all of them will be enabled when using the enable.item command.
All menu items are re-enabled whenever a game is restarted.
Possible Errors
Do not use the enable.item command unless a menu has already been created. AGI will attempt to read invalid data, which at best will have no effect, but could potentially crash AGI.
Example
<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 save command disable.item(c2);
[ submit menu to agi submit.menu() ... enable.item(c2); [ player is now allowed to save games </syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in version 2.272 and above. |
Byte-Code Value: | 159 (0x9F hex) |
The menu commands were actually added in version 2.272, but the commands did not do anything - they were all null functions. Code to support menus was not added to the commands until version 2.411.