Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Traceback (most recent call last):
- File "/home/deafmints/muddev/evennia/evennia/commands/cmdhandler.py", line 591, in _run_command
- ret = cmd.func()
- File "/home/deafmints/muddev/evennia/evennia/commands/default/general.py", line 74, in func
- self.msg(caller.at_look(target))
- File "/home/deafmints/muddev/evennia/evennia/objects/objects.py", line 1497, in at_look
- description = target.return_appearance(self)
- File "/home/deafmints/muddev/mygame/typeclasses/wiseobject.py", line 25, in return_appearance
- wisewords = wisewords % choice(self.db.wise_texts)
- File "/usr/lib/python2.7/random.py", line 277, in choice
- return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
- TypeError: object of type 'NoneType' has no len()
- from random import choice
- from typeclasses.objects import Object
- class WiseObject(Object):
- """
- An object speaking when someone looks at it. We assume
- it looks like a stone in this example
- """
- def at_object_creation(self):
- "Called when object is first created"
- self.db.wise_texts = \
- ["Stones have feelings too.",
- "To live like a stone is to not have lived at all",
- "The world is like a rock of chocolate."]
- def return_appearance(self, looker):
- """
- Called by the look command. We want to return
- a wisdom when we get looked at.
- """
- # first get the base string from the
- # parent's return_appearance.
- string = super(WiseObject, self).return_appearance(looker)
- wisewords = "\n\nIt grumbles and says: '%s'"
- wisewords = wisewords % choice(self.db.wise_texts)
- return string + wisewords
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement