MENU
Syntax: #MENU command
Related: #CMD
Executes the specified menu commands. Specify each menu command exactly as displayed in the menu. For submenus, each menu must be listed separated by | characters. Thus, the Exit command is specified as File|Exit. There is no way for CMUD to fill in any dialog value, this command just executes the menu command as if the user clicked on the menus.
The #MENU command is also used to define Speed Menu items. This is used by the Export and Import functions. The syntax is:
Syntax: #MENU id|number caption {commands} class subclass
If the number is missing, the new menu item is appended to the list of menu items. Caption is the text displayed for the menu item, command is the command to execute when this menu item is selected from the right-click menu, class is the name of the class to put this menu item in, and subclass is the name of a Menu Class to use for a submenu. A caption of "-" can be used to create a seperator.
MENU examples
#MENU {File|Exit} Exits CMUD! (You wouldn't really do this, would you?)
#MENU {Actions|Make Button} Pops up the Make Button dialog box.
#MENU {Mapper|File|Map Creation Mode} Switches the AutoMapper to MapMode.
Speed menu examples
#MENU Kill {kill %selword} Defines a new speed menu item called Kill. This new menu item is appended to the speed menu. When you right-click on the MUD window, a popup menu will be displayed containing the "Kill" item. When this item is selected from the menu, the command "kill %selword" is executed. %selword is the word in the MUD window that was right-clicked on. So, if you right-click on the word "troll" and select Kill from the menu, the command "kill troll" is sent to the MUD.
#CLASS MySubMenu {menu}
#MENU "Eat bread" {eat bread}
#MENU "Eat meat" {eat meat}
#MENU "Eat %selword" {eat %selword}
#CLASS 0
#MENU "Eat" {} "" "MySubMenu" This example creates a submenu in the right-click menu. First, a Menu Class is created using the
#CLASS command. Within this special class, three menu items are created. The first one will send the "eat bread" command to the MUD, the second one will send the "eat meat" command to the MUD, and the third menu item will eat whatever word the mouse was right-clicked on, this is because expansion does not occur until the menu is displayed. Once this menu class is created, we switch back to the default class using the #CLASS 0 command. Then, within the default class, we create a top-level menu item for the right-click menu called "Eat". There is no command for this item, since it has a submenu assigned to it. The items for the submenu are taken from the "MySubMenu" class that we just created.