actionitem
Function
This sets the action to take when the menu item in which this command is included is selected and the user hits enter. Several actionitem commands can be used in the same line and must be separated by semi-colon's.
Syntax
|
actionitem "<actionitem_command1> <argument1>;<actionitem_command2> <argument2> ..."
|
Notes & examples
|
The possible actionitem commands are:
- consolecmd
- pushmenu
- stuffcmd
- centerprint
- function
- callback
- popmenu
The most important of these actionitem commands is undoubtedly the consolecmd command since it's what makes consoles truly interactive. The text string argument after consolecmd is the data that will be sent to the console variable when the menu item that contains this action item is selected. Here's an example of the use of consolecmd:
actionitem "consolecmd 5"
In this example, when the menu item that contains this actionitem command is selected and the user hits the enter key, the value "5" is assigned the console variable (which is the "consolename" of the console entity). The value can then be read by a coninput Variable command.
The second most important of these actionitem commands is the pushmenu command. This is what makes hierarchical menus possible. The text string argument after pushmenu is the name of the menu to display on the console when the menu item that contains this action item is selected. Here's an example of the use of pushmenu:
actionitem "pushmenu level2"
In this example, when the menu item that contains this actionitem command is selected and the user hits the enter key, the menu commands contained between the "menulevel level2" command down to the next menulevel command in the menu file are loaded as the new menu to be displayed on the console. The player can then select an item from this new menu or go back to the previous menu by hitting the ESC key.
The role of the stuffcmd command is to pass any valid game console command or cvar to the game console for immediate execution. Do not confuse the game console (the one you drop in the game with the ~ tilde key) with in-game interactive consoles (console entities IOW). Here's an example of the use of stuffcmd:
actionitem "stuffcmd \"play dialog/general/phone/phone1.wav\""
Note here that since the actionitem command string must be enclosed between double quotes, the argument of the stuffcmd command (the game console command itself) must itself be enclosed between escaped double quotes (\" characters). This is true for any actionitem command which requires its argument to be enclosed between double quotes.
The role of the centerprint command is simply to print the text string specified in the command argument in a box in the center of the screen. Here's an example of the use of centerprint:
actionitem "centerprint \"You're toast!\""
Here again, note that the argument of the centerprint command (the text string to print) must itself be enclosed between escaped double quotes (\" characters).
The role of the function command appears to be "to pass a function to the game" for immediate execution. I was never able to get accurate information on this one so the details are sketchy and I can't really define what a "function" involves here. I included it here so the information I already gathered would not be lost. Here are the functions which I know about because I have seen examples of them in Ritual's global/menus/main.mnu file:
- refreshservers
- startserver
- joinserver
- apply_vid_changes
- vid_reset
- savegame
- loadgame
- relogon
- loadplayer
There are surely more functions apart from the ones in this short list. I have absolutely no information on the callback and popmenu actionitem commands.
|
|