evennia.contrib.full_systems.evscaperoom.utils¶
Helper functions and classes for the evscaperoom contrib.
Most of these are available directly from wrappers in state/object/room classes and does not need to be imported from here.
-
evennia.contrib.full_systems.evscaperoom.utils.
create_evscaperoom_object
(typeclass=None, key='testobj', location=None, delete_duplicates=True, **kwargs)[source]¶ This is a convenience-wrapper for quickly building EvscapeRoom objects. This is called from the helper-method create_object on states, but is also useful for the object-create admin command.
Note that for the purpose of the Evscaperoom, we only allow one instance of each name, deleting the old version if it already exists.
- Keyword Arguments
typeclass (str) – This can take just the class-name in the evscaperoom’s objects.py module. Otherwise, a full path is needed.
key (str) – Name of object.
location (Object) – The location to create new object.
delete_duplicates (bool) – Delete old object with same key.
kwargs (any) – Will be passed into create_object.
- Returns
new_obj (Object) – The newly created object, if any.
-
evennia.contrib.full_systems.evscaperoom.utils.
create_fantasy_word
(length=5, capitalize=True)[source]¶ Create a random semi-pronouncable ‘word’.
- Keyword Arguments
length (int) – The desired length of the ‘word’.
capitalize (bool) – If the return should be capitalized or not
- Returns
word (str) – The fictous word of given length.
-
evennia.contrib.full_systems.evscaperoom.utils.
parse_for_perspectives
(string, you=None)[source]¶ Parse a string with special markers to produce versions both intended for the person doing the action (‘you’) and for those seeing the person doing that action. Also marks ‘things’ according to style. See example below.
- Parameters
string (str) – String on 2nd person form with ~ markers (‘~you ~open …’)
you (str) – What others should see instead of you (Bob opens)
- Returns
second, third_person (tuple) –
- Strings replace to be shown in 2nd and 3rd person
perspective
Example
“~You ~open” -> “You open”, “Bob opens”
-
evennia.contrib.full_systems.evscaperoom.utils.
parse_for_things
(string, things_style=2, clr='|y')[source]¶ Parse string for special *thing markers and decorate it.
- Parameters
string (str) – The string to parse.
things_style (int) – The style to handle *things marked: 0 - no marking (remove *) 1 - mark with color 2 - mark with color and [] (default)
clr (str) – Which color to use for marker..
Example
You open *door -> You open [door].
-
evennia.contrib.full_systems.evscaperoom.utils.
add_msg_borders
(text)[source]¶ Add borders above/below text block
-
evennia.contrib.full_systems.evscaperoom.utils.
msg_cinematic
(text, borders=True)[source]¶ Display a text as a ‘cinematic’ - centered and surrounded by borders.
- Parameters
text (str) – Text to format.
borders (bool, optional) – Put borders above and below text.
- Returns
text (str) – Pretty-formatted text.