mirror of
https://github.com/evennia/evennia.git
synced 2026-03-20 06:46:31 +01:00
679 lines
No EOL
65 KiB
HTML
679 lines
No EOL
65 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="../">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>evennia.commands.command — Evennia latest documentation</title>
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=d75fae25" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/nature.css?v=279e0f84" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/custom.css?v=e4a91a55" />
|
||
<script src="../_static/documentation_options.js?v=c6e86fd7"></script>
|
||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<link rel="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="evennia.commands.default" href="evennia.commands.default.html" />
|
||
<link rel="prev" title="evennia.commands.cmdsethandler" href="evennia.commands.cmdsethandler.html" />
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.commands.default.html" title="evennia.commands.default"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.commands.cmdsethandler.html" title="evennia.commands.cmdsethandler"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.commands.html" accesskey="U">evennia.commands</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.commands.command</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="module-evennia.commands.command">
|
||
<span id="evennia-commands-command"></span><h1>evennia.commands.command<a class="headerlink" href="#module-evennia.commands.command" title="Link to this heading">¶</a></h1>
|
||
<p>The base Command class.</p>
|
||
<p>All commands in Evennia inherit from the ‘Command’ class in this module.</p>
|
||
<dl class="py exception">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.InterruptCommand">
|
||
<em class="property"><span class="k"><span class="pre">exception</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">evennia.commands.command.</span></span><span class="sig-name descname"><span class="pre">InterruptCommand</span></span><a class="reference internal" href="../_modules/evennia/commands/command.html#InterruptCommand"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.InterruptCommand" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
|
||
<p>Cleanly interrupt a command.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.CommandMeta">
|
||
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">evennia.commands.command.</span></span><span class="sig-name descname"><span class="pre">CommandMeta</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#CommandMeta"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.CommandMeta" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code></p>
|
||
<p>The metaclass cleans up all properties on the class</p>
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.CommandMeta.__init__">
|
||
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#CommandMeta.__init__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.CommandMeta.__init__" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command">
|
||
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">evennia.commands.command.</span></span><span class="sig-name descname"><span class="pre">Command</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<section id="base-command">
|
||
<h2>Base command<a class="headerlink" href="#base-command" title="Link to this heading">¶</a></h2>
|
||
<p>(you may see this if a child command had no help text defined)</p>
|
||
<dl class="simple">
|
||
<dt>Usage:</dt><dd><p>command [args]</p>
|
||
</dd>
|
||
</dl>
|
||
<p>This is the base command class. Inherit from this
|
||
to create new commands.</p>
|
||
<p>The cmdhandler makes the following variables available to the
|
||
command methods (so you can always assume them to be there):</p>
|
||
<p>self.caller - the game object calling the command
|
||
self.cmdstring - the command name used to trigger this command (allows</p>
|
||
<blockquote>
|
||
<div><p>you to know which alias was used, for example)</p>
|
||
</div></blockquote>
|
||
<dl class="simple">
|
||
<dt>self.args - everything supplied to the command following the cmdstring</dt><dd><p>(this is usually what is parsed in self.parse())</p>
|
||
</dd>
|
||
<dt>self.cmdset - the merged cmdset from which this command was matched (useful only</dt><dd><p>seldomly, notably for help-type commands, to create dynamic
|
||
help entries and lists)</p>
|
||
</dd>
|
||
</dl>
|
||
<p>self.cmdset_source - the specific cmdset this command was matched from.
|
||
self.obj - the object on which this command is defined. If a default command,</p>
|
||
<blockquote>
|
||
<div><p>this is usually the same as caller.</p>
|
||
</div></blockquote>
|
||
<dl class="simple">
|
||
<dt>self.raw_string - the full raw string input, including the command name,</dt><dd><p>any args and no parsing.</p>
|
||
</dd>
|
||
</dl>
|
||
<p>The following class properties can/should be defined on your child class:</p>
|
||
<p>key - identifier for command (e.g. “look”)
|
||
aliases - (optional) list of aliases (e.g. [“l”, “loo”])
|
||
locks - lock string (default is “cmd:all()”)
|
||
help_category - how to organize this help entry in help system</p>
|
||
<blockquote>
|
||
<div><p>(default is “General”)</p>
|
||
</div></blockquote>
|
||
<p>auto_help - defaults to True. Allows for turning off auto-help generation
|
||
arg_regex - (optional) raw string regex defining how the argument part of</p>
|
||
<blockquote>
|
||
<div><p>the command should look in order to match for this command
|
||
(e.g. must it be a space between cmdname and arg?)</p>
|
||
</div></blockquote>
|
||
<dl class="simple">
|
||
<dt>auto_help_display_key - (optional) if given, this replaces the string shown</dt><dd><p>in the auto-help listing. This is particularly useful for system-commands
|
||
whose actual key is not really meaningful.</p>
|
||
</dd>
|
||
</dl>
|
||
<p>(Note that if auto_help is on, this initial string is also used by the
|
||
system to create the help entry for the command, so it’s a good idea to
|
||
format it similar to this one). This behavior can be changed by
|
||
overriding the method ‘get_help’ of a command: by default, this
|
||
method returns cmd.__doc__ (that is, this very docstring, or
|
||
the docstring of your command). You can, however, extend or
|
||
replace this without disabling auto_help.</p>
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.key">
|
||
<span class="sig-name descname"><span class="pre">key</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'command'</span></em><a class="headerlink" href="#evennia.commands.command.Command.key" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.aliases">
|
||
<span class="sig-name descname"><span class="pre">aliases</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">[]</span></em><a class="headerlink" href="#evennia.commands.command.Command.aliases" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.locks">
|
||
<span class="sig-name descname"><span class="pre">locks</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'cmd:all();'</span></em><a class="headerlink" href="#evennia.commands.command.Command.locks" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.help_category">
|
||
<span class="sig-name descname"><span class="pre">help_category</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'general'</span></em><a class="headerlink" href="#evennia.commands.command.Command.help_category" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.auto_help">
|
||
<span class="sig-name descname"><span class="pre">auto_help</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">True</span></em><a class="headerlink" href="#evennia.commands.command.Command.auto_help" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.is_exit">
|
||
<span class="sig-name descname"><span class="pre">is_exit</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">False</span></em><a class="headerlink" href="#evennia.commands.command.Command.is_exit" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.arg_regex">
|
||
<span class="sig-name descname"><span class="pre">arg_regex</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">re.compile('^[</span> <span class="pre">/]|\\n|$',</span> <span class="pre">re.IGNORECASE)</span></em><a class="headerlink" href="#evennia.commands.command.Command.arg_regex" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.msg_all_sessions">
|
||
<span class="sig-name descname"><span class="pre">msg_all_sessions</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">False</span></em><a class="headerlink" href="#evennia.commands.command.Command.msg_all_sessions" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.retain_instance">
|
||
<span class="sig-name descname"><span class="pre">retain_instance</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">False</span></em><a class="headerlink" href="#evennia.commands.command.Command.retain_instance" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.__init__">
|
||
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.__init__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.__init__" title="Link to this definition">¶</a></dt>
|
||
<dd><p>The lockhandler works the same as for objects.
|
||
optional kwargs will be set as properties on the Command at runtime,
|
||
overloading evential same-named class properties.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.lockhandler">
|
||
<span class="sig-name descname"><span class="pre">lockhandler</span></span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.lockhandler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.lockhandler" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.set_key">
|
||
<span class="sig-name descname"><span class="pre">set_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">new_key</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.set_key"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.set_key" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Update key.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><strong>new_key</strong> (<em>str</em>) – The new key.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>This is necessary to use to make sure the optimization
|
||
caches are properly updated as well.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.set_aliases">
|
||
<span class="sig-name descname"><span class="pre">set_aliases</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">new_aliases</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.set_aliases"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.set_aliases" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Replace aliases with new ones.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><strong>new_aliases</strong> (<em>str</em><em> or </em><em>list</em>) – Either a ;-separated string
|
||
or a list of aliases. These aliases will replace the
|
||
existing ones, if any.</p>
|
||
</dd>
|
||
</dl>
|
||
<p class="rubric">Notes</p>
|
||
<p>This is necessary to use to make sure the optimization
|
||
caches are properly updated as well.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.match">
|
||
<span class="sig-name descname"><span class="pre">match</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cmdname</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_prefixes</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.match"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.match" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This is called by the system when searching the available commands,
|
||
in order to determine if this is the one we wanted. cmdname was
|
||
previously extracted from the raw string by the system.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><strong>cmdname</strong> (<em>str</em>) – Always lowercase when reaching this point.</p>
|
||
</dd>
|
||
</dl>
|
||
<dl class="simple">
|
||
<dt>Kwargs:</dt><dd><dl class="simple">
|
||
<dt>include_prefixes (bool): If false, will compare against the _noprefix</dt><dd><p>variants of commandnames.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd>
|
||
</dl>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><em>result (bool)</em> – Match result.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.access">
|
||
<span class="sig-name descname"><span class="pre">access</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">srcobj</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">access_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'cmd'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.access"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.access" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This hook is called by the cmdhandler to determine if srcobj
|
||
is allowed to execute this command. It should return a boolean
|
||
value and is not normally something that need to be changed since
|
||
it’s using the Evennia permission system directly.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>srcobj</strong> (<em>Object</em>) – Object trying to gain permission</p></li>
|
||
<li><p><strong>access_type</strong> (<em>str</em><em>, </em><em>optional</em>) – The lock type to check.</p></li>
|
||
<li><p><strong>default</strong> (<em>bool</em><em>, </em><em>optional</em>) – The fallback result if no lock
|
||
of matching <strong>access_type</strong> is found on this Command.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.msg">
|
||
<span class="sig-name descname"><span class="pre">msg</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">to_obj</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">from_obj</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">session</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.msg"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.msg" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This is a shortcut instead of calling msg() directly on an
|
||
object - it will detect if caller is an Object or an Account and
|
||
also appends self.session automatically if self.msg_all_sessions is False.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>text</strong> (<em>str</em><em>, </em><em>optional</em>) – Text string of message to send.</p></li>
|
||
<li><p><strong>to_obj</strong> (<em>Object</em><em>, </em><em>optional</em>) – Target object of message. Defaults to self.caller.</p></li>
|
||
<li><p><strong>from_obj</strong> (<em>Object</em><em>, </em><em>optional</em>) – Source of message. Defaults to to_obj.</p></li>
|
||
<li><p><strong>session</strong> (<a class="reference internal" href="evennia.server.session.html#evennia.server.session.Session" title="evennia.server.session.Session"><em>Session</em></a><em>, </em><em>optional</em>) – Supply data only to a unique
|
||
session (ignores the value of <strong>self.msg_all_sessions</strong>).</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>options</strong> (<em>dict</em>) – Options to the protocol.</p></li>
|
||
<li><p><strong>any</strong> (<em>any</em>) – All other keywords are interpreted as th
|
||
name of send-instructions.</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.execute_cmd">
|
||
<span class="sig-name descname"><span class="pre">execute_cmd</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">raw_string</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">session</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">obj</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.execute_cmd"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.execute_cmd" title="Link to this definition">¶</a></dt>
|
||
<dd><p>A shortcut of execute_cmd on the caller. It appends the
|
||
session automatically.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>raw_string</strong> (<em>str</em>) – Execute this string as a command input.</p></li>
|
||
<li><p><strong>session</strong> (<a class="reference internal" href="evennia.server.session.html#evennia.server.session.Session" title="evennia.server.session.Session"><em>Session</em></a><em>, </em><em>optional</em>) – If not given, the current command’s Session will be used.</p></li>
|
||
<li><p><strong>obj</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) – Object or Account on which to call the execute_cmd.
|
||
If not given, self.caller will be used.</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>command</strong> (<em>Other keyword arguments will be added to the found</em>)</p></li>
|
||
<li><p><strong>is</strong> (<em>object instace as variables before it executes. This</em>)</p></li>
|
||
<li><p><strong>and</strong> (<em>unused by default Evennia but may be used to set flags</em>)</p></li>
|
||
<li><p><strong>run-time.</strong> (<em>change operating paramaters for commands at</em>)</p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.at_pre_cmd">
|
||
<span class="sig-name descname"><span class="pre">at_pre_cmd</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.at_pre_cmd"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.at_pre_cmd" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This hook is called before self.parse() on all commands. If
|
||
this hook returns anything but False/None, the command
|
||
sequence is aborted.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.at_post_cmd">
|
||
<span class="sig-name descname"><span class="pre">at_post_cmd</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.at_post_cmd"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.at_post_cmd" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This hook is called after the command has finished executing
|
||
(after self.func()).</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.parse">
|
||
<span class="sig-name descname"><span class="pre">parse</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.parse"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.parse" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Once the cmdhandler has identified this as the command we
|
||
want, this function is run. If many of your commands have a
|
||
similar syntax (for example ‘cmd arg1 = arg2’) you should
|
||
simply define this once and just let other commands of the
|
||
same form inherit from this. See the docstring of this module
|
||
for which object properties are available to use (notably
|
||
self.args).</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.get_command_info">
|
||
<span class="sig-name descname"><span class="pre">get_command_info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.get_command_info"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.get_command_info" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This is the default output of func() if no func() overload is done.
|
||
Provided here as a separate method so that it can be called for debugging
|
||
purposes when making commands.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.func">
|
||
<span class="sig-name descname"><span class="pre">func</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.func"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.func" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This is the actual executing part of the command. It is
|
||
called directly after self.parse(). See the docstring of this
|
||
module for which object properties are available (beyond those
|
||
set in self.parse())</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.get_extra_info">
|
||
<span class="sig-name descname"><span class="pre">get_extra_info</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">caller</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.get_extra_info"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.get_extra_info" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Display some extra information that may help distinguish this
|
||
command from others, for instance, in a disambiguity prompt.</p>
|
||
<p>If this command is a potential match in an ambiguous
|
||
situation, one distinguishing feature may be its attachment to
|
||
a nearby object, so we include this if available.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>caller</strong> (<a class="reference internal" href="evennia.accounts.models.html#evennia.accounts.models.TypedObject" title="evennia.accounts.models.TypedObject"><em>TypedObject</em></a>) – The caller who typed an ambiguous</p></li>
|
||
<li><p><strong>function.</strong> (<em>term handed to the search</em>)</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns<span class="colon">:</span></dt>
|
||
<dd class="field-even"><p>A string with identifying information to disambiguate the
|
||
object, conventionally with a preceding space.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.get_help">
|
||
<span class="sig-name descname"><span class="pre">get_help</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">caller</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cmdset</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.get_help"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.get_help" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Return the help message for this command and this caller.</p>
|
||
<p>By default, return self.__doc__ (the docstring just under
|
||
the class definition). You can override this behavior,
|
||
though, and even customize it depending on the caller, or other
|
||
commands the caller can use.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>caller</strong> (<em>Object</em><em> or </em><em>Account</em>) – the caller asking for help on the command.</p></li>
|
||
<li><p><strong>cmdset</strong> (<a class="reference internal" href="evennia.commands.cmdhandler.html#evennia.commands.cmdhandler.CmdSet" title="evennia.commands.cmdhandler.CmdSet"><em>CmdSet</em></a>) – the command set (if you need additional commands).</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns<span class="colon">:</span></dt>
|
||
<dd class="field-even"><p><em>docstring (str)</em> – the help text to provide the caller for this command.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.web_get_detail_url">
|
||
<span class="sig-name descname"><span class="pre">web_get_detail_url</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.web_get_detail_url"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.web_get_detail_url" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the URI path for a View that allows users to view details for
|
||
this object.</p>
|
||
<p>ex. Oscar (Character) = ‘/characters/oscar/1/’</p>
|
||
<p>For this to work, the developer must have defined a named view somewhere
|
||
in urls.py that follows the format ‘modelname-action’, so in this case
|
||
a named view of ‘character-detail’ would be referenced by this method.</p>
|
||
<p>ex.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">url</span><span class="p">(</span><span class="sa">r</span><span class="s1">'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/$'</span><span class="p">,</span>
|
||
<span class="n">CharDetailView</span><span class="o">.</span><span class="n">as_view</span><span class="p">(),</span> <span class="n">name</span><span class="o">=</span><span class="s1">'character-detail'</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>If no View has been created and defined in urls.py, returns an
|
||
HTML anchor.</p>
|
||
<p>This method is naive and simply returns a path. Securing access to
|
||
the actual view and limiting who can view this object is the developer’s
|
||
responsibility.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><em>path (str)</em> – URI path to object detail page, if defined.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.web_get_admin_url">
|
||
<span class="sig-name descname"><span class="pre">web_get_admin_url</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.web_get_admin_url"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.web_get_admin_url" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the URI path for the Django Admin page for this object.</p>
|
||
<p>ex. Account#1 = ‘/admin/accounts/accountdb/1/change/’</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><em>path (str)</em> – URI path to Django Admin page for object.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.client_width">
|
||
<span class="sig-name descname"><span class="pre">client_width</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.client_width"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.client_width" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Get the client screenwidth for the session using this command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><em>client width (int)</em> – The width (in characters) of the client window.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.styled_table">
|
||
<span class="sig-name descname"><span class="pre">styled_table</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_table"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_table" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Create an EvTable styled by on user preferences.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><strong>*args</strong> (<em>str</em>) – Column headers. If not colored explicitly, these will get colors
|
||
from user options.</p>
|
||
</dd>
|
||
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
|
||
<dd class="field-even"><p><strong>any</strong> (<em>str</em><em>, </em><em>int</em><em> or </em><em>dict</em>) – EvTable options, including, optionally a <strong>table</strong> dict
|
||
detailing the contents of the table.</p>
|
||
</dd>
|
||
<dt class="field-odd">Returns<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><p><p><em>table (EvTable)</em> –</p>
|
||
<dl class="simple">
|
||
<dt>An initialized evtable entity, either complete (if using <strong>table</strong> kwarg)</dt><dd><p>or incomplete and ready for use with <strong>.add_row</strong> or <strong>.add_collumn</strong>.</p>
|
||
</dd>
|
||
</dl>
|
||
</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.styled_header">
|
||
<span class="sig-name descname"><span class="pre">styled_header</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_header"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_header" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Create a pretty header.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.styled_separator">
|
||
<span class="sig-name descname"><span class="pre">styled_separator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_separator"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_separator" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Create a separator.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.styled_footer">
|
||
<span class="sig-name descname"><span class="pre">styled_footer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_footer"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_footer" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Create a pretty footer.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.lock_storage">
|
||
<span class="sig-name descname"><span class="pre">lock_storage</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'cmd:all();'</span></em><a class="headerlink" href="#evennia.commands.command.Command.lock_storage" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.save_for_next">
|
||
<span class="sig-name descname"><span class="pre">save_for_next</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">False</span></em><a class="headerlink" href="#evennia.commands.command.Command.save_for_next" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt class="sig sig-object py" id="evennia.commands.command.Command.search_index_entry">
|
||
<span class="sig-name descname"><span class="pre">search_index_entry</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">{'aliases':</span> <span class="pre">'',</span> <span class="pre">'category':</span> <span class="pre">'general',</span> <span class="pre">'key':</span> <span class="pre">'command',</span> <span class="pre">'no_prefix':</span> <span class="pre">'</span> <span class="pre">',</span> <span class="pre">'tags':</span> <span class="pre">'',</span> <span class="pre">'text':</span> <span class="pre">'\n##</span> <span class="pre">Base</span> <span class="pre">command\n\n(you</span> <span class="pre">may</span> <span class="pre">see</span> <span class="pre">this</span> <span class="pre">if</span> <span class="pre">a</span> <span class="pre">child</span> <span class="pre">command</span> <span class="pre">had</span> <span class="pre">no</span> <span class="pre">help</span> <span class="pre">text</span> <span class="pre">defined)\n\nUsage:\n</span>  <span class="pre">command</span> <span class="pre">[args]\n\nThis</span> <span class="pre">is</span> <span class="pre">the</span> <span class="pre">base</span> <span class="pre">command</span> <span class="pre">class.</span> <span class="pre">Inherit</span> <span class="pre">from</span> <span class="pre">this\nto</span> <span class="pre">create</span> <span class="pre">new</span> <span class="pre">commands.\n\nThe</span> <span class="pre">cmdhandler</span> <span class="pre">makes</span> <span class="pre">the</span> <span class="pre">following</span> <span class="pre">variables</span> <span class="pre">available</span> <span class="pre">to</span> <span class="pre">the\ncommand</span> <span class="pre">methods</span> <span class="pre">(so</span> <span class="pre">you</span> <span class="pre">can</span> <span class="pre">always</span> <span class="pre">assume</span> <span class="pre">them</span> <span class="pre">to</span> <span class="pre">be</span> <span class="pre">there):\n\nself.caller</span> <span class="pre">-</span> <span class="pre">the</span> <span class="pre">game</span> <span class="pre">object</span> <span class="pre">calling</span> <span class="pre">the</span> <span class="pre">command\nself.cmdstring</span> <span class="pre">-</span> <span class="pre">the</span> <span class="pre">command</span> <span class="pre">name</span> <span class="pre">used</span> <span class="pre">to</span> <span class="pre">trigger</span> <span class="pre">this</span> <span class="pre">command</span> <span class="pre">(allows\n</span>                 <span class="pre">you</span> <span class="pre">to</span> <span class="pre">know</span> <span class="pre">which</span> <span class="pre">alias</span> <span class="pre">was</span> <span class="pre">used,</span> <span class="pre">for</span> <span class="pre">example)\nself.args</span> <span class="pre">-</span> <span class="pre">everything</span> <span class="pre">supplied</span> <span class="pre">to</span> <span class="pre">the</span> <span class="pre">command</span> <span class="pre">following</span> <span class="pre">the</span> <span class="pre">cmdstring\n</span>           <span class="pre">(this</span> <span class="pre">is</span> <span class="pre">usually</span> <span class="pre">what</span> <span class="pre">is</span> <span class="pre">parsed</span> <span class="pre">in</span> <span class="pre">self.parse())\nself.cmdset</span> <span class="pre">-</span> <span class="pre">the</span> <span class="pre">merged</span> <span class="pre">cmdset</span> <span class="pre">from</span> <span class="pre">which</span> <span class="pre">this</span> <span class="pre">command</span> <span class="pre">was</span> <span class="pre">matched</span> <span class="pre">(useful</span> <span class="pre">only\n</span>              <span class="pre">seldomly,</span> <span class="pre">notably</span> <span class="pre">for</span> <span class="pre">help-type</span> <span class="pre">commands,</span> <span class="pre">to</span> <span class="pre">create</span> <span class="pre">dynamic\n</span>              <span class="pre">help</span> <span class="pre">entries</span> <span class="pre">and</span> <span class="pre">lists)\nself.cmdset_source</span> <span class="pre">-</span> <span class="pre">the</span> <span class="pre">specific</span> <span class="pre">cmdset</span> <span class="pre">this</span> <span class="pre">command</span> <span class="pre">was</span> <span class="pre">matched</span> <span class="pre">from.\nself.obj</span> <span class="pre">-</span> <span class="pre">the</span> <span class="pre">object</span> <span class="pre">on</span> <span class="pre">which</span> <span class="pre">this</span> <span class="pre">command</span> <span class="pre">is</span> <span class="pre">defined.</span> <span class="pre">If</span> <span class="pre">a</span> <span class="pre">default</span> <span class="pre">command,\n</span>           <span class="pre">this</span> <span class="pre">is</span> <span class="pre">usually</span> <span class="pre">the</span> <span class="pre">same</span> <span class="pre">as</span> <span class="pre">caller.\nself.raw_string</span> <span class="pre">-</span> <span class="pre">the</span> <span class="pre">full</span> <span class="pre">raw</span> <span class="pre">string</span> <span class="pre">input,</span> <span class="pre">including</span> <span class="pre">the</span> <span class="pre">command</span> <span class="pre">name,\n</span>                  <span class="pre">any</span> <span class="pre">args</span> <span class="pre">and</span> <span class="pre">no</span> <span class="pre">parsing.\n\nThe</span> <span class="pre">following</span> <span class="pre">class</span> <span class="pre">properties</span> <span class="pre">can/should</span> <span class="pre">be</span> <span class="pre">defined</span> <span class="pre">on</span> <span class="pre">your</span> <span class="pre">child</span> <span class="pre">class:\n\nkey</span> <span class="pre">-</span> <span class="pre">identifier</span> <span class="pre">for</span> <span class="pre">command</span> <span class="pre">(e.g.</span> <span class="pre">"look")\naliases</span> <span class="pre">-</span> <span class="pre">(optional)</span> <span class="pre">list</span> <span class="pre">of</span> <span class="pre">aliases</span> <span class="pre">(e.g.</span> <span class="pre">["l",</span> <span class="pre">"loo"])\nlocks</span> <span class="pre">-</span> <span class="pre">lock</span> <span class="pre">string</span> <span class="pre">(default</span> <span class="pre">is</span> <span class="pre">"cmd:all()")\nhelp_category</span> <span class="pre">-</span> <span class="pre">how</span> <span class="pre">to</span> <span class="pre">organize</span> <span class="pre">this</span> <span class="pre">help</span> <span class="pre">entry</span> <span class="pre">in</span> <span class="pre">help</span> <span class="pre">system\n</span>                <span class="pre">(default</span> <span class="pre">is</span> <span class="pre">"General")\nauto_help</span> <span class="pre">-</span> <span class="pre">defaults</span> <span class="pre">to</span> <span class="pre">True.</span> <span class="pre">Allows</span> <span class="pre">for</span> <span class="pre">turning</span> <span class="pre">off</span> <span class="pre">auto-help</span> <span class="pre">generation\narg_regex</span> <span class="pre">-</span> <span class="pre">(optional)</span> <span class="pre">raw</span> <span class="pre">string</span> <span class="pre">regex</span> <span class="pre">defining</span> <span class="pre">how</span> <span class="pre">the</span> <span class="pre">argument</span> <span class="pre">part</span> <span class="pre">of\n</span>            <span class="pre">the</span> <span class="pre">command</span> <span class="pre">should</span> <span class="pre">look</span> <span class="pre">in</span> <span class="pre">order</span> <span class="pre">to</span> <span class="pre">match</span> <span class="pre">for</span> <span class="pre">this</span> <span class="pre">command\n</span>            <span class="pre">(e.g.</span> <span class="pre">must</span> <span class="pre">it</span> <span class="pre">be</span> <span class="pre">a</span> <span class="pre">space</span> <span class="pre">between</span> <span class="pre">cmdname</span> <span class="pre">and</span> <span class="pre">arg?)\nauto_help_display_key</span> <span class="pre">-</span> <span class="pre">(optional)</span> <span class="pre">if</span> <span class="pre">given,</span> <span class="pre">this</span> <span class="pre">replaces</span> <span class="pre">the</span> <span class="pre">string</span> <span class="pre">shown\n</span>    <span class="pre">in</span> <span class="pre">the</span> <span class="pre">auto-help</span> <span class="pre">listing.</span> <span class="pre">This</span> <span class="pre">is</span> <span class="pre">particularly</span> <span class="pre">useful</span> <span class="pre">for</span> <span class="pre">system-commands\n</span>    <span class="pre">whose</span> <span class="pre">actual</span> <span class="pre">key</span> <span class="pre">is</span> <span class="pre">not</span> <span class="pre">really</span> <span class="pre">meaningful.\n\n(Note</span> <span class="pre">that</span> <span class="pre">if</span> <span class="pre">auto_help</span> <span class="pre">is</span> <span class="pre">on,</span> <span class="pre">this</span> <span class="pre">initial</span> <span class="pre">string</span> <span class="pre">is</span> <span class="pre">also</span> <span class="pre">used</span> <span class="pre">by</span> <span class="pre">the\nsystem</span> <span class="pre">to</span> <span class="pre">create</span> <span class="pre">the</span> <span class="pre">help</span> <span class="pre">entry</span> <span class="pre">for</span> <span class="pre">the</span> <span class="pre">command,</span> <span class="pre">so</span> <span class="pre">it\'s</span> <span class="pre">a</span> <span class="pre">good</span> <span class="pre">idea</span> <span class="pre">to\nformat</span> <span class="pre">it</span> <span class="pre">similar</span> <span class="pre">to</span> <span class="pre">this</span> <span class="pre">one).</span>  <span class="pre">This</span> <span class="pre">behavior</span> <span class="pre">can</span> <span class="pre">be</span> <span class="pre">changed</span> <span class="pre">by\noverriding</span> <span class="pre">the</span> <span class="pre">method</span> <span class="pre">\'get_help\'</span> <span class="pre">of</span> <span class="pre">a</span> <span class="pre">command:</span> <span class="pre">by</span> <span class="pre">default,</span> <span class="pre">this\nmethod</span> <span class="pre">returns</span> <span class="pre">cmd.__doc__</span> <span class="pre">(that</span> <span class="pre">is,</span> <span class="pre">this</span> <span class="pre">very</span> <span class="pre">docstring,</span> <span class="pre">or\nthe</span> <span class="pre">docstring</span> <span class="pre">of</span> <span class="pre">your</span> <span class="pre">command).</span>  <span class="pre">You</span> <span class="pre">can,</span> <span class="pre">however,</span> <span class="pre">extend</span> <span class="pre">or\nreplace</span> <span class="pre">this</span> <span class="pre">without</span> <span class="pre">disabling</span> <span class="pre">auto_help.\n'}</span></em><a class="headerlink" href="#evennia.commands.command.Command.search_index_entry" title="Link to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</section>
|
||
</dd></dl>
|
||
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo of Evennia"/>
|
||
</a></p>
|
||
<search id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</search>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script>
|
||
<h3><a href="../index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">evennia.commands.command</a><ul>
|
||
<li><a class="reference internal" href="#evennia.commands.command.InterruptCommand"><code class="docutils literal notranslate"><span class="pre">InterruptCommand</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.CommandMeta"><code class="docutils literal notranslate"><span class="pre">CommandMeta</span></code></a><ul>
|
||
<li><a class="reference internal" href="#evennia.commands.command.CommandMeta.__init__"><code class="docutils literal notranslate"><span class="pre">CommandMeta.__init__()</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command"><code class="docutils literal notranslate"><span class="pre">Command</span></code></a><ul>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.key"><code class="docutils literal notranslate"><span class="pre">Command.key</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.aliases"><code class="docutils literal notranslate"><span class="pre">Command.aliases</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.locks"><code class="docutils literal notranslate"><span class="pre">Command.locks</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.help_category"><code class="docutils literal notranslate"><span class="pre">Command.help_category</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.auto_help"><code class="docutils literal notranslate"><span class="pre">Command.auto_help</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.is_exit"><code class="docutils literal notranslate"><span class="pre">Command.is_exit</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.arg_regex"><code class="docutils literal notranslate"><span class="pre">Command.arg_regex</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.msg_all_sessions"><code class="docutils literal notranslate"><span class="pre">Command.msg_all_sessions</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.retain_instance"><code class="docutils literal notranslate"><span class="pre">Command.retain_instance</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.__init__"><code class="docutils literal notranslate"><span class="pre">Command.__init__()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.lockhandler"><code class="docutils literal notranslate"><span class="pre">Command.lockhandler</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.set_key"><code class="docutils literal notranslate"><span class="pre">Command.set_key()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.set_aliases"><code class="docutils literal notranslate"><span class="pre">Command.set_aliases()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.match"><code class="docutils literal notranslate"><span class="pre">Command.match()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.access"><code class="docutils literal notranslate"><span class="pre">Command.access()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.msg"><code class="docutils literal notranslate"><span class="pre">Command.msg()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.execute_cmd"><code class="docutils literal notranslate"><span class="pre">Command.execute_cmd()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.at_pre_cmd"><code class="docutils literal notranslate"><span class="pre">Command.at_pre_cmd()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.at_post_cmd"><code class="docutils literal notranslate"><span class="pre">Command.at_post_cmd()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.parse"><code class="docutils literal notranslate"><span class="pre">Command.parse()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.get_command_info"><code class="docutils literal notranslate"><span class="pre">Command.get_command_info()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.func"><code class="docutils literal notranslate"><span class="pre">Command.func()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.get_extra_info"><code class="docutils literal notranslate"><span class="pre">Command.get_extra_info()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.get_help"><code class="docutils literal notranslate"><span class="pre">Command.get_help()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.web_get_detail_url"><code class="docutils literal notranslate"><span class="pre">Command.web_get_detail_url()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.web_get_admin_url"><code class="docutils literal notranslate"><span class="pre">Command.web_get_admin_url()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.client_width"><code class="docutils literal notranslate"><span class="pre">Command.client_width()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.styled_table"><code class="docutils literal notranslate"><span class="pre">Command.styled_table()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.styled_header"><code class="docutils literal notranslate"><span class="pre">Command.styled_header()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.styled_separator"><code class="docutils literal notranslate"><span class="pre">Command.styled_separator()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.styled_footer"><code class="docutils literal notranslate"><span class="pre">Command.styled_footer()</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.lock_storage"><code class="docutils literal notranslate"><span class="pre">Command.lock_storage</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.save_for_next"><code class="docutils literal notranslate"><span class="pre">Command.save_for_next</span></code></a></li>
|
||
<li><a class="reference internal" href="#evennia.commands.command.Command.search_index_entry"><code class="docutils literal notranslate"><span class="pre">Command.search_index_entry</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="evennia.commands.cmdsethandler.html"
|
||
title="previous chapter">evennia.commands.cmdsethandler</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="evennia.commands.default.html"
|
||
title="next chapter">evennia.commands.default</a></p>
|
||
</div>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/api/evennia.commands.command.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
|
||
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li>
|
||
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
|
||
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
|
||
<a href="https://evennia.blogspot.com/">Blog</a>
|
||
</li>
|
||
</ul>
|
||
<h3>Doc Versions</h3>
|
||
<ul>
|
||
|
||
<li>
|
||
<a href="https://www.evennia.com/docs/latest/index.html">latest (main branch)</a>
|
||
</li>
|
||
|
||
|
||
<li>
|
||
<a href="https://www.evennia.com/docs/5.x/index.html">v5.0.0 branch (outdated)</a>
|
||
</li>
|
||
|
||
<li>
|
||
<a href="https://www.evennia.com/docs/4.x/index.html">v4.0.0 branch (outdated)</a>
|
||
</li>
|
||
|
||
<li>
|
||
<a href="https://www.evennia.com/docs/3.x/index.html">v3.0.0 branch (outdated)</a>
|
||
</li>
|
||
|
||
<li>
|
||
<a href="https://www.evennia.com/docs/2.x/index.html">v2.0.0 branch (outdated)</a>
|
||
</li>
|
||
|
||
<li>
|
||
<a href="https://www.evennia.com/docs/1.x/index.html">v1.0.0 branch (outdated)</a>
|
||
</li>
|
||
|
||
<li>
|
||
<a href="https://www.evennia.com/docs/0.x/index.html">v0.9.5 branch (outdated)</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.commands.default.html" title="evennia.commands.default"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="evennia.commands.cmdsethandler.html" title="evennia.commands.cmdsethandler"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> »</li>
|
||
<li class="nav-item nav-item-4"><a href="evennia.commands.html" >evennia.commands</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.commands.command</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2024, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
||
</div>
|
||
</body>
|
||
</html> |