evennia.contrib.rpg.rpsystem.rpsystem

Roleplaying base system for Evennia

Contribution - Griatch, 2015

This module contains the ContribRPObject, ContribRPRoom and ContribRPCharacter typeclasses. If you inherit your objects/rooms/character from these (or make them the defaults) from these you will get the following features:

  • Objects/Rooms will get the ability to have poses and will report the poses of items inside them (the latter most useful for Rooms).

  • Characters will get poses and also sdescs (short descriptions)

that will be used instead of their keys. They will gain commands for managing recognition (custom sdesc-replacement), masking themselves as well as an advanced free-form emote command.

In more detail, This RP base system introduces the following features to a game, common to many RP-centric games:

  • emote system using director stance emoting (names/sdescs).

    This uses a customizable replacement noun (/me, @ etc) to represent you in the emote. You can use /sdesc, /nick, /key or /alias to reference objects in the room. You can use any number of sdesc sub-parts to differentiate a local sdesc, or use /1-sdesc etc to differentiate them. The emote also identifies nested says and separates case.

  • sdesc obscuration of real character names for use in emotes

    and in any referencing such as object.search(). This relies on an SdescHandler sdesc being set on the Character and makes use of a custom Character.get_display_name hook. If sdesc is not set, the character’s key is used instead. This is particularly used in the emoting system.

  • recog system to assign your own nicknames to characters, can then

    be used for referencing. The user may recog a user and assign any personal nick to them. This will be shown in descriptions and used to reference them. This is making use of the nick functionality of Evennia.

  • masks to hide your identity (using a simple lock).

  • pose system to set room-persistent poses, visible in room

    descriptions and when looking at the person/object. This is a simple Attribute that modifies how the characters is viewed when in a room as sdesc + pose.

  • in-emote says, including seamless integration with language

    obscuration routine (such as contrib/rpg/rplanguage.py)

Installation:

Add RPSystemCmdSet from this module to your CharacterCmdSet:

# mygame/commands/default_cmdsets.py

# ...

from evennia.contrib.rpg.rpsystem.rpsystem import RPSystemCmdSet  <---

class CharacterCmdSet(default_cmds.CharacterCmdset):
    # ...
    def at_cmdset_creation(self):
        # ...
        self.add(RPSystemCmdSet())  # <---

You also need to make your Characters/Objects/Rooms inherit from the typeclasses in this module:

# in mygame/typeclasses/characters.py

from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPCharacter

class Character(ContribRPCharacter):
    # ...
# in mygame/typeclasses/objects.py

from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPObject

class Object(ContribRPObject):
    # ...
# in mygame/typeclasses/rooms.py

from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPRoom

class Room(ContribRPRoom):
    # ...

Examples:

> look Tavern The tavern is full of nice people

A tall man is standing by the bar.

Above is an example of a player with an sdesc “a tall man”. It is also an example of a static pose: The “standing by the bar” has been set by the player of the tall man, so that people looking at him can tell at a glance what is going on.

> emote /me looks at /Tall and says “Hello!”

I see:

Griatch looks at Tall man and says “Hello”.

Tall man (assuming his name is Tom) sees:

The godlike figure looks at Tom and says “Hello”.

Note that by default, the case of the tag matters, so /tall will lead to ‘tall man’ while /Tall will become ‘Tall man’ and /TALL becomes /TALL MAN. If you don’t want this behavior, you can pass case_sensitive=False to the send_emote function.

Extra Installation Instructions:

  1. In typeclasses/character.py: Import the ContribRPCharacter class:

    from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPCharacter

    Inherit ContribRPCharacter:

    Change “class Character(DefaultCharacter):” to class Character(ContribRPCharacter):

    If you have any overriden calls in at_object_creation(self):

    Add super().at_object_creation() as the top line.

  2. In typeclasses/rooms.py:

    Import the ContribRPRoom class: from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPRoom

    Inherit ContribRPRoom:

    Change class Room(DefaultRoom): to class Room(ContribRPRoom):

  3. In typeclasses/objects.py

    Import the ContribRPObject class: from evennia.contrib.rpg.rpsystem.rpsystem import ContribRPObject

    Inherit ContribRPObject:

    Change class Object(DefaultObject): to class Object(ContribRPObject):

  4. Reload the server (reload or from console: “evennia reload”)

  5. Force typeclass updates as required. Example for your character:

    type/reset/force me = typeclasses.characters.Character

exception evennia.contrib.rpg.rpsystem.rpsystem.EmoteError[source]

Bases: Exception

exception evennia.contrib.rpg.rpsystem.rpsystem.SdescError[source]

Bases: Exception

exception evennia.contrib.rpg.rpsystem.rpsystem.RecogError[source]

Bases: Exception

exception evennia.contrib.rpg.rpsystem.rpsystem.LanguageError[source]

Bases: Exception

evennia.contrib.rpg.rpsystem.rpsystem.parse_language(speaker, emote)[source]

Parse the emote for language. This is used with a plugin for handling languages.

Parameters
  • speaker (Object) – The object speaking.

  • emote (str) – An emote possibly containing language references.

Returns

(emote, mapping) (tuple)

A tuple where the

emote is the emote string with all says (including quotes) replaced with reference markers on the form {##n} where n is a running number. The mapping is a dictionary between the markers and a tuple (langname, saytext), where langname can be None.

Raises
  • evennia.contrib.rpg.rpsystem.LanguageError – If an invalid language was

  • specified.

Notes

Note that no errors are raised if the wrong language identifier is given. This data, together with the identity of the speaker, is intended to be used by the “listener” later, since with this information the language skill of the speaker can be offset to the language skill of the listener to determine how much information is actually conveyed.

evennia.contrib.rpg.rpsystem.rpsystem.parse_sdescs_and_recogs(sender, candidates, string, search_mode=False, case_sensitive=True, fallback=None)[source]

Read a raw emote and parse it into an intermediary format for distributing to all observers.

Parameters
  • sender (Object) – The object sending the emote. This object’s recog data will be considered in the parsing.

  • candidates (iterable) – A list of objects valid for referencing in the emote.

string (str): The string (like an emote) we want to analyze for keywords. search_mode (bool, optional): If True, the “emote” is a query string

we want to analyze. If so, the return value is changed.

case_sensitive (bool, optional): If set, the case of /refs matter, so that

/tall will come out as ‘tall man’ while /Tall will become ‘Tall man’. This allows for more grammatically correct emotes at the cost of being a little more to learn for players. If disabled, the original sdesc case is always kept and are inserted as-is.

fallback (string, optional): If set, any references that don’t match a target

will be replaced with the fallback string. If None (default), the parsing will fail and give a warning about the missing reference.

Returns

(emote, mapping) (tuple)

If search_mode is False

(default), a tuple where the emote is the emote string, with all references replaced with internal-representation {#dbref} markers and mapping is a dictionary {“#dbref”:obj, …}.

result (list): If search_mode is True we are

performing a search query on string, looking for a specific object. A list with zero, one or more matches.

Raises

EmoteException – For various ref-matching errors.

Notes

The parser analyzes and should understand the following _PREFIX-tagged structures in the emote: - self-reference (/me) - recogs (any part of it) stored on emoter, matching obj in candidates. - sdesc (any part of it) from any obj in candidates. - N-sdesc, N-recog separating multi-matches (1-tall, 2-tall) - says, “…” are

evennia.contrib.rpg.rpsystem.rpsystem.send_emote(sender, receivers, emote, msg_type='pose', anonymous_add='first', **kwargs)[source]

Main access function for distribute an emote.

Parameters
  • sender (Object) – The one sending the emote.

  • receivers (iterable) – Receivers of the emote. These will also form the basis for which sdescs are ‘valid’ to use in the emote.

  • emote (str) – The raw emote string as input by emoter.

  • msg_type (str) – The type of emote this is. “say” or “pose” for example. This is arbitrary and used for generating extra data for .msg(text) tuple.

  • anonymous_add (str or None, optional) – If sender is not self-referencing in the emote, this will auto-add sender’s data to the emote. Possible values are - None: No auto-add at anonymous emote - ‘last’: Add sender to the end of emote as [sender] - ‘first’: Prepend sender to start of emote.

Kwargs:
case_sensitive (bool): Defaults to True, but can be unset

here. When enabled, /tall will lead to a lowercase ‘tall man’ while /Tall will lead to ‘Tall man’ and /TALL will lead to ‘TALL MAN’. If disabled, the sdesc’s case will always be used, regardless of the /ref case used.

any: Other kwargs will be passed on into the receiver’s process_sdesc and

process_recog methods, and can thus be used to customize those.

class evennia.contrib.rpg.rpsystem.rpsystem.SdescHandler(obj)[source]

Bases: object

This Handler wraps all operations with sdescs. We need to use this since we do a lot preparations on sdescs when updating them, in order for them to be efficient to search for and query.

The handler stores data in the following Attributes

_sdesc - a string _regex - an empty dictionary

__init__(obj)[source]

Initialize the handler

Parameters

obj (Object) – The entity on which this handler is stored.

add(sdesc, max_length=60)[source]

Add a new sdesc to object, replacing the old one.

Parameters
  • sdesc (str) – The sdesc to set. This may be stripped of control sequences before setting.

  • max_length (int, optional) – The max limit of the sdesc.

Returns

sdesc (str) – The actually set sdesc.

Raises
  • SdescError – If the sdesc is empty, can not be set or is

  • longer than max_length.

clear()[source]

Clear sdesc.

get()[source]

Simple getter. The sdesc should never be allowed to be empty, but if it is we must fall back to the key.

class evennia.contrib.rpg.rpsystem.rpsystem.RecogHandler(obj)[source]

Bases: object

This handler manages the recognition mapping of an Object.

The handler stores data in Attributes as dictionaries of the following names:

_recog_ref2recog _recog_obj2recog

__init__(obj)[source]

Initialize the handler

Parameters

obj (Object) – The entity on which this handler is stored.

add(obj, recog, max_length=60)[source]

Assign a custom recog (nick) to the given object.

Parameters
  • obj (Object) – The object ot associate with the recog string. This is usually determined from the sdesc in the room by a call to parse_sdescs_and_recogs, but can also be given.

  • recog (str) – The replacement string to use with this object.

  • max_length (int, optional) – The max length of the recog string.

Returns

recog (str) – The (possibly cleaned up) recog string actually set.

Raises

SdescError – When recog could not be set or sdesc longer than max_length.

get(obj)[source]

Get recog replacement string, if one exists.

Parameters

obj (Object) – The object, whose sdesc to replace

Returns

recog (str or None)

The replacement string to use, or

None if there is no recog for this object.

Notes

This method will respect a “enable_recog” lock set on obj (True by default) in order to turn off recog mechanism. This is useful for adding masks/hoods etc.

all()[source]

Get a mapping of the recogs stored in handler.

Returns

recogs (dict) – A mapping of {recog: obj} stored in handler.

remove(obj)[source]

Clear recog for a given object.

Parameters

obj (Object) – The object for which to remove recog.

class evennia.contrib.rpg.rpsystem.rpsystem.RPCommand(**kwargs)[source]

Bases: evennia.commands.command.Command

simple parent

parse()[source]

strip extra whitespace

aliases = []
help_category = 'general'
key = 'command'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'no_prefix': ' ', 'tags': '', 'text': 'simple parent'}
class evennia.contrib.rpg.rpsystem.rpsystem.CmdEmote(**kwargs)[source]

Bases: evennia.contrib.rpg.rpsystem.rpsystem.RPCommand

Emote an action, allowing dynamic replacement of text in the emote.

Usage:

emote text

Example

emote /me looks around. emote With a flurry /me attacks /tall man with his sword. emote “Hello”, /me says.

Describes an event in the world. This allows the use of /ref markers to replace with the short descriptions or recognized strings of objects in the same room. These will be translated to emotes to match each person seeing it. Use “…” for saying things and langcode”…” without spaces to say something in a different language.

key = 'emote'
aliases = [':']
locks = 'cmd:all()'
arg_regex = re.compile('', re.IGNORECASE)
func()[source]

Perform the emote.

help_category = 'general'
lock_storage = 'cmd:all()'
search_index_entry = {'aliases': ':', 'category': 'general', 'key': 'emote', 'no_prefix': ' :', 'tags': '', 'text': '\n Emote an action, allowing dynamic replacement of\n text in the emote.\n\n Usage:\n emote text\n\n Example:\n emote /me looks around.\n emote With a flurry /me attacks /tall man with his sword.\n emote "Hello", /me says.\n\n Describes an event in the world. This allows the use of /ref\n markers to replace with the short descriptions or recognized\n strings of objects in the same room. These will be translated to\n emotes to match each person seeing it. Use "..." for saying\n things and langcode"..." without spaces to say something in\n a different language.\n\n '}
class evennia.contrib.rpg.rpsystem.rpsystem.CmdSay(**kwargs)[source]

Bases: evennia.contrib.rpg.rpsystem.rpsystem.RPCommand

speak as your character

Usage:

say <message>

Talk to those in your current location.

key = 'say'
aliases = ['"', "'"]
locks = 'cmd:all()'
arg_regex = re.compile('', re.IGNORECASE)
func()[source]

Run the say command

help_category = 'general'
lock_storage = 'cmd:all()'
search_index_entry = {'aliases': '" \'', 'category': 'general', 'key': 'say', 'no_prefix': ' " \'', 'tags': '', 'text': '\n speak as your character\n\n Usage:\n say <message>\n\n Talk to those in your current location.\n '}
class evennia.contrib.rpg.rpsystem.rpsystem.CmdSdesc(**kwargs)[source]

Bases: evennia.contrib.rpg.rpsystem.rpsystem.RPCommand

Assign yourself a short description (sdesc).

Usage:

sdesc <short description> sdesc - view current sdesc sdesc clear - remove sdesc

Assigns a short description to yourself.

key = 'sdesc'
locks = 'cmd:all()'
func()[source]

Assign the sdesc

aliases = []
help_category = 'general'
lock_storage = 'cmd:all()'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'sdesc', 'no_prefix': ' ', 'tags': '', 'text': '\n Assign yourself a short description (sdesc).\n\n Usage:\n sdesc <short description>\n sdesc - view current sdesc\n sdesc clear - remove sdesc\n\n Assigns a short description to yourself.\n\n '}
class evennia.contrib.rpg.rpsystem.rpsystem.CmdPose(**kwargs)[source]

Bases: evennia.contrib.rpg.rpsystem.rpsystem.RPCommand

Set a static pose

Usage:

pose <pose> pose default <pose> pose reset pose obj = <pose> pose default obj = <pose> pose reset obj =

Examples

pose leans against the tree pose is talking to the barkeep. pose box = is sitting on the floor.

Set a static pose. This is the end of a full sentence that starts with your sdesc. If no full stop is given, it will be added automatically. The default pose is the pose you get when using pose reset. Note that you can use sdescs/recogs to reference people in your pose, but these always appear as that person’s sdesc in the emote, regardless of who is seeing it.

key = 'pose'
parse()[source]

Extract the “default” alternative to the pose.

func()[source]

Create the pose

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'pose', 'no_prefix': ' ', 'tags': '', 'text': "\n Set a static pose\n\n Usage:\n pose <pose>\n pose default <pose>\n pose reset\n pose obj = <pose>\n pose default obj = <pose>\n pose reset obj =\n\n Examples:\n pose leans against the tree\n pose is talking to the barkeep.\n pose box = is sitting on the floor.\n\n Set a static pose. This is the end of a full sentence that starts\n with your sdesc. If no full stop is given, it will be added\n automatically. The default pose is the pose you get when using\n pose reset. Note that you can use sdescs/recogs to reference\n people in your pose, but these always appear as that person's\n sdesc in the emote, regardless of who is seeing it.\n\n "}
class evennia.contrib.rpg.rpsystem.rpsystem.CmdRecog(**kwargs)[source]

Bases: evennia.contrib.rpg.rpsystem.rpsystem.RPCommand

Recognize another person in the same room.

Usage:

recog recog sdesc as alias forget alias

Example

recog tall man as Griatch forget griatch

This will assign a personal alias for a person, or forget said alias. Using the command without arguments will list all current recogs.

key = 'recog'
aliases = ['recognize', 'forget']
parse()[source]

Parse for the sdesc as alias structure

func()[source]

Assign the recog

help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'recognize forget', 'category': 'general', 'key': 'recog', 'no_prefix': ' recognize forget', 'tags': '', 'text': '\n Recognize another person in the same room.\n\n Usage:\n recog\n recog sdesc as alias\n forget alias\n\n Example:\n recog tall man as Griatch\n forget griatch\n\n This will assign a personal alias for a person, or forget said alias.\n Using the command without arguments will list all current recogs.\n\n '}
class evennia.contrib.rpg.rpsystem.rpsystem.CmdMask(**kwargs)[source]

Bases: evennia.contrib.rpg.rpsystem.rpsystem.RPCommand

Wear a mask

Usage:

mask <new sdesc> unmask

This will put on a mask to hide your identity. When wearing a mask, your sdesc will be replaced by the sdesc you pick and people’s recognitions of you will be disabled.

key = 'mask'
aliases = ['unmask']
func()[source]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'unmask', 'category': 'general', 'key': 'mask', 'no_prefix': ' unmask', 'tags': '', 'text': "\n Wear a mask\n\n Usage:\n mask <new sdesc>\n unmask\n\n This will put on a mask to hide your identity. When wearing\n a mask, your sdesc will be replaced by the sdesc you pick and\n people's recognitions of you will be disabled.\n\n "}
class evennia.contrib.rpg.rpsystem.rpsystem.RPSystemCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Mix-in for adding rp-commands to default cmdset.

at_cmdset_creation()[source]

Hook method - this should be overloaded in the inheriting class, and should take care of populating the cmdset by use of self.add().

path = 'evennia.contrib.rpg.rpsystem.rpsystem.RPSystemCmdSet'
class evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultObject

This class is meant as a mix-in or parent for objects in an rp-heavy game. It implements the base functionality for poses.

sdesc[source]
at_object_creation()[source]

Called at initial creation.

search(searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, multimatch_string=None, use_dbref=None)[source]

Returns an Object matching a search string/condition, taking sdescs into account.

Perform a standard object search in the database, handling multiple results and lack thereof gracefully. By default, only objects in the current location of self or its inventory are searched for.

Parameters
  • searchdata (str or obj) –

    Primary search criterion. Will be matched against object.key (with object.aliases second) unless the keyword attribute_name specifies otherwise. Special strings: - #<num>: search by unique dbref. This is always

    a global search.

    • me,self: self-reference to this object

    • <num>-<string> - can be used to differentiate

      between multiple same-named matches

  • global_search (bool) – Search all objects globally. This is overruled by location keyword.

  • use_nicks (bool) – Use nickname-replace (nicktype “object”) on searchdata.

  • typeclass (str or Typeclass, or list of either) – Limit search only to Objects with this typeclass. May be a list of typeclasses for a broader search.

  • location (Object or list) – Specify a location or multiple locations to search. Note that this is used to query the contents of a location and will not match for the location itself - if you want that, don’t set this or use candidates to specify exactly which objects should be searched.

  • attribute_name (str) – Define which property to search. If set, no key+alias search will be performed. This can be used to search database fields (db_ will be automatically appended), and if that fails, it will try to return objects having Attributes with this name and value equal to searchdata. A special use is to search for “key” here if you want to do a key-search without including aliases.

  • quiet (bool) – don’t display default error messages - this tells the search method that the user wants to handle all errors themselves. It also changes the return value type, see below.

  • exact (bool) – if unset (default) - prefers to match to beginning of string rather than not matching at all. If set, requires exact matching of entire string.

  • candidates (list of objects) – this is an optional custom list of objects to search (filter) between. It is ignored if global_search is given. If not set, this list will automatically be defined to include the location, the contents of location and the caller’s contents (inventory).

  • nofound_string (str) – optional custom string for not-found error message.

  • multimatch_string (str) – optional custom string for multimatch error header.

  • use_dbref (bool or None) – If None, only turn off use_dbref if we are of a lower permission than Builder. Otherwise, honor the True/False value.

Returns

match (Object, None or list)

will return an Object/None if quiet=False,

otherwise it will return a list of 0, 1 or more matches.

Notes

To find Accounts, use eg. evennia.account_search. If quiet=False, error messages will be handled by settings.SEARCH_AT_RESULT and echoed automatically (on error, return will be None). If quiet=True, the error messaging is assumed to be handled by the caller.

get_posed_sdesc(sdesc, **kwargs)[source]

Displays the object with its current pose string.

Returns

pose (str)

A string containing the object’s sdesc and

current or default pose.

get_display_name(looker, **kwargs)[source]

Displays the name of the object in a viewer-aware manner.

Parameters

looker (TypedObject) – The object or account that is looking at/getting inforamtion for this object.

Keyword Arguments
  • pose (bool) – Include the pose (if available) in the return.

  • ref (str) – The reference marker found in string to replace. This is on the form #{num}{case}, like ‘#12^’, where the number is a processing location in the string and the case symbol indicates the case of the original tag input - t - input was Titled, like /Tall - ^ - input was all uppercase, like /TALL - v - input was all lowercase, like /tall - ~ - input case should be kept, or was mixed-case

  • noid (bool) – Don’t show DBREF even if viewer has control access.

Returns

name (str)

A string of the sdesc containing the name of the object,

if this is defined. By default, included the DBREF if this user is privileged to control said object.

get_display_characters(looker, pose=True, **kwargs)[source]

Get the ‘characters’ component of the object description. Called by return_appearance.

get_display_things(looker, pose=True, **kwargs)[source]

Get the ‘things’ component of the object description. Called by return_appearance.

Parameters
  • looker (Object) – Object doing the looking.

  • **kwargs – Arbitrary data for use when overriding.

Returns

str – The things display data.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultObject.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultObject.MultipleObjectsReturned

path = 'evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject'
typename = 'ContribRPObject'
class evennia.contrib.rpg.rpsystem.rpsystem.ContribRPRoom(*args, **kwargs)[source]

Bases: evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject

Dummy inheritance for rooms.

exception DoesNotExist

Bases: evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject.MultipleObjectsReturned

path = 'evennia.contrib.rpg.rpsystem.rpsystem.ContribRPRoom'
typename = 'ContribRPRoom'
class evennia.contrib.rpg.rpsystem.rpsystem.ContribRPCharacter(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultCharacter, evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject

This is a character class that has poses, sdesc and recog.

recog[source]
get_display_name(looker, **kwargs)[source]

Displays the name of the object in a viewer-aware manner.

Parameters

looker (TypedObject) – The object or account that is looking at/getting inforamtion for this object.

Keyword Arguments
  • pose (bool) – Include the pose (if available) in the return.

  • ref (str) – The reference marker found in string to replace. This is on the form #{num}{case}, like ‘#12^’, where the number is a processing location in the string and the case symbol indicates the case of the original tag input - t - input was Titled, like /Tall - ^ - input was all uppercase, like /TALL - v - input was all lowercase, like /tall - ~ - input case should be kept, or was mixed-case

  • noid (bool) – Don’t show DBREF even if viewer has control access.

Returns

name (str)

A string of the sdesc containing the name of the object,

if this is defined. By default, included the DBREF if this user is privileged to control said object.

Notes

The RPCharacter version adds additional processing to sdescs to make characters stand out from other objects.

at_object_creation()[source]

Called at initial creation.

at_pre_say(message, **kwargs)[source]

Called before the object says or whispers anything, return modified message.

Parameters

message (str) – The suggested say/whisper text spoken by self.

Keyword Arguments

whisper (bool) – If True, this is a whisper rather than a say.

get_sdesc(obj, process=False, **kwargs)[source]

Single method to handle getting recogs with sdesc fallback in an aware manner, to allow separate processing of recogs from sdescs. Gets the sdesc or recog for obj from the view of self.

Parameters

obj (Object) – the object whose sdesc or recog is being gotten

Keyword Arguments

process (bool) – If True, the sdesc/recog is run through the appropriate process method for self - .process_sdesc or .process_recog

process_sdesc(sdesc, obj, **kwargs)[source]

Allows to customize how your sdesc is displayed (primarily by changing colors).

Parameters
  • sdesc (str) – The sdesc to display.

  • obj (Object) – The object to which the adjoining sdesc belongs. If this object is equal to yourself, then you are viewing yourself (and sdesc is your key). This is not used by default.

Kwargs:
ref (str): The reference marker found in string to replace.

This is on the form #{num}{case}, like ‘#12^’, where the number is a processing location in the string and the case symbol indicates the case of the original tag input - t - input was Titled, like /Tall - ^ - input was all uppercase, like /TALL - v - input was all lowercase, like /tall - ~ - input case should be kept, or was mixed-case

Returns

sdesc (str)

The processed sdesc ready

for display.

process_recog(recog, obj, **kwargs)[source]

Allows to customize how a recog string is displayed.

Parameters
  • recog (str) – The recog string. It has already been translated from the original sdesc at this point.

  • obj (Object) – The object the recog:ed string belongs to. This is not used by default.

Returns

recog (str) – The modified recog string.

process_language(text, speaker, language, **kwargs)[source]

Allows to process the spoken text, for example by obfuscating language based on your and the speaker’s language skills. Also a good place to put coloring.

Parameters
  • text (str) – The text to process.

  • speaker (Object) – The object delivering the text.

  • language (str) – An identifier string for the language.

Returns

text (str) – The optionally processed text.

Notes

This is designed to work together with a string obfuscator such as the obfuscate_language or obfuscate_whisper in the evennia.contrib.rpg.rplanguage module.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultCharacter.DoesNotExist, evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultCharacter.MultipleObjectsReturned, evennia.contrib.rpg.rpsystem.rpsystem.ContribRPObject.MultipleObjectsReturned

path = 'evennia.contrib.rpg.rpsystem.rpsystem.ContribRPCharacter'
typename = 'ContribRPCharacter'