Advertisement
Guest User

Example of evmenu list_node decorator

a guest
Apr 19th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. ## Example of use of the list_node menu node decorator
  2.  
  3. from evennia.utils.evmenu import list_node
  4.  
  5. # as part of a menu node list - decorate a node with the options.
  6. # any extra options added in the node will also be added to resulsing
  7. # node. Example:
  8.  
  9. @list_node(all_typeclasses_list, callable_when_selecting_option)
  10. def typeclass_node(caller, raw_input, **kwargs):
  11.     text = "Set the prototype's Typeclass."
  12.     return text, {}
  13.  
  14. # ... will produce this menu node in-game:
  15.  
  16. __________________________________________________________________________________________________________
  17.  
  18. Set the prototype's Typeclass.
  19.  
  20. __________________________________________________________________________________________________________
  21. 1: evennia.objects.objects.DefaultCharacter   8: evennia.scripts.scripts.ScriptBase              
  22. 2: evennia.objects.objects.DefaultExit        9: evennia.scripts.scripts.Store                  
  23. 3: evennia.objects.objects.DefaultObject      10: evennia.utils.gametime.TimeScript              
  24. 4: evennia.objects.objects.DefaultRoom        current: (2/4)                                    
  25. 5: evennia.scripts.models.ScriptDB            previous page                                      
  26. 6: evennia.scripts.scripts.DefaultScript      next page                                          
  27. 7: evennia.scripts.scripts.DoNothing                    
  28.  
  29.  
  30. # The listing is multi-page and you can flip between the pages before selecting and handle
  31. # the choice using the callable you give to the @decorator.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement