Keymenulib.Keymenu keymenu
From EventScripts Community Encyclopedia
[edit] Class: Keymenulib.Keymenu_keymenuNote: Requires EventScripts 2.0
Module: keymenulib [edit] Overview[edit] DescriptionA normal keymenu to be displayed, where the contents are added from a keygroup or KeyValues object. For constructing item based menus in Python, usage of popuplib.Popup_easymenu is recommended. You should not create instances of this class directly, instead use keymenulib.create method which will correctly bind the keymenu object. [edit] Quick ExampleThis example shows how to create a simple keymenu, send it later and delete it. import es import keymenulib myKeymenu = None def load(): global myKeymenu # Create a keygroup that holds some player information es.server.cmd("es_xcreateplayerlist playerlist") # Create a new Keymenu_keymenu object using the create method from keymenulib: myKeymenu = keymenulib.create('example_keymenu', '_temp', submit, 'playerlist', '#keyvalue name', '#key', 'Playerlist\nSelect a player') def player_jump(event_var): # Let's greet the jumping player with our keymenu myKeymenu.send(event_var['userid']) def submit(userid, choice, keymenuname): es.tell(userid, "You selected item "+choice+" from "+keymenuname) def unload(): # Script unloading, remove the keymenu from taking memory myKeymenu.delete() [edit] Methods
[edit] See Also |
|
