Difference between revisions of "MENU"
From SphereWiki
MrSugarCube (talk | contribs) (Created page with '__FORCETOC__ Menus are a simple way of displaying a selection dialog to clients. Menus can be shown to players in one of two styles: * Text-based * Item-based ==Text-Based Menu...') |
(No difference)
|
Revision as of 23:19, 9 June 2009
Menus are a simple way of displaying a selection dialog to clients. Menus can be shown to players in one of two styles:
- Text-based
- Item-based
Contents
Text-Based Menu
The syntax for defining a text-based menu is as follows:
[MENU defname]
title
ON=0 text
script
ON=0 text
script
Name | Description |
defname | The menu's defname. |
title | The title of the menu. Properties and references of the object the menu was called on can be accessed. |
text | The text to display for the option. Properties and references of the object the menu was called on can be accessed. |
script | The script to run when the option is pressed. |
Item-Based Menu
The syntax for an item-based menu is as follows:
[MENU defname]
title
ON=baseid text
script
ON=baseid @hue, text
script
Name | Description |
defname | The menu's defname. |
title | The title of the menu. Properties and references of the object the menu was called on can be accessed. |
baseid | The item BASEID to display for the button. |
hue | If the @hue syntax is used, the item will be displayed in the specified colour. |
text | The text to display for the option. Properties of the ITEMDEF that baseid refers to can be accessed. |
script | The script to run when the button is pressed. |
Examples
// // Displays a menu asking if the player wants more gold, and creates it // if they select Yes. // [MENU m_goldmenu] You currently have <SRC.BANKBALANCE>gp in your account. Would you like some more gold? ON=0 Yes SERV.NEWITEM i_gold, 5000 SRC.BOUNCE <NEW.UID> RETURN ON=0 No SRC.SYSMESSAGE Ok then! RETURN
// // Displays a menu asking the player which item they would like. // [MENU m_itemmenu] Which item would you like? ON=i_sword_viking <NAME> SERV.NEWITEM i_sword_viking SRC.BOUNCE <NEW.UID> RETURN ON=i_gold 5000 <NAME> SERV.NEWITEM i_gold, 5000 SRC.BOUNCE <NEW.UID> RETURN ON=i_backpack @020, a red backpack SERV.NEWITEM i_backpack NEW.COLOR = 020 SRC.BOUNCE <NEW.UID> RETURN ON=0 Nothing SRC.SYSMESSAGE You get nothing! RETURN