ooccommand to leave your current
icto attempt to
quellcommand can be used. This
Adminetc, the lower of the
How to create your own Account types¶
mygame/typeclasses/accounts.pythere is an empty class ready for you to modify.
Here’s an example of modifying the default Account class in code:
# in mygame/typeclasses/accounts.py from evennia import DefaultAccount class Account(DefaultAccount): # [...] at_account_creation(self): "this is called only once, when account is first created" self.db.real_name = None # this is set later self.db.real_address = None # " self.db.config_1 = True # default config self.db.config_2 = False # " self.db.config_3 = 1 # " # ... whatever else our game needs to know ``` Reload the server with `reload`.
examine *self(the asterisk makes you examine your Account object rather
py [account.at_account_creation() for account in evennia.managers.accounts.all()]
You should now see the Attributes on yourself.
If you wanted Evennia to default to a completely different Account class located elsewhere, youmust point Evennia to it. Add
BASE_ACCOUNT_TYPECLASSto your settings file, and give the pythonpath to your custom class as its value. By default this points to
typeclasses.accounts.Account,the empty template we used above.
Properties on Accounts¶
user- a unique link to a
UserDjango object, representing the logged-in user.
obj- an alias for
name- an alias for
sessions- an instance of ObjectSessionHandler managing all connected Sessions (physical connections) this object listens to (Note: In older versions of Evennia, this was a list). The so-called
session-id(used in many places) is found as a property
sessidon each Session instance.
is_superuser(bool: True/False) - if this account is a superuser.
cmdset- This holds all the current Commands of this Account. By default these are the commands found in the cmdset defined by
nicks- This stores and handles Nicks, in the same way as nicks it works on Objects. For Accounts, nicks are primarily used to store custom aliases for Channels.
Selection of special methods (see
get_puppet- get a currently puppeted object connected to the Account and a given session id, if any.
puppet_object- connect a session to a puppetable Object.
unpuppet_object- disconnect a session from a puppetable Object.
msg- send text to the Account
execute_cmd- runs a command as if this Account did it.
search- search for Accounts.