<spanid="evennia-contrib-base-systems-ingame-python-utils"></span><h1>evennia.contrib.base_systems.ingame_python.utils<aclass="headerlink"href="#module-evennia.contrib.base_systems.ingame_python.utils"title="Permalink to this headline">¶</a></h1>
<p>Functions to extend the event system.</p>
<p>These functions are to be used by developers to customize events and callbacks.</p>
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.utils.</code><codeclass="sig-name descname">get_event_handler</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/ingame_python/utils.html#get_event_handler"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.ingame_python.utils.get_event_handler"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.utils.</code><codeclass="sig-name descname">register_events</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">path_or_typeclass</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/ingame_python/utils.html#register_events"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.ingame_python.utils.register_events"title="Permalink to this definition">¶</a></dt>
<dd><p>Register the events in this typeclass.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>path_or_typeclass</strong> (<em>str</em><em> or </em><em>type</em>) – the Python path leading to the
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.utils.</code><codeclass="sig-name descname">get_next_wait</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">format</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/ingame_python/utils.html#get_next_wait"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.ingame_python.utils.get_next_wait"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the length of time in seconds before format.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>format</strong> (<em>str</em>) – a time format matching the set calendar.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>until (int or float)</em>– the number of seconds until the event.
usual (int or float): the usual number of seconds between events.
format (str): a string format representing the time.</p>
</dd>
</dl>
<pclass="rubric">Notes</p>
<p>The time format could be something like “2018-01-08 12:00”. The
number of units set in the calendar affects the way seconds are
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.utils.</code><codeclass="sig-name descname">time_event</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">obj</span></em>, <emclass="sig-param"><spanclass="n">event_name</span></em>, <emclass="sig-param"><spanclass="n">number</span></em>, <emclass="sig-param"><spanclass="n">parameters</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/ingame_python/utils.html#time_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.ingame_python.utils.time_event"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a time-related event.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>obj</strong> (<em>Object</em>) – the object on which sits the event.</p></li>
<li><p><strong>event_name</strong> (<em>str</em>) – the event’s name.</p></li>
<li><p><strong>number</strong> (<em>int</em>) – the number of the event.</p></li>
<li><p><strong>parameters</strong> (<em>str</em>) – the parameter of the event.</p></li>
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.utils.</code><codeclass="sig-name descname">keyword_event</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">callbacks</span></em>, <emclass="sig-param"><spanclass="n">parameters</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/ingame_python/utils.html#keyword_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.ingame_python.utils.keyword_event"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom call for events with keywords (like push, or pull, or turn…).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>callbacks</strong> (<em>list of dict</em>) – the list of callbacks to be called.</p></li>
<li><p><strong>parameters</strong> (<em>str</em>) – the actual parameters entered to trigger the callback.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A list containing the callback dictionaries to be called.</p>
</dd>
</dl>
<pclass="rubric">Notes</p>
<p>This function should be imported and added as a custom_call
parameter to add the event when the event supports keywords
as parameters. Keywords in parameters are one or more words
separated by a comma. For instance, a ‘push 1, one’ callback can
be set to trigger when the player ‘push 1’ or ‘push one’.</p>
<codeclass="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.utils.</code><codeclass="sig-name descname">phrase_event</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">callbacks</span></em>, <emclass="sig-param"><spanclass="n">parameters</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/ingame_python/utils.html#phrase_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.ingame_python.utils.phrase_event"title="Permalink to this definition">¶</a></dt>
<dd><p>Custom call for events with keywords in sentences (like say or whisper).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>callbacks</strong> (<em>list of dict</em>) – the list of callbacks to be called.</p></li>
<li><p><strong>parameters</strong> (<em>str</em>) – the actual parameters entered to trigger the callback.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A list containing the callback dictionaries to be called.</p>
</dd>
</dl>
<pclass="rubric">Notes</p>
<p>This function should be imported and added as a custom_call
parameter to add the event when the event supports keywords
in phrases as parameters. Keywords in parameters are one or more
words separated by a comma. For instance, a ‘say yes, okay’ callback
can be set to trigger when the player says something containing
either “yes” or “okay” (maybe ‘say I don’t like it, but okay’).</p>
<emclass="property">exception </em><codeclass="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.utils.</code><codeclass="sig-name descname">InterruptEvent</code><aclass="reference internal"href="../_modules/evennia/contrib/base_systems/ingame_python/utils.html#InterruptEvent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.base_systems.ingame_python.utils.InterruptEvent"title="Permalink to this definition">¶</a></dt>