mirror of
https://github.com/evennia/evennia.git
synced 2026-03-28 18:47:16 +01:00
Updated HTML docs.
This commit is contained in:
parent
370a11cf2f
commit
88477386fe
64 changed files with 2209 additions and 2458 deletions
|
|
@ -6,7 +6,7 @@
|
|||
<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>Command Prompt — Evennia 1.0-dev documentation</title>
|
||||
<title>Adding a Command Prompt — Evennia 1.0-dev 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>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<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="Command Cooldown" href="Howto-Command-Cooldown.html" />
|
||||
<link rel="next" title="Adding Command Cooldowns" href="Howto-Command-Cooldown.html" />
|
||||
<link rel="prev" title="2. Web Tutorial" href="Beginner-Tutorial/Part5/Web-Tutorial.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
|
|
@ -30,14 +30,14 @@
|
|||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Howto-Command-Cooldown.html" title="Command Cooldown"
|
||||
<a href="Howto-Command-Cooldown.html" title="Adding Command Cooldowns"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial/Part5/Web-Tutorial.html" title="2. Web Tutorial"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="Howtos-Overview.html" accesskey="U">Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Command Prompt</a></li>
|
||||
<li class="nav-item nav-item-this"><a href="">Adding a Command Prompt</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -62,9 +62,9 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Command Prompt</a><ul>
|
||||
<li><a class="reference internal" href="#sending-a-prompt">Sending a prompt</a></li>
|
||||
<li><a class="reference internal" href="#a-prompt-sent-with-every-command">A prompt sent with every command</a><ul>
|
||||
<li><a class="reference internal" href="#">Adding a Command Prompt</a><ul>
|
||||
<li><a class="reference internal" href="#a-fixed-location-prompt">A fixed-location prompt</a></li>
|
||||
<li><a class="reference internal" href="#a-prompt-with-every-command">A prompt with every command</a><ul>
|
||||
<li><a class="reference internal" href="#modifying-default-commands">Modifying default commands</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
title="previous chapter"><span class="section-number">2. </span>Web Tutorial</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Howto-Command-Cooldown.html"
|
||||
title="next chapter">Command Cooldown</a></p>
|
||||
title="next chapter">Adding Command Cooldowns</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -108,22 +108,24 @@
|
|||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="command-prompt">
|
||||
<h1>Command Prompt<a class="headerlink" href="#command-prompt" title="Permalink to this headline">¶</a></h1>
|
||||
<p>A <em>prompt</em> is quite common in MUDs. The prompt display useful details about your character that you
|
||||
are likely to want to keep tabs on at all times, such as health, magical power etc. It might also
|
||||
show things like in-game time, weather and so on. Many modern MUD clients (including Evennia’s own
|
||||
webclient) allows for identifying the prompt and have it appear in a correct location (usually just
|
||||
above the input line). Usually it will remain like that until it is explicitly updated.</p>
|
||||
<section id="sending-a-prompt">
|
||||
<h2>Sending a prompt<a class="headerlink" href="#sending-a-prompt" title="Permalink to this headline">¶</a></h2>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="adding-a-command-prompt">
|
||||
<h1>Adding a Command Prompt<a class="headerlink" href="#adding-a-command-prompt" title="Permalink to this headline">¶</a></h1>
|
||||
<p>A <em>prompt</em> is quite common in MUDs:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>HP: 5, MP: 2, SP: 8
|
||||
>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The prompt display useful details about your character that you are likely to want to keep tabs on at all times. It could be health, magical power, gold and current location. It might also show things like in-game time, weather and so on.</p>
|
||||
<p>Traditionally, the prompt (changed or not) was returned with every reply from the server and just displayed on its own line. Many modern MUD clients (including Evennia’s own webclient) allows for identifying the prompt and have it appear in a fixed location that gets updated in-place (usually just above the input line).</p>
|
||||
<section id="a-fixed-location-prompt">
|
||||
<h2>A fixed-location prompt<a class="headerlink" href="#a-fixed-location-prompt" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A prompt is sent using the <code class="docutils literal notranslate"><span class="pre">prompt</span></code> keyword to the <code class="docutils literal notranslate"><span class="pre">msg()</span></code> method on objects. The prompt will be
|
||||
sent without any line breaks.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="s2">"HP: 5, MP: 2, SP: 8"</span><span class="p">)</span>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="s2">"HP: 5, MP: 2, SP: 8"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can combine the sending of normal text with the sending (updating of the prompt):</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"This is a text"</span><span class="p">,</span> <span class="n">prompt</span><span class="o">=</span><span class="s2">"This is a prompt"</span><span class="p">)</span>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"This is a text"</span><span class="p">,</span> <span class="n">prompt</span><span class="o">=</span><span class="s2">"This is a prompt"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can update the prompt on demand, this is normally done using <a class="reference internal" href="../Concepts/OOB.html"><span class="doc std std-doc">OOB</span></a>-tracking of the relevant
|
||||
|
|
@ -167,17 +169,10 @@ the prompt when they cause a change in health, for example.</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="a-prompt-sent-with-every-command">
|
||||
<h2>A prompt sent with every command<a class="headerlink" href="#a-prompt-sent-with-every-command" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The prompt sent as described above uses a standard telnet instruction (the Evennia web client gets a
|
||||
special flag). Most MUD telnet clients will understand and allow users to catch this and keep the
|
||||
prompt in place until it updates. So <em>in principle</em> you’d not need to update the prompt every
|
||||
command.</p>
|
||||
<p>However, with a varying user base it can be unclear which clients are used and which skill level the
|
||||
users have. So sending a prompt with every command is a safe catch-all. You don’t need to manually
|
||||
go in and edit every command you have though. Instead you edit the base command class for your
|
||||
custom commands (like <code class="docutils literal notranslate"><span class="pre">MuxCommand</span></code> in your <code class="docutils literal notranslate"><span class="pre">mygame/commands/command.py</span></code> folder) and overload the
|
||||
<code class="docutils literal notranslate"><span class="pre">at_post_cmd()</span></code> hook. This hook is always called <em>after</em> the main <code class="docutils literal notranslate"><span class="pre">func()</span></code> method of the Command.</p>
|
||||
<section id="a-prompt-with-every-command">
|
||||
<h2>A prompt with every command<a class="headerlink" href="#a-prompt-with-every-command" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The prompt sent as described above uses a standard telnet instruction (the Evennia web client gets a special flag). Most MUD telnet clients will understand and allow users to catch this and keep the prompt in place until it updates. So <em>in principle</em> you’d not need to update the prompt every command.</p>
|
||||
<p>However, with a varying user base it can be unclear which clients are used and which skill level the users have. So sending a prompt with every command is a safe catch-all. You don’t need to manually go in and edit every command you have though. Instead you edit the base command class for your custom commands (like <code class="docutils literal notranslate"><span class="pre">MuxCommand</span></code> in your <code class="docutils literal notranslate"><span class="pre">mygame/commands/command.py</span></code> folder) and overload the <code class="docutils literal notranslate"><span class="pre">at_post_cmd()</span></code> hook. This hook is always called <em>after</em> the main <code class="docutils literal notranslate"><span class="pre">func()</span></code> method of the Command.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">default_cmds</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">MuxCommand</span><span class="p">(</span><span class="n">default_cmds</span><span class="o">.</span><span class="n">MuxCommand</span><span class="p">):</span>
|
||||
|
|
@ -192,8 +187,7 @@ custom commands (like <code class="docutils literal notranslate"><span class="pr
|
|||
</div>
|
||||
<section id="modifying-default-commands">
|
||||
<h3>Modifying default commands<a class="headerlink" href="#modifying-default-commands" title="Permalink to this headline">¶</a></h3>
|
||||
<p>If you want to add something small like this to Evennia’s default commands without modifying them
|
||||
directly the easiest way is to just wrap those with a multiple inheritance to your own base class:</p>
|
||||
<p>If you want to add something small like this to Evennia’s default commands without modifying them directly the easiest way is to just wrap those with a multiple inheritance to your own base class:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in (for example) mygame/commands/mycommands.py</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">default_cmds</span>
|
||||
|
|
@ -240,14 +234,14 @@ directly the easiest way is to just wrap those with a multiple inheritance to yo
|
|||
<a href="../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Howto-Command-Cooldown.html" title="Command Cooldown"
|
||||
<a href="Howto-Command-Cooldown.html" title="Adding Command Cooldowns"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial/Part5/Web-Tutorial.html" title="2. Web Tutorial"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Command Prompt</a></li>
|
||||
<li class="nav-item nav-item-this"><a href="">Adding a Command Prompt</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue