<pclass="last">You are reading an old version of the Evennia documentation. <ahref="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.
<p>The Inputfunc is the last fixed step on the <aclass="reference internal"href="../Concepts/Messagepath.html#ingoing-message-path"><spanclass="std std-doc">Ingoing message path</span></a>. The available Inputfuncs are looked up and called using <codeclass="docutils literal notranslate"><spanclass="pre">commandtuple</span></code> structures sent from the client. The job of the Inputfunc is to perform whatever action is requested, by firing a Command, performing a database query or whatever is needed.</p>
<p>Given a <codeclass="docutils literal notranslate"><spanclass="pre">commandtuple</span></code> on the form</p>
<spanclass="c1"># cmdname is the name of the mismatched inputcommand</span>
</pre></div>
</div>
<p>The default inputfuncs are found in <aclass="reference internal"href="../api/evennia.server.inputfuncs.html#evennia-server-inputfuncs"><spanclass="std std-ref">evennia/server/inputfuncs.py</span></a>.</p>
<sectionid="adding-your-own-inputfuncs">
<h2>Adding your own inputfuncs<aclass="headerlink"href="#adding-your-own-inputfuncs"title="Permalink to this headline">¶</a></h2>
<olclass="simple">
<li><p>Add a function on the above form to <codeclass="docutils literal notranslate"><spanclass="pre">mygame/server/conf/inputfuncs.py</span></code>. Your function must be in the global, outermost scope of that module and not start with an underscore (<codeclass="docutils literal notranslate"><spanclass="pre">_</span></code>) to be recognized as an inputfunc. i</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">reload</span></code> the server.</p></li>
</ol>
<p>To overload a default inputfunc (see below), just add a function with the same name. You can also extend the settings-list <codeclass="docutils literal notranslate"><spanclass="pre">INPUT_FUNC_MODULES</span></code>.</p>
<p>All global-level functions with a name not starting with <codeclass="docutils literal notranslate"><spanclass="pre">_</span></code> in these module(s) will be used by Evennia as an inputfunc. The list is imported from left to right, so latter imported functions will replace earlier ones.</p>
</section>
<sectionid="default-inputfuncs">
<h2>Default inputfuncs<aclass="headerlink"href="#default-inputfuncs"title="Permalink to this headline">¶</a></h2>
<p>Evennia defines a few default inputfuncs to handle the common cases. These are defined in
<li><p>Output: Depends on Command triggered</p></li>
</ul>
<p>This is the most common of inputs, and the only one supported by every traditional mud. The argument is usually what the user sent from their command line. Since all text input from the user
like this is considered a <aclass="reference internal"href="Commands.html"><spanclass="doc std std-doc">Command</span></a>, this inputfunc will do things like nick-replacement and then pass on the input to the central Commandhandler.</p>
</section>
<sectionid="echo">
<h3>echo<aclass="headerlink"href="#echo"title="Permalink to this headline">¶</a></h3>
<p>This is a direct command for setting protocol options. These are settable with the <codeclass="docutils literal notranslate"><spanclass="pre">@option</span></code>
command, but this offers a client-side way to set them. Not all connection protocols makes use of
all flags, but here are the possible keywords:</p>
<ulclass="simple">
<li><p>get (bool): If this is true, ignore all other kwargs and immediately return the current settings
as an outputcommand <codeclass="docutils literal notranslate"><spanclass="pre">("client_options",</span><spanclass="pre">(),</span><spanclass="pre">{key=value,</span><spanclass="pre">...})</span></code>-</p></li>
<li><p>client (str): A client identifier, like “mushclient”.</p></li>
<li><p>version (str): A client version</p></li>
<li><p>ansi (bool): Supports ansi colors</p></li>
<li><p>xterm256 (bool): Supports xterm256 colors or not</p></li>
<li><p>mxp (bool): Supports MXP or not</p></li>
<li><p>utf-8 (bool): Supports UTF-8 or not</p></li>
<li><p>nomarkup (bool): Strip all text tags</p></li>
<li><p>raw (bool): Leave text tags unparsed</p></li>
</ul>
<blockquote>
<div><p>Note that there are two GMCP aliases to this inputfunc - <codeclass="docutils literal notranslate"><spanclass="pre">hello</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">supports_set</span></code>, which means it will be accessed via the GMCP <codeclass="docutils literal notranslate"><spanclass="pre">Hello</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">Supports.Set</span></code> instructions assumed by some clients.</p>
</div></blockquote>
</section>
<sectionid="get-client-options">
<h3>get_client_options<aclass="headerlink"href="#get-client-options"title="Permalink to this headline">¶</a></h3>
<p>This is a convenience wrapper that retrieves the current options by sending “get” to <codeclass="docutils literal notranslate"><spanclass="pre">client_options</span></code> above.</p>
</section>
<sectionid="get-inputfuncs">
<h3>get_inputfuncs<aclass="headerlink"href="#get-inputfuncs"title="Permalink to this headline">¶</a></h3>
<p>Returns an outputcommand on the form <codeclass="docutils literal notranslate"><spanclass="pre">("get_inputfuncs",</span><spanclass="pre">(),</span><spanclass="pre">{funcname:docstring,</span><spanclass="pre">...})</span></code> - a list of all the available inputfunctions along with their docstrings.</p>
</section>
<sectionid="login">
<h3>login<aclass="headerlink"href="#login"title="Permalink to this headline">¶</a></h3>
<blockquote>
<div><p>Note: this is currently experimental and not very well tested.</p>
<p>Retrieves a value from the Character or Account currently controlled by this Session. Takes one argument, This will only accept particular white-listed names, you’ll need to overload the function to expand. By default the following values can be retrieved:</p>
<ulclass="simple">
<li><p>“name” or “key”: The key of the Account or puppeted Character.</p></li>
<li><p>“location”: Name of the current location, or “None”.</p></li>
<li><p>“servername”: Name of the Evennia server connected to.</p></li>
</ul>
</section>
<sectionid="repeat">
<h3>repeat<aclass="headerlink"href="#repeat"title="Permalink to this headline">¶</a></h3>
<li><p>Output: Depends on the repeated function. Will return <codeclass="docutils literal notranslate"><spanclass="pre">("text",</span><spanclass="pre">(repeatlist),{}</span></code> with a list of
accepted names if given an unfamiliar callback name.</p></li>
</ul>
<p>This will tell evennia to repeatedly call a named function at a given interval. Behind the scenes this will set up a <aclass="reference internal"href="TickerHandler.html"><spanclass="doc std std-doc">Ticker</span></a>. Only previously acceptable functions are possible to repeat-call in this way, you’ll need to overload this inputfunc to add the ones you want to offer. By default only two example functions are allowed, “test1” and “test2”, which will just echo a text back at the given interval. Stop the repeat by sending <codeclass="docutils literal notranslate"><spanclass="pre">"stop":</span><spanclass="pre">True</span></code> (note that you must include both the callback name and interval for Evennia to know what to stop).</p>
</section>
<sectionid="unrepeat">
<h3>unrepeat<aclass="headerlink"href="#unrepeat"title="Permalink to this headline">¶</a></h3>
<p>This is a convenience wrapper for sending “stop” to the <codeclass="docutils literal notranslate"><spanclass="pre">repeat</span></code> inputfunc.</p>
</section>
<sectionid="monitor">
<h3>monitor<aclass="headerlink"href="#monitor"title="Permalink to this headline">¶</a></h3>
<li><p>Output (on change): <codeclass="docutils literal notranslate"><spanclass="pre">("monitor",</span><spanclass="pre">(),</span><spanclass="pre">{"name":name,</span><spanclass="pre">"value":value})</span></code></p></li>
</ul>
<p>This sets up on-object monitoring of Attributes or database fields. Whenever the field or Attribute changes in any way, the outputcommand will be sent. This is using the <aclass="reference internal"href="MonitorHandler.html"><spanclass="doc std std-doc">MonitorHandler</span></a> behind the scenes. Pass the “stop” key to stop monitoring. Note that you must supply the name also when stopping to let the system know which monitor should be cancelled.</p>
<p>Only fields/attributes in a whitelist are allowed to be used, you have to overload this function to add more. By default the following fields/attributes can be monitored:</p>
<ulclass="simple">
<li><p>“name”: The current character name</p></li>
<li><p>“location”: The current location</p></li>
<li><p>“desc”: The description Argument</p></li>
</ul>
</section>
<sectionid="unmonitor">
<h3>unmonitor<aclass="headerlink"href="#unmonitor"title="Permalink to this headline">¶</a></h3>
<pclass="last">You are reading an old version of the Evennia documentation. <ahref="https://www.evennia.com/docs/latest/index.html">The latest version is here</a></p>.