Updated HTML docs

This commit is contained in:
Griatch 2021-10-26 21:41:11 +02:00
parent 66d0ad0bc9
commit 7900aad365
2073 changed files with 32986 additions and 41197 deletions

View file

@ -14,6 +14,8 @@
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"processClass": "tex2jax_process|mathjax_process|math|output_area"}})</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" />
@ -38,7 +40,7 @@
<div class="bodywrapper">
<div class="body" role="main">
<section id="oob">
<section class="tex2jax_ignore mathjax_ignore" id="oob">
<h1>OOB<a class="headerlink" href="#oob" title="Permalink to this headline"></a></h1>
<p>OOB, or Out-Of-Band, means sending data between Evennia and the users client without the user
prompting it or necessarily being aware that its being passed. Common uses would be to update
@ -47,39 +49,38 @@ window pane.</p>
<section id="briefly-on-input-outputcommands">
<h2>Briefly on input/outputcommands<a class="headerlink" href="#briefly-on-input-outputcommands" title="Permalink to this headline"></a></h2>
<p>Inside Evennia, all server-client communication happens in the same way (so plain text is also an
OOB message as far as Evennia is concerned). The message follows the <a class="reference internal" href="Messagepath.html"><span class="doc">Message Path</span></a>.
OOB message as far as Evennia is concerned). The message follows the <a class="reference internal" href="Messagepath.html"><span class="doc std std-doc">Message Path</span></a>.
You should read up on that if you are unfamiliar with it. As the message travels along the path it
has a standardized internal form: a tuple with a string, a tuple and a dict:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="s2">&quot;cmdname&quot;</span><span class="p">,</span> <span class="p">(</span><span class="n">args</span><span class="p">),</span> <span class="p">{</span><span class="n">kwargs</span><span class="p">})</span>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>(&quot;cmdname&quot;, (args), {kwargs})
</pre></div>
</div>
<p>This is often referred to as an <em>inputcommand</em> or <em>outputcommand</em>, depending on the direction its
traveling. The end point for an inputcommand, (the Evennia-end of the message path) is a matching
<a class="reference internal" href="../Components/Inputfuncs.html"><span class="doc">Inputfunc</span></a>. This function is called as <code class="docutils literal notranslate"><span class="pre">cmdname(session,</span> <span class="pre">*args,</span> <span class="pre">**kwargs)</span></code> where
<a class="reference internal" href="../Components/Inputfuncs.html"><span class="doc std std-doc">Inputfunc</span></a>. This function is called as <code class="docutils literal notranslate"><span class="pre">cmdname(session,</span> <span class="pre">*args,</span> <span class="pre">**kwargs)</span></code> where
<code class="docutils literal notranslate"><span class="pre">session</span></code> is the Session-source of the command. Inputfuncs can easily be added by the developer to
support/map client commands to actions inside Evennia (see the <a class="reference internal" href="../Components/Inputfuncs.html"><span class="doc">inputfunc</span></a> page for more
support/map client commands to actions inside Evennia (see the <a class="reference internal" href="../Components/Inputfuncs.html"><span class="doc std std-doc">inputfunc</span></a> page for more
details).</p>
<p>When a message is outgoing (at the Client-end of the message path) the outputcommand is handled by
a matching <em>Outputfunc</em>. This is responsible for converting the internal Evennia representation to a
form suitable to send over the wire to the Client. Outputfuncs are hard-coded. Which is chosen and
how it processes the outgoing data depends on the nature of the client its connected to. The only
time one would want to add new outputfuncs is as part of developing support for a new Evennia
<a class="reference internal" href="Custom-Protocols.html"><span class="doc">Protocol</span></a>.</p>
<a class="reference internal" href="Custom-Protocols.html"><span class="doc std std-doc">Protocol</span></a>.</p>
</section>
<section id="sending-and-receiving-an-oob-message">
<h2>Sending and receiving an OOB message<a class="headerlink" href="#sending-and-receiving-an-oob-message" title="Permalink to this headline"></a></h2>
<p>Sending is simple. You just use the normal <code class="docutils literal notranslate"><span class="pre">msg</span></code> method of the object whose session you want to send
to. For example in a Command:</p>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span> <span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="n">cmdname</span><span class="o">=</span><span class="p">((</span><span class="n">args</span><span class="p">,</span> <span class="o">...</span><span class="p">),</span> <span class="p">{</span><span class="n">key</span><span class="p">:</span><span class="n">value</span><span class="p">,</span> <span class="o">...</span><span class="p">}))</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="n">cmdname</span><span class="o">=</span><span class="p">((</span><span class="n">args</span><span class="p">,</span> <span class="o">...</span><span class="p">),</span> <span class="p">{</span><span class="n">key</span><span class="p">:</span><span class="n">value</span><span class="p">,</span> <span class="o">...</span><span class="p">}))</span>
</pre></div>
</td></tr></table></div>
</div>
<p>A special case is the <code class="docutils literal notranslate"><span class="pre">text</span></code> input/outputfunc. Its so common that its the default of the <code class="docutils literal notranslate"><span class="pre">msg</span></code>
method. So these are equivalent:</p>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span> <span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">&quot;Hello&quot;</span><span class="p">)</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">&quot;Hello&quot;</span><span class="p">)</span>
<span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s2">&quot;Hello&quot;</span><span class="p">)</span>
</pre></div>
</td></tr></table></div>
</div>
<p>You dont have to specify the full output/input definition. So for example, if your particular
command only needs kwargs, you can skip the <code class="docutils literal notranslate"><span class="pre">(args)</span></code> part. Like in the <code class="docutils literal notranslate"><span class="pre">text</span></code> case you can skip
writing the tuple if there is only one arg … and so on - the input is pretty flexible. If there
@ -93,7 +94,7 @@ drop any other types of outputfuncs.</p>
you turn off telnet completely and only rely on the webclient, you should never rely on non-<code class="docutils literal notranslate"><span class="pre">text</span></code>
OOB messages always reaching all targets.</p>
</div></blockquote>
<p><a class="reference internal" href="../Components/Inputfuncs.html"><span class="doc">Inputfuncs</span></a> lists the default inputfuncs available to handle incoming OOB messages. To
<p><a class="reference internal" href="../Components/Inputfuncs.html"><span class="doc std std-doc">Inputfuncs</span></a> lists the default inputfuncs available to handle incoming OOB messages. To
accept more you need to add more inputfuncs (see that page for more info).</p>
</section>
<section id="supported-oob-protocols">
@ -129,35 +130,30 @@ come <code class="docutils literal notranslate"><span class="pre">foo_bar</span>
underscore, use the <code class="docutils literal notranslate"><span class="pre">Core</span></code> package. So <code class="docutils literal notranslate"><span class="pre">Core.Cmdname</span></code> becomes just <code class="docutils literal notranslate"><span class="pre">cmdname</span></code> in Evennia and vice
versa.</p>
<p>On the wire, a GMCP instruction for <code class="docutils literal notranslate"><span class="pre">(&quot;cmdname&quot;,</span> <span class="pre">(&quot;arg&quot;,),</span> <span class="pre">{})</span></code> will look like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">IAC</span> <span class="n">SB</span> <span class="n">GMCP</span> <span class="s2">&quot;cmdname&quot;</span> <span class="s2">&quot;arg&quot;</span> <span class="n">IAC</span> <span class="n">SE</span>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>IAC SB GMCP &quot;cmdname&quot; &quot;arg&quot; IAC SE
</pre></div>
</div>
<p>where all the capitalized words are telnet character constants specified in
<code class="docutils literal notranslate"><span class="pre">evennia/server/portal/telnet_oob.py</span></code>. These are parsed/added by the protocol and we dont include
these in the listings below.</p>
</section>
</section>
</section>
<section id="input-outputfunc-gmcp-command">
<h2>Input/Outputfunc | GMCP-Command<a class="headerlink" href="#input-outputfunc-gmcp-command" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">[cmd_name,</span> <span class="pre">[],</span> <span class="pre">{}]</span></code> | Cmd.Name
<code class="docutils literal notranslate"><span class="pre">[cmd_name,</span> <span class="pre">[arg],</span> <span class="pre">{}]</span></code> | Cmd.Name arg
<code class="docutils literal notranslate"><span class="pre">[cmd_na_me,</span> <span class="pre">[args],{}]</span></code> | Cmd.Na.Me [args]
<code class="docutils literal notranslate"><span class="pre">[cmd_name,</span> <span class="pre">[],</span> <span class="pre">{kwargs}]</span></code> | Cmd.Name {kwargs}
<p>Input/Outputfunc | GMCP-Command
<code class="docutils literal notranslate"><span class="pre">[cmd_name,</span> <span class="pre">[],</span> <span class="pre">{}]</span></code> | <a class="reference external" href="http://Cmd.Name">Cmd.Name</a>
<code class="docutils literal notranslate"><span class="pre">[cmd_name,</span> <span class="pre">[arg],</span> <span class="pre">{}]</span></code> | <a class="reference external" href="http://Cmd.Name">Cmd.Name</a> arg
<code class="docutils literal notranslate"><span class="pre">[cmd_na_me,</span> <span class="pre">[args],{}]</span></code> | <a class="reference external" href="http://Cmd.Na.Me">Cmd.Na.Me</a> [args]
<code class="docutils literal notranslate"><span class="pre">[cmd_name,</span> <span class="pre">[],</span> <span class="pre">{kwargs}]</span></code> | <a class="reference external" href="http://Cmd.Name">Cmd.Name</a> {kwargs}
<code class="docutils literal notranslate"><span class="pre">[cmdname,</span> <span class="pre">[args,</span> <span class="pre">{kwargs}]</span></code> | Core.Cmdname [[args],{kwargs}]</p>
<p>Since Evennia already supplies default inputfuncs that dont match the names expected by the most
common GMCP implementations we have a few hard-coded mappings for those:</p>
</section>
<section id="gmcp-command-name-input-outputfunc-name">
<h2>GMCP command name | Input/Outputfunc name<a class="headerlink" href="#gmcp-command-name-input-outputfunc-name" title="Permalink to this headline"></a></h2>
<p>“Core.Hello” | “client_options”
<p>GMCP command name | Input/Outputfunc name
“Core.Hello” | “client_options”
“Core.Supports.Get” | “client_options”
“Core.Commands.Get” | “get_inputfuncs”
“Char.Value.Get” | “get_value”
“Char.Repeat.Update” | “repeat”
“Char.Monitor.Update” | “monitor”</p>
</section>
<section id="telnet-msdp">
<h3>Telnet + MSDP<a class="headerlink" href="#telnet-msdp" title="Permalink to this headline"></a></h3>
<h4>Telnet + MSDP<a class="headerlink" href="#telnet-msdp" title="Permalink to this headline"></a></h4>
<p><a class="reference external" href="http://tintin.sourceforge.net/msdp/">MSDP</a>, the <em>Mud Server Data Protocol</em>, is a competing standard
to GMCP. The MSDP protocol page specifies a range of “recommended” available MSDP command names.
Evennia does <em>not</em> support those - since MSDP doesnt specify a special format for its command names
@ -167,16 +163,13 @@ name.</p>
strings, arrays (lists) and tables (dicts). These are used to define the cmdname, args and kwargs
needed. When sending MSDP for <code class="docutils literal notranslate"><span class="pre">(&quot;cmdname&quot;,</span> <span class="pre">(&quot;arg&quot;,),</span> <span class="pre">{})</span></code> the resulting MSDP instruction will look
like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">IAC</span> <span class="n">SB</span> <span class="n">MSDP</span> <span class="n">VAR</span> <span class="n">cmdname</span> <span class="n">VAL</span> <span class="n">arg</span> <span class="n">IAC</span> <span class="n">SE</span>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>IAC SB MSDP VAR cmdname VAL arg IAC SE
</pre></div>
</div>
<p>The various available MSDP constants like <code class="docutils literal notranslate"><span class="pre">VAR</span></code> (variable), <code class="docutils literal notranslate"><span class="pre">VAL</span></code> (value), <code class="docutils literal notranslate"><span class="pre">ARRAYOPEN</span></code>/<code class="docutils literal notranslate"><span class="pre">ARRAYCLOSE</span></code>
and <code class="docutils literal notranslate"><span class="pre">TABLEOPEN</span></code>/<code class="docutils literal notranslate"><span class="pre">TABLECLOSE</span></code> are specified in <code class="docutils literal notranslate"><span class="pre">evennia/server/portal/telnet_oob</span></code>.</p>
</section>
</section>
<section id="outputfunc-inputfunc-msdp-instruction">
<h2>Outputfunc/Inputfunc | MSDP instruction<a class="headerlink" href="#outputfunc-inputfunc-msdp-instruction" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">[cmdname,</span> <span class="pre">[],</span> <span class="pre">{}]</span></code> | VAR cmdname VAL
<p>Outputfunc/Inputfunc | MSDP instruction
<code class="docutils literal notranslate"><span class="pre">[cmdname,</span> <span class="pre">[],</span> <span class="pre">{}]</span></code> | VAR cmdname VAL
<code class="docutils literal notranslate"><span class="pre">[cmdname,</span> <span class="pre">[arg],</span> <span class="pre">{}]</span></code> | VAR cmdname VAL arg
<code class="docutils literal notranslate"><span class="pre">[cmdname,</span> <span class="pre">[args],{}]</span></code> | VAR cmdname VAL ARRAYOPEN VAL arg VAL arg … ARRAYCLOSE
<code class="docutils literal notranslate"><span class="pre">[cmdname,</span> <span class="pre">[],</span> <span class="pre">{kwargs}]</span></code> | VAR cmdname VAL TABLEOPEN VAR key VAL val … TABLECLOSE
@ -185,6 +178,8 @@ VAL TABLEOPEN VAR key VAL val … TABLECLOSE</p>
<p>Observe that <code class="docutils literal notranslate"><span class="pre">VAR</span> <span class="pre">...</span> <span class="pre">VAL</span></code> always identifies cmdnames, so if there are multiple arrays/dicts tagged
with the same cmdname they will be appended to the args, kwargs of that inputfunc. Vice-versa, a
different <code class="docutils literal notranslate"><span class="pre">VAR</span> <span class="pre">...</span> <span class="pre">VAL</span></code> (outside a table) will come out as a second, different command input.</p>
</section>
</section>
<section id="ssh">
<h3>SSH<a class="headerlink" href="#ssh" title="Permalink to this headline"></a></h3>
<p>SSH only supports the <code class="docutils literal notranslate"><span class="pre">text</span></code> input/outputcommand.</p>
@ -194,7 +189,7 @@ different <code class="docutils literal notranslate"><span class="pre">VAR</span
<p>Our web client uses pure JSON structures for all its communication, including <code class="docutils literal notranslate"><span class="pre">text</span></code>. This maps
directly to the Evennia internal output/inputcommand, including eventual empty args/kwargs. So the
same example <code class="docutils literal notranslate"><span class="pre">(&quot;cmdname&quot;,</span> <span class="pre">(&quot;arg&quot;,),</span> <span class="pre">{})</span></code> will be sent/received as a valid JSON structure</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="s2">&quot;cmdname, [&quot;</span><span class="n">arg</span><span class="s2">&quot;], </span><span class="si">{}</span><span class="s2">]</span>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>[&quot;cmdname, [&quot;arg&quot;], {}]
</pre></div>
</div>
<p>Since JSON is native to Javascript, this becomes very easy for the webclient to handle.</p>
@ -230,16 +225,9 @@ same example <code class="docutils literal notranslate"><span class="pre">(&quot
<li><a class="reference internal" href="#supported-oob-protocols">Supported OOB protocols</a><ul>
<li><a class="reference internal" href="#telnet">Telnet</a><ul>
<li><a class="reference internal" href="#telnet-gmcp">Telnet + GMCP</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#input-outputfunc-gmcp-command">Input/Outputfunc | GMCP-Command</a></li>
<li><a class="reference internal" href="#gmcp-command-name-input-outputfunc-name">GMCP command name | Input/Outputfunc name</a><ul>
<li><a class="reference internal" href="#telnet-msdp">Telnet + MSDP</a></li>
</ul>
</li>
<li><a class="reference internal" href="#outputfunc-inputfunc-msdp-instruction">Outputfunc/Inputfunc | MSDP instruction</a><ul>
<li><a class="reference internal" href="#ssh">SSH</a></li>
<li><a class="reference internal" href="#web-client">Web client</a></li>
</ul>
@ -268,7 +256,7 @@ same example <code class="docutils literal notranslate"><span class="pre">(&quot
<h3>Versions</h3>
<ul>
<li><a href="OOB.html">1.0-dev (develop branch)</a></li>
<li><a href="../../0.9.5/index.html">0.9.5 (v0.9.5 branch)</a></li>
<li><a href="../../0.95/index.html">0.95 (v0.9.5 branch)</a></li>
</ul>
</div>