<spanid="evennia-commands-default-syscommands"></span><h1>evennia.commands.default.syscommands<aclass="headerlink"href="#module-evennia.commands.default.syscommands"title="Permalink to this headline">¶</a></h1>
<p>System commands</p>
<p>These are the default commands called by the system commandhandler
when various exceptions occur. If one of these commands are not
implemented and part of the current cmdset, the engine falls back
to a default solution instead.</p>
<p>Some system commands are shown in this module
as a REFERENCE only (they are not all added to Evennia’s
default cmdset since they don’t currently do anything differently from the
default backup systems hard-wired in the engine).</p>
<p>Overloading these commands in a cmdset can be used to create
interesting effects. An example is using the NoMatch system command
to implement a line-editor where you don’t have to start each
line with a command (if there is no match to a known command,
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.commands.default.syscommands.</code><codeclass="sig-name descname">SystemNoInput</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemNoInput"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '__noinput_command'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">locks</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput.locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemNoInput.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput.func"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput.lock_storage"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">search_index_entry</code><emclass="property"> = {'aliases': '', 'category': 'general', 'key': '__noinput_command', 'tags': '', 'text': '\n This is called when there is no input given\n '}</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoInput.search_index_entry"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.commands.default.syscommands.</code><codeclass="sig-name descname">SystemNoMatch</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemNoMatch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '__nomatch_command'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">locks</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch.locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemNoMatch.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch.func"title="Permalink to this definition">¶</a></dt>
<dd><p>This is given the failed raw string as input.</p>
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch.lock_storage"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">search_index_entry</code><emclass="property"> = {'aliases': '', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': '\n No command was found matching the given input.\n '}</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemNoMatch.search_index_entry"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.commands.default.syscommands.</code><codeclass="sig-name descname">SystemMultimatch</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemMultimatch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '__multimatch_command'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">locks</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch.locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemMultimatch.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch.func"title="Permalink to this definition">¶</a></dt>
<dd><p>Handle multiple-matches by using the at_search_result default handler.</p>
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch.lock_storage"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">search_index_entry</code><emclass="property"> = {'aliases': '', 'category': 'general', 'key': '__multimatch_command', 'tags': '', 'text': "\n Multiple command matches.\n\n The cmdhandler adds a special attribute 'matches' to this\n system command.\n\n matches = [(cmdname, args, cmdobj, cmdlen, mratio, raw_cmdname) , (cmdname, ...), ...]\n\n Here, `cmdname` is the command's name and `args` the rest of the incoming string,\n without said command name. `cmdobj` is the Command instance, the cmdlen is\n the same as len(cmdname) and mratio is a measure of how big a part of the\n full input string the cmdname takes up - an exact match would be 1.0. Finally,\n the `raw_cmdname` is the cmdname unmodified by eventual prefix-stripping.\n\n "}</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemMultimatch.search_index_entry"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.commands.default.syscommands.</code><codeclass="sig-name descname">SystemSendToChannel</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemSendToChannel"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = '__send_to_channel_command'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">locks</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.locks"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">parse</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemSendToChannel.parse"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.parse"title="Permalink to this definition">¶</a></dt>
<dd><p>This method is called by the cmdhandler once the command name
has been identified. It creates a new set of member variables
that can be later accessed from self.func() (see below)</p>
<p>The following variables are available for our use when entering this
method (from the command definition, and assigned on the fly by the
cmdhandler):</p>
<blockquote>
<div><p>self.key - the name of this command (‘look’)
self.aliases - the aliases of this cmd (‘l’)
self.permissions - permission string for this command
self.help_category - overall category of command</p>
<p>self.caller - the object calling this command
self.cmdstring - the actual command name used to call this</p>
<blockquote>
<div><dlclass="simple">
<dt>(this allows you to know which alias was used,</dt><dd><p>for example)</p>
</dd>
</dl>
</div></blockquote>
<p>self.args - the raw input; everything following self.cmdstring.
self.cmdset - the cmdset from which this command was picked. Not</p>
<blockquote>
<div><p>often used (useful for commands like ‘help’ or to
list all available commands etc)</p>
</div></blockquote>
<dlclass="simple">
<dt>self.obj - the object on which this command was defined. It is often</dt><dd><p>the same as self.caller.</p>
</dd>
</dl>
</div></blockquote>
<p>A MUX command has the following possible syntax:</p>
<blockquote>
<div><p>name[ with several words][/switch[/switch..]] arg1[,arg2,…] [[=|,] arg[,..]]</p>
</div></blockquote>
<p>The ‘name[ with several words]’ part is already dealt with by the
cmdhandler at this point, and stored in self.cmdname (we don’t use
it here). The rest of the command is stored in self.args, which can
start with the switch indicator /.</p>
<dlclass="simple">
<dt>Optional variables to aid in parsing, if set:</dt><dd><dlclass="simple">
<dt>self.switch_options - (tuple of valid /switches expected by this</dt><dd><p>command (without the /))</p>
</dd>
<dt>self.rhs_split - Alternate string delimiter or tuple of strings</dt><dd><p>to separate left/right hand sides. tuple form
gives priority split to first string delimiter.</p>
</dd>
</dl>
</dd>
</dl>
<p>This parser breaks self.args into its constituents and stores them in the
following variables:</p>
<blockquote>
<div><p>self.switches = [list of /switches (without the /)]
self.raw = This is the raw argument input, including switches
self.args = This is re-defined to be everything <em>except</em> the switches
self.lhs = Everything to the left of = (lhs:’left-hand side’). If</p>
<blockquote>
<div><p>no = is found, this is identical to self.args.</p>
</div></blockquote>
<dlclass="simple">
<dt>self.rhs: Everything to the right of = (rhs:’right-hand side’).</dt><dd><p>If no ‘=’ is found, this is None.</p>
</dd>
</dl>
<p>self.lhslist - [self.lhs split into a list by comma]
self.rhslist - [list of self.rhs split into a list by comma]
self.arglist = [list of space-separated args (stripped, including ‘=’ if it exists)]</p>
<p>All args and list members are stripped of excess whitespace around the
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/commands/default/syscommands.html#SystemSendToChannel.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.func"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new message and send it to channel, using
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all()'</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.lock_storage"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">search_index_entry</code><emclass="property"> = {'aliases': '', 'category': 'general', 'key': '__send_to_channel_command', 'tags': '', 'text': '\n This is a special command that the cmdhandler calls\n when it detects that the command given matches\n an existing Channel object key (or alias).\n '}</em><aclass="headerlink"href="#evennia.commands.default.syscommands.SystemSendToChannel.search_index_entry"title="Permalink to this definition">¶</a></dt>