mirror of
https://github.com/evennia/evennia.git
synced 2026-03-21 15:26:30 +01:00
Updated HTML docs
This commit is contained in:
parent
bd82579bfa
commit
70b4caedb6
105 changed files with 2389 additions and 2138 deletions
|
|
@ -299,7 +299,7 @@ You hit <target> with full force!
|
|||
</div>
|
||||
<p>Here, <code class="docutils literal notranslate"><span class="pre"><hitter></span></code> would be the one using the <code class="docutils literal notranslate"><span class="pre">hit</span></code> command and <code class="docutils literal notranslate"><span class="pre"><target></span></code> is the one doing the punching.</p>
|
||||
<p>Still in <code class="docutils literal notranslate"><span class="pre">mygame/commands/mycommands.py</span></code>, add a new class, between <code class="docutils literal notranslate"><span class="pre">CmdEcho</span></code> and <code class="docutils literal notranslate"><span class="pre">MyCmdSet</span></code>.</p>
|
||||
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
|
|
@ -321,7 +321,7 @@ You hit <target> with full force!
|
|||
<span class="normal">20</span>
|
||||
<span class="normal">21</span>
|
||||
<span class="normal">22</span>
|
||||
<span class="normal">23</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># ...</span>
|
||||
<span class="normal">23</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># ...</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdHit</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
|
|
@ -344,8 +344,8 @@ You hit <target> with full force!
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You hit </span><span class="si">{</span><span class="n">target</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with full force!"</span><span class="p">)</span>
|
||||
<span class="n">target</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You got hit by </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with full force!"</span><span class="p">)</span>
|
||||
<span class="c1"># ...</span>
|
||||
</pre></div>
|
||||
</td></tr></table></div>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<p>A lot of things to dissect here:</p>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 3</strong>: The normal <code class="docutils literal notranslate"><span class="pre">class</span></code> header. We inherit from <code class="docutils literal notranslate"><span class="pre">Command</span></code> which we imported at the top of this file.</p></li>
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ You see nothing special.
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>The description you get is not very exciting. Let’s add some flavor.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>describe box = This is a large and very heavy box.
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>desc box = This is a large and very heavy box.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>If you try the <code class="docutils literal notranslate"><span class="pre">get</span></code> command we will pick up the box. So far so good, but if we really want this to
|
||||
|
|
@ -198,9 +198,9 @@ later, in the <a class="reference internal" href="Adding-Commands.html"><span cl
|
|||
<h2><span class="section-number">1.5. </span>Get a Personality<a class="headerlink" href="#get-a-personality" title="Permalink to this headline">¶</a></h2>
|
||||
<p><a class="reference internal" href="../../../Components/Scripts.html"><span class="doc std std-doc">Scripts</span></a> are powerful out-of-character objects useful for many “under the hood” things.
|
||||
One of their optional abilities is to do things on a timer. To try out a first script, let’s put one
|
||||
on ourselves. There is an example script in <code class="docutils literal notranslate"><span class="pre">evennia/contrib/tutorial_examples/bodyfunctions.py</span></code>
|
||||
on ourselves. There is an example script in <code class="docutils literal notranslate"><span class="pre">evennia/contrib/tutorials/bodyfunctions/bodyfunctions.py</span></code>
|
||||
that is called <code class="docutils literal notranslate"><span class="pre">BodyFunctions</span></code>. To add this to us we will use the <code class="docutils literal notranslate"><span class="pre">script</span></code> command:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>script self = tutorial_examples.bodyfunctions.BodyFunctions
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>script self = tutorials.bodyfunctions.BodyFunctions
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This string will tell Evennia to dig up the Python code at the place we indicate. It already knows
|
||||
|
|
@ -220,7 +220,7 @@ until it “fires” next. Don’t be alarmed if nothing happens when the countd
|
|||
particular script has a randomizer to determine if it will say something or not. So you will not see
|
||||
output every time it fires.</p>
|
||||
<p>When you are tired of your character’s “insights”, kill the script with</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>script/stop self = tutorial_examples.bodyfunctions.BodyFunctions
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>script/stop self = tutorials.bodyfunctions.BodyFunctions
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You create your own scripts in Python, outside the game; the path you give to <code class="docutils literal notranslate"><span class="pre">script</span></code> is literally
|
||||
|
|
@ -238,7 +238,7 @@ named simply <code class="docutils literal notranslate"><span class="pre">Object
|
|||
<code class="docutils literal notranslate"><span class="pre">evennia/contrib/tutorial_examples</span></code> there is a module <code class="docutils literal notranslate"><span class="pre">red_button.py</span></code>. It contains the enigmatic
|
||||
<code class="docutils literal notranslate"><span class="pre">RedButton</span></code> class.</p>
|
||||
<p>Let’s make us one of <em>those</em>!</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>create/drop button:tutorial_examples.red_button.RedButton
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>create/drop button:tutorials.red_button.RedButton
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The same way we did with the Script Earler, we specify a “Python-path” to the Python code we want Evennia
|
||||
|
|
@ -330,7 +330,7 @@ of #dbrefs, if they are not in the same location) to the command.</p>
|
|||
<p>The Command-help is something you modify in Python code. We’ll get to that when we get to how to
|
||||
add Commands. But you can also add regular help entries, for example to explain something about
|
||||
the history of your game world:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sethelp/add History = At the dawn of time ...
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sethelp History = At the dawn of time ...
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You will now find your new <code class="docutils literal notranslate"><span class="pre">History</span></code> entry in the <code class="docutils literal notranslate"><span class="pre">help</span></code> list and read your help-text with <code class="docutils literal notranslate"><span class="pre">help</span> <span class="pre">History</span></code>.</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue