mirror of
https://github.com/evennia/evennia.git
synced 2026-03-17 05:16:31 +01:00
509 lines
No EOL
37 KiB
HTML
509 lines
No EOL
37 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>evennia.contrib.base_systems.ingame_python.scripts — Evennia 3.x documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="evennia.contrib.base_systems.ingame_python.tests" href="evennia.contrib.base_systems.ingame_python.tests.html" />
|
||
<link rel="prev" title="evennia.contrib.base_systems.ingame_python.eventfuncs" href="evennia.contrib.base_systems.ingame_python.eventfuncs.html" />
|
||
</head><body>
|
||
|
||
|
||
<div class="admonition important">
|
||
<p class="first admonition-title">Note</p>
|
||
<p class="last">You are reading an old version of the Evennia documentation. <a href="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
|
||
</div>
|
||
|
||
|
||
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.base_systems.ingame_python.tests.html" title="evennia.contrib.base_systems.ingame_python.tests"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.base_systems.ingame_python.eventfuncs.html" title="evennia.contrib.base_systems.ingame_python.eventfuncs"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 3.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.contrib.html" >evennia.contrib</a> »</li>
|
||
<li class="nav-item nav-item-5"><a href="evennia.contrib.base_systems.html" >evennia.contrib.base_systems</a> »</li>
|
||
<li class="nav-item nav-item-6"><a href="evennia.contrib.base_systems.ingame_python.html" accesskey="U">evennia.contrib.base_systems.ingame_python</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.base_systems.ingame_python.scripts</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
|
||
<div class="documentwrapper">
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="evennia.contrib.base_systems.ingame_python.eventfuncs.html"
|
||
title="previous chapter">evennia.contrib.base_systems.ingame_python.eventfuncs</a></p>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="evennia.contrib.base_systems.ingame_python.tests.html"
|
||
title="next chapter">evennia.contrib.base_systems.ingame_python.tests</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.contrib.base_systems.ingame_python.scripts.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
|
||
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li>
|
||
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
|
||
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
|
||
<a href="https://evennia.blogspot.com/">Blog</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="module-evennia.contrib.base_systems.ingame_python.scripts">
|
||
<span id="evennia-contrib-base-systems-ingame-python-scripts"></span><h1>evennia.contrib.base_systems.ingame_python.scripts<a class="headerlink" href="#module-evennia.contrib.base_systems.ingame_python.scripts" title="Permalink to this headline">¶</a></h1>
|
||
<p>Scripts for the in-game Python system.</p>
|
||
<dl class="py class">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.scripts.</code><code class="sig-name descname">EventHandler</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.scripts.scripts.html#evennia.scripts.scripts.DefaultScript" title="evennia.scripts.scripts.DefaultScript"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript</span></code></a></p>
|
||
<p>The event handler that contains all events in a global script.</p>
|
||
<p>This script shouldn’t be created more than once. It contains
|
||
event (in a non-persistent attribute) and callbacks (in a
|
||
persistent attribute). The script method would help adding,
|
||
editing and deleting these events and callbacks.</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.at_script_creation">
|
||
<code class="sig-name descname">at_script_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.at_script_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.at_script_creation" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Hook called when the script is created.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.at_server_start">
|
||
<code class="sig-name descname">at_server_start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.at_server_start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.at_server_start" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Set up the event system when starting.</p>
|
||
<p>Note that this hook is called every time the server restarts
|
||
(including when it’s reloaded). This hook performs the following
|
||
tasks:</p>
|
||
<ul class="simple">
|
||
<li><p>Create temporarily stored events.</p></li>
|
||
<li><p>Generate locals (individual events’ namespace).</p></li>
|
||
<li><p>Load eventfuncs, including user-defined ones.</p></li>
|
||
<li><p>Re-schedule tasks that aren’t set to fire anymore.</p></li>
|
||
<li><p>Effectively connect the handler to the main script.</p></li>
|
||
</ul>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.get_events">
|
||
<code class="sig-name descname">get_events</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.get_events"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.get_events" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return a dictionary of events on this object.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>obj</strong> (<em>Object</em><em> or </em><em>typeclass</em>) – the connected object or a general typeclass.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A dictionary of the object’s events.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>Events would define what the object can have as
|
||
callbacks. Note, however, that chained callbacks will not
|
||
appear in events and are handled separately.</p>
|
||
<p>You can also request the events of a typeclass, not a
|
||
connected object. This is useful to get the global list
|
||
of events for a typeclass that has no object yet.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.get_variable">
|
||
<code class="sig-name descname">get_variable</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">variable_name</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.get_variable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.get_variable" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return the variable defined in the locals.</p>
|
||
<p>This can be very useful to check the value of a variable that can be modified in an event, and whose value will be used in code. This system allows additional customization.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>variable_name</strong> (<em>str</em>) – the name of the variable to return.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>The variable if found in the locals.
|
||
None if not found in the locals.</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This will return the variable from the current locals.
|
||
Keep in mind that locals are shared between events. As
|
||
every event is called one by one, this doesn’t pose
|
||
additional problems if you get the variable right after
|
||
an event has been executed. If, however, you differ,
|
||
there’s no guarantee the variable will be here or will
|
||
mean the same thing.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.get_callbacks">
|
||
<code class="sig-name descname">get_callbacks</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.get_callbacks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.get_callbacks" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Return a dictionary of the object’s callbacks.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>obj</strong> (<em>Object</em>) – the connected objects.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p>A dictionary of the object’s callbacks.</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method can be useful to override in some contexts,
|
||
when several objects would share callbacks.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.add_callback">
|
||
<code class="sig-name descname">add_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span></em>, <em class="sig-param"><span class="n">callback_name</span></em>, <em class="sig-param"><span class="n">code</span></em>, <em class="sig-param"><span class="n">author</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">valid</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">parameters</span><span class="o">=</span><span class="default_value">''</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.add_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.add_callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add the specified callback.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>obj</strong> (<em>Object</em>) – the Evennia typeclassed object to be extended.</p></li>
|
||
<li><p><strong>callback_name</strong> (<em>str</em>) – the name of the callback to add.</p></li>
|
||
<li><p><strong>code</strong> (<em>str</em>) – the Python code associated with this callback.</p></li>
|
||
<li><p><strong>author</strong> (<em>Character</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) – the author of the callback.</p></li>
|
||
<li><p><strong>valid</strong> (<em>bool</em><em>, </em><em>optional</em>) – should the callback be connected?</p></li>
|
||
<li><p><strong>parameters</strong> (<em>str</em><em>, </em><em>optional</em>) – optional parameters.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method doesn’t check that the callback type exists.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.edit_callback">
|
||
<code class="sig-name descname">edit_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span></em>, <em class="sig-param"><span class="n">callback_name</span></em>, <em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">code</span></em>, <em class="sig-param"><span class="n">author</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">valid</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.edit_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.edit_callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Edit the specified callback.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>obj</strong> (<em>Object</em>) – the Evennia typeclassed object to be edited.</p></li>
|
||
<li><p><strong>callback_name</strong> (<em>str</em>) – the name of the callback to edit.</p></li>
|
||
<li><p><strong>number</strong> (<em>int</em>) – the callback number to be changed.</p></li>
|
||
<li><p><strong>code</strong> (<em>str</em>) – the Python code associated with this callback.</p></li>
|
||
<li><p><strong>author</strong> (<em>Character</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) – the author of the callback.</p></li>
|
||
<li><p><strong>valid</strong> (<em>bool</em><em>, </em><em>optional</em>) – should the callback be connected?</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><strong>RuntimeError if the callback is locked.</strong> – </p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This method doesn’t check that the callback type exists.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.del_callback">
|
||
<code class="sig-name descname">del_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span></em>, <em class="sig-param"><span class="n">callback_name</span></em>, <em class="sig-param"><span class="n">number</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.del_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.del_callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Delete the specified callback.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>obj</strong> (<em>Object</em>) – the typeclassed object containing the callback.</p></li>
|
||
<li><p><strong>callback_name</strong> (<em>str</em>) – the name of the callback to delete.</p></li>
|
||
<li><p><strong>number</strong> (<em>int</em>) – the number of the callback to delete.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Raises</dt>
|
||
<dd class="field-even"><p><strong>RuntimeError if the callback is locked.</strong> – </p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.accept_callback">
|
||
<code class="sig-name descname">accept_callback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span></em>, <em class="sig-param"><span class="n">callback_name</span></em>, <em class="sig-param"><span class="n">number</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.accept_callback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.accept_callback" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Valid a callback.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>obj</strong> (<em>Object</em>) – the object containing the callback.</p></li>
|
||
<li><p><strong>callback_name</strong> (<em>str</em>) – the name of the callback.</p></li>
|
||
<li><p><strong>number</strong> (<em>int</em>) – the number of the callback.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.call">
|
||
<code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">obj</span></em>, <em class="sig-param"><span class="n">callback_name</span></em>, <em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.call" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Call the connected callbacks.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>obj</strong> (<em>Object</em>) – the Evennia typeclassed object.</p></li>
|
||
<li><p><strong>callback_name</strong> (<em>str</em>) – the callback name to call.</p></li>
|
||
<li><p><strong>*args</strong> – additional variables for this callback.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>number</strong> (<em>int</em><em>, </em><em>optional</em>) – call just a specific callback.</p></li>
|
||
<li><p><strong>parameters</strong> (<em>str</em><em>, </em><em>optional</em>) – call a callback with parameters.</p></li>
|
||
<li><p><strong>locals</strong> (<em>dict</em><em>, </em><em>optional</em>) – a locals replacement.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p>True to report the callback was called without interruption,
|
||
False otherwise.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.handle_error">
|
||
<code class="sig-name descname">handle_error</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">callback</span></em>, <em class="sig-param"><span class="n">trace</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.handle_error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.handle_error" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Handle an error in a callback.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>callback</strong> (<em>dict</em>) – the callback representation.</p></li>
|
||
<li><p><strong>trace</strong> (<em>list</em>) – the traceback containing the exception.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>This method can be useful to override to change the default
|
||
handling of errors. By default, the error message is sent to
|
||
the character who last updated the callback, if connected.
|
||
If not, display to the everror channel.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.add_event">
|
||
<code class="sig-name descname">add_event</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">typeclass</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">variables</span></em>, <em class="sig-param"><span class="n">help_text</span></em>, <em class="sig-param"><span class="n">custom_call</span></em>, <em class="sig-param"><span class="n">custom_add</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.add_event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.add_event" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Add a new event for a defined typeclass.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>typeclass</strong> (<em>str</em>) – the path leading to the typeclass.</p></li>
|
||
<li><p><strong>name</strong> (<em>str</em>) – the name of the event to add.</p></li>
|
||
<li><p><strong>variables</strong> (<em>list of str</em>) – list of variable names for this event.</p></li>
|
||
<li><p><strong>help_text</strong> (<em>str</em>) – the long help text of the event.</p></li>
|
||
<li><p><strong>custom_call</strong> (<em>callable</em><em> or </em><em>None</em>) – the function to be called
|
||
when the event fires.</p></li>
|
||
<li><p><strong>custom_add</strong> (<em>callable</em><em> or </em><em>None</em>) – the function to be called when
|
||
a callback is added.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.set_task">
|
||
<code class="sig-name descname">set_task</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">seconds</span></em>, <em class="sig-param"><span class="n">obj</span></em>, <em class="sig-param"><span class="n">callback_name</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#EventHandler.set_task"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.set_task" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Set and schedule a task to run.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>seconds</strong> (<em>int</em><em>, </em><em>float</em>) – the delay in seconds from now.</p></li>
|
||
<li><p><strong>obj</strong> (<em>Object</em>) – the typecalssed object connected to the event.</p></li>
|
||
<li><p><strong>callback_name</strong> (<em>str</em>) – the callback’s name.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>This method allows to schedule a “persistent” task.
|
||
‘utils.delay’ is called, but a copy of the task is kept in
|
||
the event handler, and when the script restarts (after reload),
|
||
the differed delay is called again.
|
||
The dictionary of locals is frozen and will be available
|
||
again when the task runs. This feature, however, is limited
|
||
by the database: all data cannot be saved. Lambda functions,
|
||
class methods, objects inside an instance and so on will
|
||
not be kept in the locals dictionary.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.DoesNotExist">
|
||
<em class="property">exception </em><code class="sig-name descname">DoesNotExist</code><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.DoesNotExist" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.scripts.scripts.html#evennia.scripts.scripts.DefaultScript.DoesNotExist" title="evennia.scripts.scripts.DefaultScript.DoesNotExist"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript.DoesNotExist</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.MultipleObjectsReturned">
|
||
<em class="property">exception </em><code class="sig-name descname">MultipleObjectsReturned</code><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.MultipleObjectsReturned" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.scripts.scripts.html#evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned" title="evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.path">
|
||
<code class="sig-name descname">path</code><em class="property"> = 'evennia.contrib.base_systems.ingame_python.scripts.EventHandler'</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.path" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.EventHandler.typename">
|
||
<code class="sig-name descname">typename</code><em class="property"> = 'EventHandler'</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.typename" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.scripts.</code><code class="sig-name descname">TimeEventScript</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#TimeEventScript"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.scripts.scripts.html#evennia.scripts.scripts.DefaultScript" title="evennia.scripts.scripts.DefaultScript"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript</span></code></a></p>
|
||
<p>Gametime-sensitive script.</p>
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.at_script_creation">
|
||
<code class="sig-name descname">at_script_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#TimeEventScript.at_script_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.at_script_creation" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>The script is created.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.at_repeat">
|
||
<code class="sig-name descname">at_repeat</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#TimeEventScript.at_repeat"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.at_repeat" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Call the event and reset interval.</p>
|
||
<p>It is necessary to restart the script to reset its interval
|
||
only twice after a reload. When the script has undergone
|
||
down time, there’s usually a slight shift in game time. Once
|
||
the script restarts once, it will set the average time it
|
||
needs for all its future intervals and should not need to be
|
||
restarted. In short, a script that is created shouldn’t need
|
||
to restart more than once, and a script that is reloaded should
|
||
restart only twice.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.DoesNotExist">
|
||
<em class="property">exception </em><code class="sig-name descname">DoesNotExist</code><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.DoesNotExist" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.scripts.scripts.html#evennia.scripts.scripts.DefaultScript.DoesNotExist" title="evennia.scripts.scripts.DefaultScript.DoesNotExist"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript.DoesNotExist</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.MultipleObjectsReturned">
|
||
<em class="property">exception </em><code class="sig-name descname">MultipleObjectsReturned</code><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.MultipleObjectsReturned" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <a class="reference internal" href="evennia.scripts.scripts.html#evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned" title="evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.scripts.scripts.DefaultScript.MultipleObjectsReturned</span></code></a></p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.path">
|
||
<code class="sig-name descname">path</code><em class="property"> = 'evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript'</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.path" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.typename">
|
||
<code class="sig-name descname">typename</code><em class="property"> = 'TimeEventScript'</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript.typename" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt id="evennia.contrib.base_systems.ingame_python.scripts.complete_task">
|
||
<code class="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.scripts.</code><code class="sig-name descname">complete_task</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">task_id</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/scripts.html#complete_task"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.scripts.complete_task" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Mark the task in the event handler as complete.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</dt>
|
||
<dd class="field-odd"><p><strong>task_id</strong> (<em>int</em>) – the task ID.</p>
|
||
</dd>
|
||
</dl>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>This function should be called automatically for individual tasks.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.base_systems.ingame_python.tests.html" title="evennia.contrib.base_systems.ingame_python.tests"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.contrib.base_systems.ingame_python.eventfuncs.html" title="evennia.contrib.base_systems.ingame_python.eventfuncs"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 3.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.contrib.html" >evennia.contrib</a> »</li>
|
||
<li class="nav-item nav-item-5"><a href="evennia.contrib.base_systems.html" >evennia.contrib.base_systems</a> »</li>
|
||
<li class="nav-item nav-item-6"><a href="evennia.contrib.base_systems.ingame_python.html" >evennia.contrib.base_systems.ingame_python</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.contrib.base_systems.ingame_python.scripts</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
<div class="admonition important">
|
||
<p class="first admonition-title">Note</p>
|
||
<p class="last">You are reading an old version of the Evennia documentation. <a href="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
|
||
</div>
|
||
|
||
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2023, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |