mirror of
https://github.com/evennia/evennia.git
synced 2026-04-07 00:45:22 +02:00
Updated HTML docs.
This commit is contained in:
parent
8df2d2cfda
commit
5d5b8be778
28 changed files with 91 additions and 91 deletions
|
|
@ -242,8 +242,8 @@ utilities that will be useful later. We will also learn how to write <em>tests</
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>Above, the <code class="docutils literal notranslate"><span class="pre">Ability</span></code> class holds some basic properties of a character sheet.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">ABILITY_REVERSE_MAP</span></code> is a convenient map to go the other way — if in some command we were to enter the string ‘cha’, we could use this mapping to directly convert your input to the correct <code class="docutils literal notranslate"><span class="pre">Ability</span></code>. For example:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ability = ABILITY_REVERSE_MAP.get(your_input)
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">ABILITY_REVERSE_MAP</span></code> is a convenient map to convert a string to an Enum. The most common use of this would be in a Command; the Player don’t know anything about Enums, they can only send strings. So we’d only get the string “cha”. Using this <code class="docutils literal notranslate"><span class="pre">ABILITY_REVERSE_MAP</span></code> we can conveniently convert this input to an <code class="docutils literal notranslate"><span class="pre">Ability.CHA</span></code> Enum you can then pass around in code</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ability = ABILITY_REVERSE_MAP.get(user_input)
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue