evennia.contrib.tutorial_world package

This package holds the demo game of Evennia.

Submodules

evennia.contrib.tutorial_world.mob module

This module implements a simple mobile object with a very rudimentary AI as well as an aggressive enemy object based on that mobile class.

class evennia.contrib.tutorial_world.mob.CmdMobOnOff(**kwargs)[source]

Bases: evennia.commands.command.Command

Activates/deactivates Mob

Usage:

mobon <mob> moboff <mob>

This turns the mob from active (alive) mode to inactive (dead) mode. It is used during building to activate the mob once it’s prepared.

_keyaliases = ('mobon', 'moboff')
_matchset = {'moboff', 'mobon'}
aliases = ['moboff']
func()[source]

Uses the mob’s set_alive/set_dead methods to turn on/off the mob.”

help_category = 'general'
key = 'mobon'
lock_storage = 'cmd:superuser()'
locks = 'cmd:superuser()'
search_index_entry = {'aliases': 'moboff', 'category': 'general', 'key': 'mobon', 'tags': '', 'text': "\n Activates/deactivates Mob\n\n Usage:\n mobon <mob>\n moboff <mob>\n\n This turns the mob from active (alive) mode\n to inactive (dead) mode. It is used during\n building to activate the mob once it's\n prepared.\n "}
class evennia.contrib.tutorial_world.mob.Mob(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject

This is a state-machine AI mobile. It has several states which are controlled from setting various Attributes. All default to True:

patrolling: if set, the mob will move randomly

from room to room, but preferring to not return the way it came. If unset, the mob will remain stationary (idling) until attacked.

aggressive: if set, will attack Characters in

the same room using whatever Weapon it carries (see tutorial_world.objects.TutorialWeapon). if unset, the mob will never engage in combat no matter what.

hunting: if set, the mob will pursue enemies trying

to flee from it, so it can enter combat. If unset, it will return to patrolling/idling if fled from.

immortal: If set, the mob cannot take any damage. irregular_echoes: list of strings the mob generates at irregular intervals. desc_alive: the physical description while alive desc_dead: the physical descripion while dead send_defeated_to: unique key/alias for location to send defeated enemies to defeat_msg: message to echo to defeated opponent defeat_msg_room: message to echo to room. Accepts %s as the name of the defeated. hit_msg: message to echo when this mob is hit. Accepts %s for the mob’s key. weapon_ineffective_msg: message to echo for useless attacks death_msg: message to echo to room when this mob dies. patrolling_pace: how many seconds per tick, when patrolling aggressive_pace: -“- attacking hunting_pace: -“- hunting death_pace: -“- returning to life when dead

field ‘home’ - the home location should set to someplace inside

the patrolling area. The mob will use this if it should happen to roam into a room with no exits.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned

_find_target(location)[source]

Scan the given location for suitable targets (this is defined as Characters) to attack. Will ignore superusers.

Parameters

location (Object) – the room to scan.

Returns

The first suitable target found.

_meta = <Options for Mob>
_set_ticker(interval, hook_key, stop=False)[source]

Set how often the given hook key should be “ticked”.

Parameters
  • interval (int or None) – The number of seconds between ticks

  • hook_key (str or None) – The name of the method (on this mob) to call every interval seconds.

  • stop (bool, optional) – Just stop the last ticker without starting a new one. With this set, the interval and hook_key arguments are unused.

In order to only have one ticker running at a time, we make sure to store the previous ticker subscription so that we can easily find and stop it before setting a new one. The tickerhandler is persistent so we need to remember this across reloads.

at_hit(weapon, attacker, damage)[source]

Someone landed a hit on us. Check our status and start attacking if not already doing so.

at_init()[source]

When initialized from cache (after a server reboot), set up the AI state.

at_new_arrival(new_character)[source]

This is triggered whenever a new character enters the room. This is called by the TutorialRoom the mob stands in and allows it to be aware of changes immediately without needing to poll for them all the time. For example, the mob can react right away, also when patrolling on a very slow ticker.

at_object_creation()[source]

Called the first time the object is created. We set up the base properties and flags here.

do_attack(*args, **kwargs)[source]

Called regularly when in attacking mode. In attacking mode the mob will bring its weapons to bear on any targets in the room.

do_hunting(*args, **kwargs)[source]

Called regularly when in hunting mode. In hunting mode the mob scans adjacent rooms for enemies and moves towards them to attack if possible.

do_patrol(*args, **kwargs)[source]

Called repeatedly during patrolling mode. In this mode, the mob scans its surroundings and randomly chooses a viable exit. One should lock exits with the traverse:has_account() lock in order to block the mob from moving outside its area while allowing account-controlled characters to move normally.

path = 'evennia.contrib.tutorial_world.mob.Mob'
set_alive(*args, **kwargs)[source]

Set the mob to “alive” mode. This effectively resurrects it from the dead state.

set_dead()[source]

Set the mob to “dead” mode. This turns it off and makes sure it can take no more damage. It also starts a ticker for when it will return.

start_attacking()[source]

Start the attacking state

start_hunting()[source]

Start the hunting state

start_idle()[source]

Starts just standing around. This will kill the ticker and do nothing more.

start_patrolling()[source]

Start the patrolling state by registering us with the ticker-handler at a leasurely pace.

typename = 'Mob'
class evennia.contrib.tutorial_world.mob.MobCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Holds the admin command controlling the mob

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.tutorial_world.mob.MobCmdSet'

evennia.contrib.tutorial_world.objects module

TutorialWorld - basic objects - Griatch 2011

This module holds all “dead” object definitions for the tutorial world. Object-commands and -cmdsets are also defined here, together with the object.

Objects:

TutorialObject

TutorialReadable TutorialClimbable Obelisk LightSource CrumblingWall TutorialWeapon TutorialWeaponRack

class evennia.contrib.tutorial_world.objects.CmdAttack(**kwargs)[source]

Bases: evennia.commands.command.Command

Attack the enemy. Commands:

stab <enemy> slash <enemy> parry

stab - (thrust) makes a lot of damage but is harder to hit with. slash - is easier to land, but does not make as much damage. parry - forgoes your attack but will make you harder to hit on next

enemy attack.

_keyaliases = ('stab', 'slash', 'defend', 'attack', 'pierce', 'parry', 'hit', 'chop', 'thrust', 'fight', 'kill')
_matchset = {'attack', 'chop', 'defend', 'fight', 'hit', 'kill', 'parry', 'pierce', 'slash', 'stab', 'thrust'}
aliases = ['stab', 'slash', 'defend', 'pierce', 'parry', 'hit', 'chop', 'thrust', 'fight', 'kill']
func()[source]

Implements the stab

help_category = 'tutorialworld'
key = 'attack'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': 'stab slash defend pierce parry hit chop thrust fight kill', 'category': 'tutorialworld', 'key': 'attack', 'tags': '', 'text': '\n Attack the enemy. Commands:\n\n stab <enemy>\n slash <enemy>\n parry\n\n stab - (thrust) makes a lot of damage but is harder to hit with.\n slash - is easier to land, but does not make as much damage.\n parry - forgoes your attack but will make you harder to hit on next\n enemy attack.\n\n '}
class evennia.contrib.tutorial_world.objects.CmdClimb(**kwargs)[source]

Bases: evennia.commands.command.Command

Climb an object

Usage:

climb <object>

This allows you to climb.

_keyaliases = ('climb',)
_matchset = {'climb'}
aliases = []
func()[source]

Implements function

help_category = 'tutorialworld'
key = 'climb'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'climb', 'tags': '', 'text': '\n Climb an object\n\n Usage:\n climb <object>\n\n This allows you to climb.\n '}
class evennia.contrib.tutorial_world.objects.CmdGetWeapon(**kwargs)[source]

Bases: evennia.commands.command.Command

Usage:

get weapon

This will try to obtain a weapon from the container.

_keyaliases = ('get weapon',)
_matchset = {'get weapon'}
aliases = []
func()[source]

Get a weapon from the container. It will itself handle all messages.

help_category = 'tutorialworld'
key = 'get weapon'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'get weapon', 'tags': '', 'text': '\n Usage:\n get weapon\n\n This will try to obtain a weapon from the container.\n '}
class evennia.contrib.tutorial_world.objects.CmdLight(**kwargs)[source]

Bases: evennia.commands.command.Command

Creates light where there was none. Something to burn.

_keyaliases = ('on', 'burn', 'light')
_matchset = {'burn', 'light', 'on'}
aliases = ['burn', 'light']
func()[source]

Implements the light command. Since this command is designed to sit on a “lightable” object, we operate only on self.obj.

help_category = 'tutorialworld'
key = 'on'
lock_storage = 'cmd:holds()'
locks = 'cmd:holds()'
search_index_entry = {'aliases': 'burn light', 'category': 'tutorialworld', 'key': 'on', 'tags': '', 'text': '\n Creates light where there was none. Something to burn.\n '}
class evennia.contrib.tutorial_world.objects.CmdPressButton(**kwargs)[source]

Bases: evennia.commands.command.Command

Presses a button.

_keyaliases = ('button', 'press', 'press button', 'push button')
_matchset = {'button', 'press', 'press button', 'push button'}
aliases = ['button', 'press button', 'push button']
func()[source]

Implements the command

help_category = 'tutorialworld'
key = 'press'
lock_storage = 'cmd:objattr(button_exposed) and objlocattr(is_lit)'
locks = 'cmd:objattr(button_exposed) and objlocattr(is_lit)'
search_index_entry = {'aliases': 'button press button push button', 'category': 'tutorialworld', 'key': 'press', 'tags': '', 'text': '\n Presses a button.\n '}
class evennia.contrib.tutorial_world.objects.CmdRead(**kwargs)[source]

Bases: evennia.commands.command.Command

Usage:

read [obj]

Read some text of a readable object.

_keyaliases = ('read',)
_matchset = {'read'}
aliases = []
func()[source]

Implements the read command. This simply looks for an Attribute “readable_text” on the object and displays that.

help_category = 'tutorialworld'
key = 'read'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'read', 'tags': '', 'text': '\n Usage:\n read [obj]\n\n Read some text of a readable object.\n '}
class evennia.contrib.tutorial_world.objects.CmdSetClimbable(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Climbing cmdset

at_cmdset_creation()[source]

populate set

path = 'evennia.contrib.tutorial_world.objects.CmdSetClimbable'
class evennia.contrib.tutorial_world.objects.CmdSetCrumblingWall(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Group the commands for crumblingWall

at_cmdset_creation()[source]

called when object is first created.

key = 'crumblingwall_cmdset'
path = 'evennia.contrib.tutorial_world.objects.CmdSetCrumblingWall'
priority = 2
class evennia.contrib.tutorial_world.objects.CmdSetLight(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

CmdSet for the lightsource commands

at_cmdset_creation()[source]

called at cmdset creation

key = 'lightsource_cmdset'
path = 'evennia.contrib.tutorial_world.objects.CmdSetLight'
priority = 3
class evennia.contrib.tutorial_world.objects.CmdSetReadable(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

A CmdSet for readables.

at_cmdset_creation()[source]

Called when the cmdset is created.

path = 'evennia.contrib.tutorial_world.objects.CmdSetReadable'
class evennia.contrib.tutorial_world.objects.CmdSetWeapon(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Holds the attack command.

at_cmdset_creation()[source]

called at first object creation.

path = 'evennia.contrib.tutorial_world.objects.CmdSetWeapon'
class evennia.contrib.tutorial_world.objects.CmdSetWeaponRack(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

The cmdset for the rack.

at_cmdset_creation()[source]

Called at first creation of cmdset

key = 'weaponrack_cmdset'
path = 'evennia.contrib.tutorial_world.objects.CmdSetWeaponRack'
class evennia.contrib.tutorial_world.objects.CmdShiftRoot(**kwargs)[source]

Bases: evennia.commands.command.Command

Shifts roots around.

Usage:

shift blue root left/right shift red root left/right shift yellow root up/down shift green root up/down

_keyaliases = ('move', 'shiftroot', 'pull', 'shift', 'push')
_matchset = {'move', 'pull', 'push', 'shift', 'shiftroot'}
aliases = ['move', 'push', 'shiftroot', 'pull']
func()[source]
Implement the command.

blue/red - vertical roots yellow/green - horizontal roots

help_category = 'tutorialworld'
key = 'shift'
lock_storage = 'cmd:locattr(is_lit)'
locks = 'cmd:locattr(is_lit)'
parse()[source]

Custom parser; split input by spaces for simplicity.

search_index_entry = {'aliases': 'move push shiftroot pull', 'category': 'tutorialworld', 'key': 'shift', 'tags': '', 'text': '\n Shifts roots around.\n\n Usage:\n shift blue root left/right\n shift red root left/right\n shift yellow root up/down\n shift green root up/down\n\n '}
class evennia.contrib.tutorial_world.objects.CrumblingWall(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject, evennia.objects.objects.DefaultExit

This is a custom Exit.

The CrumblingWall can be examined in various ways, but only if a lit light source is in the room. The traversal itself is blocked by a traverse: lock on the exit that only allows passage if a certain attribute is set on the trying account.

Important attribute
destination - this property must be set to make this a valid exit

whenever the button is pushed (this hides it as an exit until it actually is)

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist, evennia.objects.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned, evennia.objects.objects.MultipleObjectsReturned

_meta = <Options for CrumblingWall>
_translate_position(root, ipos)[source]

Translates the position into words

at_after_traverse(traverser, source_location)[source]

This is called after we traversed this exit. Cleans up and resets the puzzle.

at_failed_traverse(traverser)[source]

This is called if the account fails to pass the Exit.

at_init()[source]

Called when object is recalled from cache.

at_object_creation()[source]

called when the object is first created.

open_wall()[source]

This method is called by the push button command once the puzzle is solved. It opens the wall and sets a timer for it to reset itself.

path = 'evennia.contrib.tutorial_world.objects.CrumblingWall'
reset()[source]

Called by tutorial world runner, or whenever someone successfully traversed the Exit.

return_appearance(caller)[source]

This is called when someone looks at the wall. We need to echo the current root positions.

typename = 'CrumblingWall'
class evennia.contrib.tutorial_world.objects.LightSource(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject

This implements a light source object.

When burned out, the object will be deleted.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned

_burnout()[source]

This is called when this light source burns out. We make no use of the return value.

_meta = <Options for LightSource>
at_init()[source]

If this is called with the Attribute is_giving_light already set, we know that the timer got killed by a server reload/reboot before it had time to finish. So we kill it here instead. This is the price we pay for the simplicity of the non-persistent delay() method.

at_object_creation()[source]

Called when object is first created.

light()[source]

Light this object - this is called by Light command.

path = 'evennia.contrib.tutorial_world.objects.LightSource'
typename = 'LightSource'
class evennia.contrib.tutorial_world.objects.Obelisk(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject

This object changes its description randomly, and which is shown determines which order “clue id” is stored on the Character for future puzzles.

Important Attribute:
puzzle_descs (list): list of descriptions. One of these is

picked randomly when this object is looked at and its index in the list is used as a key for to solve the puzzle.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned

_meta = <Options for Obelisk>
at_object_creation()[source]

Called when object is created.

path = 'evennia.contrib.tutorial_world.objects.Obelisk'
return_appearance(caller)[source]

This hook is called by the look command to get the description of the object. We overload it with our own version.

typename = 'Obelisk'
class evennia.contrib.tutorial_world.objects.TutorialClimbable(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject

A climbable object. All that is special about it is that it has the “climb” command available on it.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned

_meta = <Options for TutorialClimbable>
at_object_creation()[source]

Called at initial creation only

path = 'evennia.contrib.tutorial_world.objects.TutorialClimbable'
typename = 'TutorialClimbable'
class evennia.contrib.tutorial_world.objects.TutorialObject(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultObject

This is the baseclass for all objects in the tutorial.

exception DoesNotExist

Bases: evennia.objects.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.MultipleObjectsReturned

_meta = <Options for TutorialObject>
at_object_creation()[source]

Called when the object is first created.

path = 'evennia.contrib.tutorial_world.objects.TutorialObject'
reset()[source]

Resets the object, whatever that may mean.

typename = 'TutorialObject'
class evennia.contrib.tutorial_world.objects.TutorialReadable(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject

This simple object defines some attributes and

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned

_meta = <Options for TutorialReadable>
at_object_creation()[source]

Called when object is created. We make sure to set the needed Attribute and add the readable cmdset.

path = 'evennia.contrib.tutorial_world.objects.TutorialReadable'
typename = 'TutorialReadable'
class evennia.contrib.tutorial_world.objects.TutorialWeapon(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject

This defines a bladed weapon.

Important attributes (set at creation):

hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and

type of attack) (0-10)

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned

_meta = <Options for TutorialWeapon>
at_object_creation()[source]

Called at first creation of the object

path = 'evennia.contrib.tutorial_world.objects.TutorialWeapon'
reset()[source]

When reset, the weapon is simply deleted, unless it has a place to return to.

typename = 'TutorialWeapon'
class evennia.contrib.tutorial_world.objects.TutorialWeaponRack(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.objects.TutorialObject

This object represents a weapon store. When people use the “get weapon” command on this rack, it will produce one random weapon from among those registered to exist on it. This will also set a property on the character to make sure they can’t get more than one at a time.

Attributes to set on this object:
available_weapons: list of prototype-keys from

WEAPON_PROTOTYPES, the weapons available in this rack.

no_more_weapons_msg - error message to return to accounts

who already got one weapon from the rack and tries to grab another one.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.objects.MultipleObjectsReturned

_meta = <Options for TutorialWeaponRack>
at_object_creation()[source]

called at creation

path = 'evennia.contrib.tutorial_world.objects.TutorialWeaponRack'
produce_weapon(caller)[source]

This will produce a new weapon from the rack, assuming the caller hasn’t already gotten one. When doing so, the caller will get Tagged with the id of this rack, to make sure they cannot keep pulling weapons from it indefinitely.

typename = 'TutorialWeaponRack'

evennia.contrib.tutorial_world.rooms module

Room Typeclasses for the TutorialWorld.

This defines special types of Rooms available in the tutorial. To keep everything in one place we define them together with the custom commands needed to control them. Those commands could also have been in a separate module (e.g. if they could have been re-used elsewhere.)

class evennia.contrib.tutorial_world.rooms.BridgeCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

This groups the bridge commands. We will store it on the room.

at_cmdset_creation()[source]

Called at first cmdset creation

key = 'Bridge commands'
path = 'evennia.contrib.tutorial_world.rooms.BridgeCmdSet'
priority = 1
class evennia.contrib.tutorial_world.rooms.BridgeRoom(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.rooms.WeatherRoom

The bridge room implements an unsafe bridge. It also enters the player into a state where they get new commands so as to try to cross the bridge.

We want this to result in the account getting a special set of commands related to crossing the bridge. The result is that it will take several steps to cross it, despite it being represented by only a single room.

We divide the bridge into steps:

self.db.west_exit - - | - - self.db.east_exit

0 1 2 3 4

The position is handled by a variable stored on the character when entering and giving special move commands will increase/decrease the counter until the bridge is crossed.

We also has self.db.fall_exit, which points to a gathering location to end up if we happen to fall off the bridge (used by the CmdLookBridge command).

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.MultipleObjectsReturned

_meta = <Options for BridgeRoom>
at_object_creation()[source]

Setups the room

at_object_leave(character, target_location)[source]

This is triggered when the player leaves the bridge room.

at_object_receive(character, source_location)[source]

This hook is called by the engine whenever the player is moved into this room.

path = 'evennia.contrib.tutorial_world.rooms.BridgeRoom'
typename = 'BridgeRoom'
update_weather(*args, **kwargs)[source]

This is called at irregular intervals and makes the passage over the bridge a little more interesting.

class evennia.contrib.tutorial_world.rooms.CmdBridgeHelp(**kwargs)[source]

Bases: evennia.commands.command.Command

Overwritten help command while on the bridge.

_keyaliases = ('help', 'h', '?')
_matchset = {'?', 'h', 'help'}
aliases = ['h', '?']
func()[source]

Implements the command.

help_category = 'tutorial world'
key = 'help'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': 'h ?', 'category': 'tutorial world', 'key': 'help', 'tags': '', 'text': '\n Overwritten help command while on the bridge.\n '}
class evennia.contrib.tutorial_world.rooms.CmdDarkHelp(**kwargs)[source]

Bases: evennia.commands.command.Command

Help command for the dark state.

_keyaliases = ('help',)
_matchset = {'help'}
aliases = []
func()[source]

Replace the the help command with a not-so-useful help

help_category = 'tutorialworld'
key = 'help'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'help', 'tags': '', 'text': '\n Help command for the dark state.\n '}
class evennia.contrib.tutorial_world.rooms.CmdDarkNoMatch(**kwargs)[source]

Bases: evennia.commands.command.Command

This is a system command. Commands with special keys are used to override special sitations in the game. The CMD_NOMATCH is used when the given command is not found in the current command set (it replaces Evennia’s default behavior or offering command suggestions)

_keyaliases = ('__nomatch_command',)
_matchset = {'__nomatch_command'}
aliases = []
func()[source]

Implements the command.

help_category = 'general'
key = '__nomatch_command'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': '', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': "\n This is a system command. Commands with special keys are used to\n override special sitations in the game. The CMD_NOMATCH is used\n when the given command is not found in the current command set (it\n replaces Evennia's default behavior or offering command\n suggestions)\n "}
class evennia.contrib.tutorial_world.rooms.CmdEast(**kwargs)[source]

Bases: evennia.commands.command.Command

Go eastwards across the bridge.

Tutorial info:

This command relies on the caller having two Attributes (assigned by the room when entering):

  • east_exit: a unique name or dbref to the room to go to when exiting east.

  • west_exit: a unique name or dbref to the room to go to when exiting west.

The room must also have the following Attributes
  • tutorial_bridge_posistion: the current position on on the bridge, 0 - 4.

_keyaliases = ('e', 'east')
_matchset = {'e', 'east'}
aliases = ['e']
func()[source]

move one step eastwards

help_category = 'tutorialworld'
key = 'east'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': 'e', 'category': 'tutorialworld', 'key': 'east', 'tags': '', 'text': '\n Go eastwards across the bridge.\n\n Tutorial info:\n This command relies on the caller having two Attributes\n (assigned by the room when entering):\n - east_exit: a unique name or dbref to the room to go to\n when exiting east.\n - west_exit: a unique name or dbref to the room to go to\n when exiting west.\n The room must also have the following Attributes\n - tutorial_bridge_posistion: the current position on\n on the bridge, 0 - 4.\n\n '}
class evennia.contrib.tutorial_world.rooms.CmdLookBridge(**kwargs)[source]

Bases: evennia.commands.command.Command

looks around at the bridge.

Tutorial info:

This command assumes that the room has an Attribute “fall_exit”, a unique name or dbref to the place they end upp if they fall off the bridge.

_keyaliases = ('look', 'l')
_matchset = {'l', 'look'}
aliases = ['l']
func()[source]

Looking around, including a chance to fall.

help_category = 'tutorialworld'
key = 'look'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': 'l', 'category': 'tutorialworld', 'key': 'look', 'tags': '', 'text': '\n looks around at the bridge.\n\n Tutorial info:\n This command assumes that the room has an Attribute\n "fall_exit", a unique name or dbref to the place they end upp\n if they fall off the bridge.\n '}
class evennia.contrib.tutorial_world.rooms.CmdLookDark(**kwargs)[source]

Bases: evennia.commands.command.Command

Look around in darkness

Usage:

look

Look around in the darkness, trying to find something.

_keyaliases = ('feel', 'search', 'feel around', 'fiddle', 'l', 'look')
_matchset = {'feel', 'feel around', 'fiddle', 'l', 'look', 'search'}
aliases = ['feel', 'search', 'feel around', 'fiddle', 'l']
func()[source]

Implement the command.

This works both as a look and a search command; there is a random chance of eventually finding a light source.

help_category = 'tutorialworld'
key = 'look'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': 'feel search feel around fiddle l', 'category': 'tutorialworld', 'key': 'look', 'tags': '', 'text': '\n Look around in darkness\n\n Usage:\n look\n\n Look around in the darkness, trying\n to find something.\n '}
class evennia.contrib.tutorial_world.rooms.CmdTutorial(**kwargs)[source]

Bases: evennia.commands.command.Command

Get help during the tutorial

Usage:

tutorial [obj]

This command allows you to get behind-the-scenes info about an object or the current location.

_keyaliases = ('tut', 'tutorial')
_matchset = {'tut', 'tutorial'}
aliases = ['tut']
func()[source]

All we do is to scan the current location for an Attribute called tutorial_info and display that.

help_category = 'tutorialworld'
key = 'tutorial'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': 'tut', 'category': 'tutorialworld', 'key': 'tutorial', 'tags': '', 'text': '\n Get help during the tutorial\n\n Usage:\n tutorial [obj]\n\n This command allows you to get behind-the-scenes info\n about an object or the current location.\n\n '}
class evennia.contrib.tutorial_world.rooms.CmdTutorialLook(**kwargs)[source]

Bases: evennia.commands.default.general.CmdLook

looks at the room and on details

Usage:

look <obj> look <room detail> look *<account>

Observes your location, details at your location or objects in your vicinity.

Tutorial: This is a child of the default Look command, that also allows us to look at “details” in the room. These details are things to examine and offers some extra description without actually having to be actual database objects. It uses the return_detail() hook on TutorialRooms for this.

_keyaliases = ('look', 'l', 'ls')
_matchset = {'l', 'look', 'ls'}
aliases = ['l', 'ls']
func()[source]

Handle the looking. This is a copy of the default look code except for adding in the details.

help_category = 'tutorialworld'
key = 'look'
lock_storage = 'cmd:all()'
search_index_entry = {'aliases': 'l ls', 'category': 'tutorialworld', 'key': 'look', 'tags': '', 'text': '\n looks at the room and on details\n\n Usage:\n look <obj>\n look <room detail>\n look *<account>\n\n Observes your location, details at your location or objects\n in your vicinity.\n\n Tutorial: This is a child of the default Look command, that also\n allows us to look at "details" in the room. These details are\n things to examine and offers some extra description without\n actually having to be actual database objects. It uses the\n return_detail() hook on TutorialRooms for this.\n '}
class evennia.contrib.tutorial_world.rooms.CmdTutorialSetDetail(**kwargs)[source]

Bases: evennia.commands.default.muxcommand.MuxCommand

sets a detail on a room

Usage:

@detail <key> = <description> @detail <key>;<alias>;… = description

Example

@detail walls = The walls are covered in … @detail castle;ruin;tower = The distant ruin …

This sets a “detail” on the object this command is defined on (TutorialRoom for this tutorial). This detail can be accessed with the TutorialRoomLook command sitting on TutorialRoom objects (details are set as a simple dictionary on the room). This is a Builder command.

We custom parse the key for the ;-separator in order to create multiple aliases to the detail all at once.

_keyaliases = ('@detail',)
_matchset = {'@detail'}
aliases = []
func()[source]

All this does is to check if the object has the set_detail method and uses it.

help_category = 'tutorialworld'
key = '@detail'
lock_storage = 'cmd:perm(Builder)'
locks = 'cmd:perm(Builder)'
search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': '@detail', 'tags': '', 'text': '\n sets a detail on a room\n\n Usage:\n @detail <key> = <description>\n @detail <key>;<alias>;... = description\n\n Example:\n @detail walls = The walls are covered in ...\n @detail castle;ruin;tower = The distant ruin ...\n\n This sets a "detail" on the object this command is defined on\n (TutorialRoom for this tutorial). This detail can be accessed with\n the TutorialRoomLook command sitting on TutorialRoom objects (details\n are set as a simple dictionary on the room). This is a Builder command.\n\n We custom parse the key for the ;-separator in order to create\n multiple aliases to the detail all at once.\n '}
class evennia.contrib.tutorial_world.rooms.CmdWest(**kwargs)[source]

Bases: evennia.commands.command.Command

Go westwards across the bridge.

Tutorial info:

This command relies on the caller having two Attributes (assigned by the room when entering):

  • east_exit: a unique name or dbref to the room to go to when exiting east.

  • west_exit: a unique name or dbref to the room to go to when exiting west.

The room must also have the following property:
  • tutorial_bridge_posistion: the current position on on the bridge, 0 - 4.

_keyaliases = ('w', 'west')
_matchset = {'w', 'west'}
aliases = ['w']
func()[source]

move one step westwards

help_category = 'tutorialworld'
key = 'west'
lock_storage = 'cmd:all()'
locks = 'cmd:all()'
search_index_entry = {'aliases': 'w', 'category': 'tutorialworld', 'key': 'west', 'tags': '', 'text': '\n Go westwards across the bridge.\n\n Tutorial info:\n This command relies on the caller having two Attributes\n (assigned by the room when entering):\n - east_exit: a unique name or dbref to the room to go to\n when exiting east.\n - west_exit: a unique name or dbref to the room to go to\n when exiting west.\n The room must also have the following property:\n - tutorial_bridge_posistion: the current position on\n on the bridge, 0 - 4.\n\n '}
class evennia.contrib.tutorial_world.rooms.DarkCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Groups the commands of the dark room together. We also import the default say command here so that players can still talk in the darkness.

We give the cmdset the mergetype “Replace” to make sure it completely replaces whichever command set it is merged onto (usually the default cmdset)

at_cmdset_creation()[source]

populate the cmdset.

key = 'darkroom_cmdset'
mergetype = 'Replace'
path = 'evennia.contrib.tutorial_world.rooms.DarkCmdSet'
priority = 2
class evennia.contrib.tutorial_world.rooms.DarkRoom(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom

A dark room. This tries to start the DarkState script on all objects entering. The script is responsible for making sure it is valid (that is, that there is no light source shining in the room).

The is_lit Attribute is used to define if the room is currently lit or not, so as to properly echo state changes.

Since this room (in the tutorial) is meant as a sort of catch-all, we also make sure to heal characters ending up here, since they may have been beaten up by the ghostly apparition at this point.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.MultipleObjectsReturned

_carries_light(obj)[source]

Checks if the given object carries anything that gives light.

Note that we do NOT look for a specific LightSource typeclass, but for the Attribute is_giving_light - this makes it easy to later add other types of light-giving items. We also accept if there is a light-giving object in the room overall (like if a splinter was dropped in the room)

_heal(character)[source]

Heal a character.

_meta = <Options for DarkRoom>
at_init()[source]

Called when room is first recached (such as after a reload)

at_object_creation()[source]

Called when object is first created.

at_object_leave(obj, target_location)[source]

In case people leave with the light, we make sure to clear the DarkCmdSet if necessary. This also works if they are teleported away.

at_object_receive(obj, source_location)[source]

Called when an object enters the room.

check_light_state(exclude=None)[source]

This method checks if there are any light sources in the room. If there isn’t it makes sure to add the dark cmdset to all characters in the room. It is called whenever characters enter the room and also by the Light sources when they turn on.

Parameters

exclude (Object) – An object to not include in the light check.

path = 'evennia.contrib.tutorial_world.rooms.DarkRoom'
typename = 'DarkRoom'
class evennia.contrib.tutorial_world.rooms.IntroRoom(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom

Intro room

properties to customize:

char_health - integer > 0 (default 20)

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.MultipleObjectsReturned

_meta = <Options for IntroRoom>
at_object_creation()[source]

Called when the room is first created.

at_object_receive(character, source_location)[source]

Assign properties on characters

path = 'evennia.contrib.tutorial_world.rooms.IntroRoom'
typename = 'IntroRoom'
class evennia.contrib.tutorial_world.rooms.OutroRoom(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom

Outro room.

Called when exiting the tutorial, cleans the character of tutorial-related attributes.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.MultipleObjectsReturned

_meta = <Options for OutroRoom>
at_object_creation()[source]

Called when the room is first created.

at_object_receive(character, source_location)[source]

Do cleanup.

path = 'evennia.contrib.tutorial_world.rooms.OutroRoom'
typename = 'OutroRoom'
class evennia.contrib.tutorial_world.rooms.TeleportRoom(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom

Teleporter - puzzle room.

Important attributes (set at creation):

puzzle_key - which attr to look for on character puzzle_value - what char.db.puzzle_key must be set to success_teleport_to - where to teleport in case if success success_teleport_msg - message to echo while teleporting to success failure_teleport_to - where to teleport to in case of failure failure_teleport_msg - message to echo while teleporting to failure

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.MultipleObjectsReturned

_meta = <Options for TeleportRoom>
at_object_creation()[source]

Called at first creation

at_object_receive(character, source_location)[source]

This hook is called by the engine whenever the player is moved into this room.

path = 'evennia.contrib.tutorial_world.rooms.TeleportRoom'
typename = 'TeleportRoom'
class evennia.contrib.tutorial_world.rooms.TutorialRoom(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultRoom

This is the base room type for all rooms in the tutorial world. It defines a cmdset on itself for reading tutorial info about the location.

exception DoesNotExist

Bases: evennia.objects.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.MultipleObjectsReturned

_meta = <Options for TutorialRoom>
at_object_creation()[source]

Called when room is first created

at_object_receive(new_arrival, source_location)[source]

When an object enter a tutorial room we tell other objects in the room about it by trying to call a hook on them. The Mob object uses this to cheaply get notified of enemies without having to constantly scan for them.

Parameters
  • new_arrival (Object) – the object that just entered this room.

  • source_location (Object) – the previous location of new_arrival.

path = 'evennia.contrib.tutorial_world.rooms.TutorialRoom'
return_detail(detailkey)[source]

This looks for an Attribute “obj_details” and possibly returns the value of it.

Parameters

detailkey (str) – The detail being looked at. This is case-insensitive.

set_detail(detailkey, description)[source]

This sets a new detail, using an Attribute “details”.

Parameters
  • detailkey (str) – The detail identifier to add (for aliases you need to add multiple keys to the same description). Case-insensitive.

  • description (str) – The text to return when looking at the given detailkey.

typename = 'TutorialRoom'
class evennia.contrib.tutorial_world.rooms.TutorialRoomCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Implements the simple tutorial cmdset. This will overload the look command in the default CharacterCmdSet since it has a higher priority (ChracterCmdSet has prio 0)

at_cmdset_creation()[source]

add the tutorial-room commands

key = 'tutorial_cmdset'
path = 'evennia.contrib.tutorial_world.rooms.TutorialRoomCmdSet'
priority = 1
class evennia.contrib.tutorial_world.rooms.WeatherRoom(*args, **kwargs)[source]

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom

This should probably better be called a rainy room…

This sets up an outdoor room typeclass. At irregular intervals, the effects of weather will show in the room. Outdoor rooms should inherit from this.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.MultipleObjectsReturned

_meta = <Options for WeatherRoom>
at_object_creation()[source]

Called when object is first created. We set up a ticker to update this room regularly.

Note that we could in principle also use a Script to manage the ticking of the room; the TickerHandler works fine for simple things like this though.

path = 'evennia.contrib.tutorial_world.rooms.WeatherRoom'
typename = 'WeatherRoom'
update_weather(*args, **kwargs)[source]

Called by the tickerhandler at regular intervals. Even so, we only update 20% of the time, picking a random weather message when we do. The tickerhandler requires that this hook accepts any arguments and keyword arguments (hence the *args, **kwargs even though we don’t actually use them in this example)