<spanid="evennia-contrib-ingame-python-scripts"></span><h1>evennia.contrib.ingame_python.scripts<aclass="headerlink"href="#module-evennia.contrib.ingame_python.scripts"title="Permalink to this headline">¶</a></h1>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.ingame_python.scripts.</code><codeclass="sig-name descname">EventHandler</code><spanclass="sig-paren">(</span><emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">at_script_creation</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.at_script_creation"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.at_script_creation"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook called when the script is created.</p>
<codeclass="sig-name descname">at_start</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.at_start"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.at_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
<codeclass="sig-name descname">get_events</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.get_events"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.get_events"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_variable</code><spanclass="sig-paren">(</span><emclass="sig-param">variable_name</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.get_variable"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>variable_name</strong> (<em>str</em>) – the name of the variable to return.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>The variable if found in the locals.
None if not found in the locals.</p>
</dd>
</dl>
<divclass="admonition note">
<pclass="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
<codeclass="sig-name descname">get_callbacks</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.get_callbacks"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.get_callbacks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">del_callback</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em>, <emclass="sig-param">callback_name</em>, <emclass="sig-param">number</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.del_callback"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.del_callback"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">accept_callback</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em>, <emclass="sig-param">callback_name</em>, <emclass="sig-param">number</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.accept_callback"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.accept_callback"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">call</code><spanclass="sig-paren">(</span><emclass="sig-param">obj</em>, <emclass="sig-param">callback_name</em>, <emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.call"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.call"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">handle_error</code><spanclass="sig-paren">(</span><emclass="sig-param">callback</em>, <emclass="sig-param">trace</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.handle_error"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.handle_error"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">set_task</code><spanclass="sig-paren">(</span><emclass="sig-param">seconds</em>, <emclass="sig-param">obj</em>, <emclass="sig-param">callback_name</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#EventHandler.set_task"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.set_task"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><codeclass="sig-name descname">DoesNotExist</code><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.DoesNotExist"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><codeclass="sig-name descname">MultipleObjectsReturned</code><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.MultipleObjectsReturned"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">path</code><emclass="property"> = 'evennia.contrib.ingame_python.scripts.EventHandler'</em><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.path"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">typename</code><emclass="property"> = 'EventHandler'</em><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.EventHandler.typename"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.ingame_python.scripts.</code><codeclass="sig-name descname">TimeEventScript</code><spanclass="sig-paren">(</span><emclass="sig-param">*args</em>, <emclass="sig-param">**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#TimeEventScript"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.TimeEventScript"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">at_script_creation</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#TimeEventScript.at_script_creation"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.TimeEventScript.at_script_creation"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">at_repeat</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#TimeEventScript.at_repeat"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.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
<emclass="property">exception </em><codeclass="sig-name descname">DoesNotExist</code><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.TimeEventScript.DoesNotExist"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><codeclass="sig-name descname">MultipleObjectsReturned</code><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.TimeEventScript.MultipleObjectsReturned"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">path</code><emclass="property"> = 'evennia.contrib.ingame_python.scripts.TimeEventScript'</em><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.TimeEventScript.path"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">typename</code><emclass="property"> = 'TimeEventScript'</em><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.TimeEventScript.typename"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.contrib.ingame_python.scripts.</code><codeclass="sig-name descname">complete_task</code><spanclass="sig-paren">(</span><emclass="sig-param">task_id</em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/ingame_python/scripts.html#complete_task"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.ingame_python.scripts.complete_task"title="Permalink to this definition">¶</a></dt>