Advertisement
Kovitikus

Untitled

Jul 23rd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. if not self.caller.db.has('mark'):
  2.             self.caller.db.mark = {}
  3.  
  4. "RETURNS ERROR"
  5. """
  6. Traceback (most recent call last):
  7.  File "d:\muddev\evennia\evennia\commands\cmdhandler.py", line 591, in _run_command
  8.    ret = cmd.func()
  9.  File "d:\muddev\mygame\commands\command.py", line 330, in func
  10.    if not self.caller.db.has('mark'):
  11. TypeError: 'NoneType' object is not callable
  12. """
  13.  
  14.  
  15. "Working Alternative"
  16. class CmdMark(Command):
  17.     """
  18.    Mark the current location.
  19.  
  20.    Usage:
  21.        mark <custom mark name>
  22.  
  23.    Marks the player's current location, using the provided arguments.
  24.    For a list of marks, simply type 'mark' with no argument.
  25.    """
  26.     key = "mark"
  27.  
  28.     def func(self):
  29.         if not self.caller.db.mark:
  30.             self.caller.db.mark = {}
  31.         if not self.args:
  32.             marks = self.caller.db.mark
  33.             return self.caller.msg(f"{marks}")
  34.        
  35.         self.caller.db.mark[self.args] = self.caller.location.dbref
  36.         self.caller.msg(f"{self.args} was added to your list of marks as {self.caller.location}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement