This is a more advanced example object. It combines functions from script.examples as well as commands.examples to make an interactive button typeclass.

Create this button with

@create/drop examples.red_button.RedButton

Note that you must drop the button before you can see its messages!

class evennia.contrib.tutorial_examples.red_button.RedButton(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultObject

This class describes an evil red button. It will use the script definition in contrib/examples/red_button_scripts to blink at regular intervals. It also uses a series of script and commands to handle pushing the button and causing effects when doing so.

The following attributes can be set on the button:

desc_lid_open - description when lid is open desc_lid_closed - description when lid is closed desc_lamp_broken - description when lamp is broken


This function is called when object is created. Use this instead of e.g. __init__.


Opens the glass lid and start the timer so it will soon close again.


Close the glass lid. This validates all scripts on the button, which means that scripts only being valid when the lid is open will go away automatically.


Breaks the lamp in the button, stopping it from blinking.


feedback (bool) – Show a message about breaking the lamp.


Someone was foolish enough to press the button!


pobject (Object) – The person pressing the button

The script system will regularly call this function to make the button blink. Now and then it won’t blink at all though, to add some randomness to how often the message is echoed.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultObject.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultObject.MultipleObjectsReturned

path = 'evennia.contrib.tutorial_examples.red_button.RedButton'
typename = 'RedButton'