evennia.scripts.scripts¶
This module defines Scripts, out-of-character entities that can store data both on themselves and on other objects while also having the ability to run timers.
-
class
evennia.scripts.scripts.
DefaultScript
(*args, **kwargs)[source]¶ Bases:
evennia.scripts.scripts.ScriptBase
This is the base TypeClass for all Scripts. Scripts describe events, timers and states in game, they can have a time component or describe a state that changes under certain conditions.
-
classmethod
create
(key, **kwargs)[source]¶ Provides a passthrough interface to the utils.create_script() function.
- Parameters
key (str) – Name of the new object.
- Returns
object (Object) – A newly created object of the given typeclass. errors (list): A list of errors in string form, if any.
-
is_valid
()[source]¶ Is called to check if the script’s timer is valid to run at this time. Should return a boolean. If False, the timer will be stopped.
-
at_start
(**kwargs)[source]¶ Called whenever the script timer is started, which for persistent timed scripts is at least once every server start. It will also be called when starting again after a pause (including after a server reload).
- Parameters
**kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).
-
at_repeat
(**kwargs)[source]¶ Called repeatedly if this Script is set to repeat regularly.
- Parameters
**kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).
-
at_pause
(manual_pause=True, **kwargs)[source]¶ Called when this script’s timer pauses.
- Parameters
manual_pause (bool) – If set, pausing was done by a direct call. The non-manual pause indicates the script was paused as part of the server reload.
-
at_stop
(**kwargs)[source]¶ Called whenever when it’s time for this script’s timer to stop (either because is_valid returned False, it ran out of iterations or it was manuallys stopped.
- Parameters
**kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).
-
at_script_delete
()[source]¶ Called when the Script is deleted, before stopping the timer.
- Returns
bool – If False, the deletion is aborted.
-
at_server_reload
()[source]¶ This hook is called whenever the server is shutting down for restart/reboot. If you want to, for example, save non-persistent properties across a restart, this is the place to do it.
-
at_server_shutdown
()[source]¶ This hook is called whenever the server is shutting down fully (i.e. not for a restart).
-
at_server_start
()[source]¶ This hook is called after the server has started. It can be used to add post-startup setup for Scripts without a timer component (for which at_start could be used).
-
exception
DoesNotExist
¶ Bases:
evennia.scripts.scripts.ScriptBase.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.scripts.scripts.ScriptBase.MultipleObjectsReturned
-
path
= 'evennia.scripts.scripts.DefaultScript'¶
-
typename
= 'DefaultScript'¶
-
classmethod
-
class
evennia.scripts.scripts.
DoNothing
(*args, **kwargs)[source]¶ Bases:
evennia.scripts.scripts.DefaultScript
A script that does nothing. Used as default fallback.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned
-
path
= 'evennia.scripts.scripts.DoNothing'¶
-
typename
= 'DoNothing'¶
-
exception
-
class
evennia.scripts.scripts.
Store
(*args, **kwargs)[source]¶ Bases:
evennia.scripts.scripts.DefaultScript
Simple storage script
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned
-
path
= 'evennia.scripts.scripts.Store'¶
-
typename
= 'Store'¶
-
exception