evennia.contrib.tutorial_world.rooms

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.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.

key = 'tutorial'
aliases = ['tut']
locks = 'cmd:all()'
help_category = 'tutorialworld'
func()[source]

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

lock_storage = 'cmd:all()'
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.

key = '@detail'
locks = 'cmd:perm(Builder)'
help_category = 'tutorialworld'
func()[source]

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

aliases = []
lock_storage = 'cmd:perm(Builder)'
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.

help_category = 'tutorialworld'
func()[source]

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

aliases = ['ls', 'l']
key = 'look'
lock_storage = 'cmd:all()'
class evennia.contrib.tutorial_world.rooms.CmdTutorialGiveUp(**kwargs)[source]

Bases: evennia.commands.default.muxcommand.MuxCommand

Give up the tutorial-world quest and return to Limbo, the start room of the server.

key = 'give up'
aliases = ['abort']
func()[source]

This is the hook function that actually does all the work. It is called by the cmdhandler right after self.parser() finishes, and so has access to all the variables defined therein.

help_category = 'general'
lock_storage = 'cmd:all();'
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)

key = 'tutorial_cmdset'
priority = 1
at_cmdset_creation()[source]

add the tutorial-room commands

path = 'evennia.contrib.tutorial_world.rooms.TutorialRoomCmdSet'
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.

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.

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.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultRoom.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultRoom.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_world.rooms.TutorialRoom'
typename = 'TutorialRoom'
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.

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.

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)

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_world.rooms.WeatherRoom'
typename = 'WeatherRoom'
class evennia.contrib.tutorial_world.rooms.CmdEvenniaIntro(**kwargs)[source]

Bases: evennia.commands.command.Command

Start the Evennia intro wizard.

Usage:

intro

key = 'intro'
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())

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
class evennia.contrib.tutorial_world.rooms.CmdSetEvenniaIntro(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

key = 'Evennia Intro StartSet'
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.rooms.CmdSetEvenniaIntro'
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)

at_object_creation()[source]

Called when the room is first created.

at_object_receive(character, source_location)[source]

Assign properties on characters

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_world.rooms.IntroRoom'
typename = 'IntroRoom'
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.

key = 'east'
aliases = ['e']
locks = 'cmd:all()'
help_category = 'tutorialworld'
func()[source]

move one step eastwards

lock_storage = 'cmd:all()'
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.

key = 'west'
aliases = ['w']
locks = 'cmd:all()'
help_category = 'tutorialworld'
func()[source]

move one step westwards

lock_storage = 'cmd:all()'
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.

key = 'look'
aliases = ['l']
locks = 'cmd:all()'
help_category = 'tutorialworld'
func()[source]

Looking around, including a chance to fall.

lock_storage = 'cmd:all()'
class evennia.contrib.tutorial_world.rooms.CmdBridgeHelp(**kwargs)[source]

Bases: evennia.commands.command.Command

Overwritten help command while on the bridge.

key = 'help'
aliases = ['h', '?']
locks = 'cmd:all()'
help_category = 'tutorial world'
func()[source]

Implements the command.

lock_storage = 'cmd:all()'
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.

key = 'Bridge commands'
priority = 2
at_cmdset_creation()[source]

Called at first cmdset creation

path = 'evennia.contrib.tutorial_world.rooms.BridgeCmdSet'
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).

at_object_creation()[source]

Setups the room

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

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

at_object_receive(character, source_location)[source]

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

at_object_leave(character, target_location)[source]

This is triggered when the player leaves the bridge room.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.WeatherRoom.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.WeatherRoom.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_world.rooms.BridgeRoom'
typename = 'BridgeRoom'
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.

key = 'look'
aliases = ['search', 'fiddle', 'feel around', 'feel', 'l']
locks = 'cmd:all()'
help_category = 'tutorialworld'
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.

lock_storage = 'cmd:all()'
class evennia.contrib.tutorial_world.rooms.CmdDarkHelp(**kwargs)[source]

Bases: evennia.commands.command.Command

Help command for the dark state.

key = 'help'
locks = 'cmd:all()'
help_category = 'tutorialworld'
func()[source]

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

aliases = []
lock_storage = 'cmd:all()'
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)

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

Implements the command.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all()'
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)

key = 'darkroom_cmdset'
mergetype = 'Replace'
priority = 2
at_cmdset_creation()[source]

populate the cmdset.

path = 'evennia.contrib.tutorial_world.rooms.DarkCmdSet'
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.

at_object_creation()[source]

Called when object is first created.

at_init()[source]

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

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.

at_object_receive(obj, source_location)[source]

Called when an object enters the room.

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.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_world.rooms.DarkRoom'
typename = 'DarkRoom'
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

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.

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_world.rooms.TeleportRoom'
typename = 'TeleportRoom'
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.

at_object_creation()[source]

Called when the room is first created.

at_object_receive(character, source_location)[source]

Do cleanup.

at_object_leave(character, destination)[source]

Called just before an object leaves from inside this object

Parameters
  • moved_obj (Object) – The object leaving

  • target_location (Object) – Where moved_obj is going.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

exception DoesNotExist

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_world.rooms.OutroRoom'
typename = 'OutroRoom'