About controllers
A controller is an event that has occured due to the user selecting a menu item or pressing a key. There are 50 controllers available (numbered from 0-49), and menu items and keys are assigned to them. To test whether the event has occured, use the controller test command, like this:
if (controller(c2)) { quit(0); }
The above example tests for controller 2 (which could be assigned to "quit" on the menu), and if it has occured, it quits the game.
Setting up menus
First use the set.menu command to create a menu. Then use the set.menu.item command to add items to it. Repeat this process until all the menus have been set up, and then use the submit.menu command to initialize it, making it available for use. Here is an example of creating a menu:
set.menu("File"); set.menu.item("Restart",c1); set.menu.item("Quit",c2); set.menu("Help"); set.menu.item("About"); submit.menu();
The second parameter of the set.menu.item command is the controller that the menu item is being assigned to. You can assign multiple menu items and keys to the one controller, for example most game functions like save, restore, quit etc. usually have both a menu item and a key.
The menu can be brought up using the menu.input command.
Setting up keys
Use the set.key command.