Functions to enable/disable, add to or clear the player's context menu.
Properties
enabled |
A boolean value to set wheter the context menu is available. |
active |
Returns true if the context menu is currently being shown. Can also be set to manually show/hide the menu. |
Methods
add(name,script,enabledConditionScript, iconFileName, iconConditionScript) |
Adds a new user item to the context menu. The 'name' is what's displayed in the menu, and the 'script' is the script to execute when the item is selected. You can also (optionally) pass 'enabledConditionScript' that will only enable the menu item if the script evaluates to boolean 'true'. The 'iconFileName' is the name of an image resource at document level (or a full path to it's location on disk), and the 'iconConditionScript' will only show the icon if it evaluates to boolean 'true'. Images should be 16x16 pixels. |
clear() |
Removes all user items from the context menu. |
Examples
system.contextMenu.enabled=true;
system.contextMenu.clear();
system.contextMenu.add("Say Hello","print('hello!');"); //Sends 'hello!' to the console if you choose this menu item.
system.contextMenu.add("Say Hello","print('hello!');","(system.timer>2.0)","speaker.png",""); //Only enable the command if 2 seconds have passed. Also show 'speaker.png' as an icon.
Remarks
To customize the appearance of other items in the menu, use the Properties dialog at document level.
See Also


