<p><em>Nicks</em>, short for <em>Nicknames</em> is a system allowing an object (usually a <aclass="reference internal"href="Accounts.html"><spanclass="doc std std-doc">Account</span></a>) to
<li><p>objects - replacement is only attempted when referring to an object</p></li>
<li><p>accounts - replacement is only attempted when referring an account</p></li>
</ul>
<p>Here’s how to use it in the default command set (using the <codeclass="docutils literal notranslate"><spanclass="pre">nick</span></code> command):</p>
<p>This is a good one for unix/linux users who are accustomed to using the <codeclass="docutils literal notranslate"><spanclass="pre">ls</span></code> command in their daily
life. It is equivalent to <codeclass="docutils literal notranslate"><spanclass="pre">nick/inputline</span><spanclass="pre">ls</span><spanclass="pre">=</span><spanclass="pre">look</span></code>.</p>
<p>This will catch space separated arguments and store them in the the tags <codeclass="docutils literal notranslate"><spanclass="pre">$1</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">$2</span></code>, to be
inserted in the replacement string. This example allows you to do <codeclass="docutils literal notranslate"><spanclass="pre">build</span><spanclass="pre">box</span><spanclass="pre">crate</span></code> and have Evennia
see <codeclass="docutils literal notranslate"><spanclass="pre">@create/drop</span><spanclass="pre">box;crate</span></code>. You may use any <codeclass="docutils literal notranslate"><spanclass="pre">$</span></code> numbers between 1 and 99, but the markers must
match between the nick pattern and the replacement.</p>
<div><p>If you want to catch “the rest” of a command argument, make sure to put a <codeclass="docutils literal notranslate"><spanclass="pre">$</span></code> tag <em>with no spaces
to the right of it</em> - it will then receive everything up until the end of the line.</p>
<p>Nicks are stored as the <codeclass="docutils literal notranslate"><spanclass="pre">Nick</span></code> database model and are referred from the normal Evennia
<aclass="reference internal"href="Objects.html"><spanclass="doc std std-doc">object</span></a> through the <codeclass="docutils literal notranslate"><spanclass="pre">nicks</span></code> property - this is known as the <em>NickHandler</em>. The NickHandler
<spanclass="n">obj</span><spanclass="o">.</span><spanclass="n">nicks</span><spanclass="o">.</span><spanclass="n">add</span><spanclass="p">(</span><spanclass="s2">"greetjack"</span><spanclass="p">,</span><spanclass="s2">"tell Jack = Hello pal!"</span><spanclass="p">)</span>
<spanclass="c1"># An object nick: </span>
<spanclass="n">obj</span><spanclass="o">.</span><spanclass="n">nicks</span><spanclass="o">.</span><spanclass="n">add</span><spanclass="p">(</span><spanclass="s2">"rose"</span><spanclass="p">,</span><spanclass="s2">"The red flower"</span><spanclass="p">,</span><spanclass="n">nick_type</span><spanclass="o">=</span><spanclass="s2">"object"</span><spanclass="p">)</span>
<p>In a command definition you can reach the nick handler through <codeclass="docutils literal notranslate"><spanclass="pre">self.caller.nicks</span></code>. See the <codeclass="docutils literal notranslate"><spanclass="pre">nick</span></code>
command in <codeclass="docutils literal notranslate"><spanclass="pre">evennia/commands/default/general.py</span></code> for more examples.</p>
<p>As a last note, The Evennia <aclass="reference internal"href="Channels.html"><spanclass="doc std std-doc">channel</span></a> alias systems are using nicks with the
<codeclass="docutils literal notranslate"><spanclass="pre">nick_type="channel"</span></code> in order to allow users to create their own custom aliases to channels.</p>
<p>Internally, nicks are <aclass="reference internal"href="Attributes.html"><spanclass="doc std std-doc">Attributes</span></a> saved with the <codeclass="docutils literal notranslate"><spanclass="pre">db_attrype</span></code> set to “nick” (normal
Attributes has this set to <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>).</p>
<p>The nick stores the replacement data in the Attribute.db_value field as a tuple with four fields
<codeclass="docutils literal notranslate"><spanclass="pre">(regex_nick,</span><spanclass="pre">template_string,</span><spanclass="pre">raw_nick,</span><spanclass="pre">raw_template)</span></code>. Here <codeclass="docutils literal notranslate"><spanclass="pre">regex_nick</span></code> is the converted regex
representation of the <codeclass="docutils literal notranslate"><spanclass="pre">raw_nick</span></code> and the <codeclass="docutils literal notranslate"><spanclass="pre">template-string</span></code> is a version of the <codeclass="docutils literal notranslate"><spanclass="pre">raw_template</span></code>
prepared for efficient replacement of any <codeclass="docutils literal notranslate"><spanclass="pre">$</span></code>- type markers. The <codeclass="docutils literal notranslate"><spanclass="pre">raw_nick</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">raw_template</span></code> are
basically the unchanged strings you enter to the <codeclass="docutils literal notranslate"><spanclass="pre">nick</span></code> command (with unparsed <codeclass="docutils literal notranslate"><spanclass="pre">$</span></code> etc).</p>