Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.21 KB | None | 0 0
  1. class CmdTakeFrom(Command):
  2.     """
  3.    Usage:
  4.  
  5.    Take <item> from <container>
  6.  
  7.    Gets an item from the container, if it's in there.
  8.    """
  9.     key = "take"
  10.  
  11.     def parse(self):
  12.        # get args into 2 variables
  13.        words = self.args.split("from")
  14.        self.item = words[0]
  15.        self.container = words[1]
  16.        item = self.item
  17.        container = self.container
  18.        caller = self.caller
  19.        container = caller.search(object, location=caller) # Check if container is in the room.
  20.        item = caller.search(object, location=container) # Check if the item is in the container.
  21.            
  22.        if container and item:
  23.               container.obj.move_to(caller, quiet=True) #move the item to the caller inventory
  24.               caller.msg("%s is in %s.") % item, container
  25.               caller.location.msg_contents(f"{caller.name} takes {item} from {container}.")
  26.  
  27.               caller.msg(f"You get {item} from {container}.")
  28.        else:
  29.             caller.msg("That item isn't in there.")
  30.  
  31.  
  32. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  33.  
  34.  
  35.  
  36. Could not find '<class 'object'>'.
  37. Could not find '<class 'object'>'.
  38. That item isn't in there.
  39.  
  40. Command take has no defined `func()` - showing on-command variables:
  41. obj (<class 'typeclasses.characters.Character'>): God
  42. lockhandler (<class 'evennia.locks.lockhandler.LockHandler'>): cmd:all()
  43. caller (<class 'typeclasses.characters.Character'>): God
  44. cmdname (<class 'str'>): take
  45. raw_cmdname (<class 'str'>): take
  46. cmdstring (<class 'str'>): take
  47. args (<class 'str'>):  muffin from basket
  48. cmdset (<class 'evennia.commands.cmdset.CmdSet'>): +editnpc, +npc, +npccreate, @buildshop, about, access, accounts, addcom, alias, allcom, ban, batchcode, batchcommands, boot, cboot, ccreate, cdesc, cdestroy, cemit, channels, charcreate, chardelete, chelp, clock, cmdsets, color, copy, cpattr, create, cwho, delcom, desc, destroy, dice, dig, drop, east, emit, examine, find, force, get, give, grapevine2chan, help, home, ic, inventory, irc2chan, ircstatus, link, lock, look, mudinfo, mvattr, mystats, name, nick, north, objects, ooc, open, option, page, password, perm, pose, public, py, quell, quit, reload, reset, rss2chan, say, script, scripts, server, service, sessions, set, setdesc, sethelp, sethome, shutdown, spawn, study, style, tag, take, tel, tickers, time, trade, tunnel, typeclass, unban, unlink, userpassword, wall, whisper, who, wipe
  49. session (<class 'evennia.server.serversession.ServerSession'>): God(#1)@1:2:7:.:0:.:0:.:1
  50. account (<class 'typeclasses.accounts.Account'>): God(account 1)
  51. raw_string (<class 'str'>): take muffin from basket
  52. cmdid (<class 'int'>): 1170
  53. item (<class 'str'>):  muffin
  54. container (<class 'str'>):  basket
  55.        --------------------------------------------------
  56. take - Command variables from evennia:
  57. --------------------------------------------------
  58. name of cmd (self.key): take
  59. cmd aliases (self.aliases): []
  60. cmd locks (self.locks): cmd:all();
  61. help category (self.help_category): General
  62. object calling (self.caller): God
  63. object storing cmdset (self.obj): God
  64. command string given (self.cmdstring): take
  65. current cmdset (self.cmdset): ChannelCmdSet
  66. >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement