Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. Traceback (most recent call last):
  2. File "/home/deafmints/muddev/evennia/evennia/commands/cmdhandler.py", line 591, in _run_command
  3. ret = cmd.func()
  4. File "/home/deafmints/muddev/evennia/evennia/commands/default/general.py", line 74, in func
  5. self.msg(caller.at_look(target))
  6. File "/home/deafmints/muddev/evennia/evennia/objects/objects.py", line 1497, in at_look
  7. description = target.return_appearance(self)
  8. File "/home/deafmints/muddev/mygame/typeclasses/wiseobject.py", line 25, in return_appearance
  9. wisewords = wisewords % choice(self.db.wise_texts)
  10. File "/usr/lib/python2.7/random.py", line 277, in choice
  11. return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
  12. TypeError: object of type 'NoneType' has no len()
  13.  
  14. from random import choice
  15. from typeclasses.objects import Object
  16.  
  17. class WiseObject(Object):
  18. """
  19. An object speaking when someone looks at it. We assume
  20. it looks like a stone in this example
  21. """
  22. def at_object_creation(self):
  23. "Called when object is first created"
  24. self.db.wise_texts = \
  25. ["Stones have feelings too.",
  26. "To live like a stone is to not have lived at all",
  27. "The world is like a rock of chocolate."]
  28.  
  29. def return_appearance(self, looker):
  30. """
  31. Called by the look command. We want to return
  32. a wisdom when we get looked at.
  33. """
  34. # first get the base string from the
  35. # parent's return_appearance.
  36. string = super(WiseObject, self).return_appearance(looker)
  37. wisewords = "\n\nIt grumbles and says: '%s'"
  38. wisewords = wisewords % choice(self.db.wise_texts)
  39. return string + wisewords
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement