evennia.contrib.tutorial_examples.red_button¶
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
-
at_object_creation
()[source]¶ This function is called when object is created. Use this instead of e.g. __init__.
-
close_lid
()[source]¶ 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.
-
break_lamp
(feedback=True)[source]¶ Breaks the lamp in the button, stopping it from blinking.
- Parameters
feedback (bool) – Show a message about breaking the lamp.
-
press_button
(pobject)[source]¶ Someone was foolish enough to press the button!
- Parameters
pobject (Object) – The person pressing the button
-
blink
()[source]¶ 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
¶
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.objects.objects.DefaultObject.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorial_examples.red_button.RedButton'¶
-
typename
= 'RedButton'¶