evennia.scripts.manager

The custom manager for Scripts.

class evennia.scripts.manager.ScriptManager(*args, **kwargs)[source]

Bases: evennia.scripts.manager.ScriptDBManager, evennia.typeclasses.managers.TypeclassManager

class evennia.scripts.manager.ScriptDBManager(*args, **kwargs)[source]

Bases: evennia.typeclasses.managers.TypedObjectManager

This Scriptmanager implements methods for searching and manipulating Scripts directly from the database.

Evennia-specific search methods (will return Typeclasses or lists of Typeclasses, whereas Django-general methods will return Querysets or database objects).

dbref (converter) get_id (or dbref_search) get_dbref_range object_totals typeclass_search get_all_scripts_on_obj get_all_scripts delete_script remove_non_persistent validate script_search (equivalent to evennia.search_script) copy_script

get_all_scripts_on_obj(obj, key=None)[source]

Find all Scripts related to a particular object.

Parameters
  • obj (Object) – Object whose Scripts we are looking for.

  • key (str, optional) – Script identifier - can be given as a dbref or name string. If given, only scripts matching the key on the object will be returned.

Returns

matches (list) – Matching scripts.

get_all_scripts(key=None)[source]

Get all scripts in the database.

Parameters

key (str or int, optional) – Restrict result to only those with matching key or dbref.

Returns

scripts (list) – All scripts found, or those matching key.

delete_script(dbref)[source]

This stops and deletes a specific script directly from the script database.

Parameters

dbref (int) – Database unique id.

Notes

This might be needed for global scripts not tied to a specific game object

update_scripts_after_server_start()[source]

Update/sync/restart/delete scripts after server shutdown/restart.

search_script(ostring, obj=None, only_timed=False, typeclass=None)[source]

Search for a particular script.

Parameters
  • ostring (str) – Search criterion - a script dbef or key.

  • obj (Object, optional) – Limit search to scripts defined on this object

  • only_timed (bool) – Limit search only to scripts that run on a timer.

  • typeclass (class or str) – Typeclass or path to typeclass.

Search for a particular script.

Parameters
  • ostring (str) – Search criterion - a script dbef or key.

  • obj (Object, optional) – Limit search to scripts defined on this object

  • only_timed (bool) – Limit search only to scripts that run on a timer.

  • typeclass (class or str) – Typeclass or path to typeclass.

copy_script(original_script, new_key=None, new_obj=None, new_locks=None)[source]

Make an identical copy of the original_script.

Parameters
  • original_script (Script) – The Script to copy.

  • new_key (str, optional) – Rename the copy.

  • new_obj (Object, optional) – Place copy on different Object.

  • new_locks (str, optional) – Give copy different locks from the original.

Returns

script_copy (Script)

A new Script instance, copied from

the original.