mirror of
https://github.com/evennia/evennia.git
synced 2026-03-18 13:56:30 +01:00
520 lines
No EOL
34 KiB
HTML
520 lines
No EOL
34 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>evennia.commands.command — Evennia 0.9.5 documentation</title>
|
||
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/jquery.js"></script>
|
||
<script src="../_static/underscore.js"></script>
|
||
<script src="../_static/doctools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"processClass": "tex2jax_process|mathjax_process|math|output_area"}})</script>
|
||
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
</head><body>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<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="nav-item nav-item-0"><a href="../index.html">Evennia 0.9.5</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="Permalink to this headline">¶</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 class">
|
||
<dt id="evennia.commands.command.CommandMeta">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.command.</code><code class="sig-name descname">CommandMeta</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#CommandMeta"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.CommandMeta" title="Permalink 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 id="evennia.commands.command.CommandMeta.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#CommandMeta.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.CommandMeta.__init__" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Initialize self. See help(type(self)) for accurate signature.</p>
|
||
</dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py class">
|
||
<dt id="evennia.commands.command.Command">
|
||
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.command.</code><code class="sig-name descname">Command</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||
<p>Base command</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):
|
||
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>cmd.args - everything supplied to the command following the cmdstring</dt><dd><p>(this is usually what is parsed in self.parse())</p>
|
||
</dd>
|
||
<dt>cmd.cmdset - the 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>
|
||
<dt>cmd.obj - the object on which this command is defined. If a default command,</dt><dd><p>this is usually the same as caller.</p>
|
||
</dd>
|
||
</dl>
|
||
<p>cmd.rawstring - the full raw string input, including any args and no parsing.</p>
|
||
<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 id="evennia.commands.command.Command.key">
|
||
<code class="sig-name descname">key</code><em class="property"> = 'command'</em><a class="headerlink" href="#evennia.commands.command.Command.key" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.aliases">
|
||
<code class="sig-name descname">aliases</code><em class="property"> = []</em><a class="headerlink" href="#evennia.commands.command.Command.aliases" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.locks">
|
||
<code class="sig-name descname">locks</code><em class="property"> = 'cmd:all();'</em><a class="headerlink" href="#evennia.commands.command.Command.locks" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.help_category">
|
||
<code class="sig-name descname">help_category</code><em class="property"> = 'general'</em><a class="headerlink" href="#evennia.commands.command.Command.help_category" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.auto_help">
|
||
<code class="sig-name descname">auto_help</code><em class="property"> = True</em><a class="headerlink" href="#evennia.commands.command.Command.auto_help" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.is_exit">
|
||
<code class="sig-name descname">is_exit</code><em class="property"> = False</em><a class="headerlink" href="#evennia.commands.command.Command.is_exit" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.arg_regex">
|
||
<code class="sig-name descname">arg_regex</code><em class="property"> = None</em><a class="headerlink" href="#evennia.commands.command.Command.arg_regex" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.msg_all_sessions">
|
||
<code class="sig-name descname">msg_all_sessions</code><em class="property"> = False</em><a class="headerlink" href="#evennia.commands.command.Command.msg_all_sessions" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.commands.command.Command.__init__">
|
||
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.__init__" title="Permalink 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 id="evennia.commands.command.Command.lockhandler">
|
||
<code class="sig-name descname">lockhandler</code><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.lockhandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.lockhandler" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.commands.command.Command.set_key">
|
||
<code class="sig-name descname">set_key</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">new_key</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.set_key"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.set_key" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Update key.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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 id="evennia.commands.command.Command.set_aliases">
|
||
<code class="sig-name descname">set_aliases</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">new_aliases</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.set_aliases"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.set_aliases" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Replace aliases with new ones.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Parameters</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 id="evennia.commands.command.Command.match">
|
||
<code class="sig-name descname">match</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">cmdname</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.match"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.match" title="Permalink 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</dt>
|
||
<dd class="field-odd"><p><strong>cmdname</strong> (<em>str</em>) – Always lowercase when reaching this point.</p>
|
||
</dd>
|
||
<dt class="field-even">Returns</dt>
|
||
<dd class="field-even"><p><em>result (bool)</em> – Match result.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.commands.command.Command.access">
|
||
<code class="sig-name descname">access</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">srcobj</span></em>, <em class="sig-param"><span class="n">access_type</span><span class="o">=</span><span class="default_value">'cmd'</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.access"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.access" title="Permalink 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</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 id="evennia.commands.command.Command.msg">
|
||
<code class="sig-name descname">msg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">text</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">to_obj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">from_obj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">session</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.msg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.msg" title="Permalink 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</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</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 id="evennia.commands.command.Command.execute_cmd">
|
||
<code class="sig-name descname">execute_cmd</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_string</span></em>, <em class="sig-param"><span class="n">session</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">obj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.execute_cmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.execute_cmd" title="Permalink 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</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</dt>
|
||
<dd class="field-even"><ul class="simple">
|
||
<li><p><strong>keyword arguments will be added to the found command</strong> (<em>Other</em>) – </p></li>
|
||
<li><p><strong>instace as variables before it executes. This is</strong> (<a class="reference internal" href="evennia.scripts.models.html#evennia.scripts.models.ScriptDB.object" title="evennia.scripts.models.ScriptDB.object"><em>object</em></a>) – </p></li>
|
||
<li><p><strong>by default Evennia but may be used to set flags and</strong> (<em>unused</em>) – </p></li>
|
||
<li><p><strong>operating paramaters for commands at run-time.</strong> (<em>change</em>) – </p></li>
|
||
</ul>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.commands.command.Command.at_pre_cmd">
|
||
<code class="sig-name descname">at_pre_cmd</code><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">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.at_pre_cmd" title="Permalink 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 id="evennia.commands.command.Command.at_post_cmd">
|
||
<code class="sig-name descname">at_post_cmd</code><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">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.at_post_cmd" title="Permalink 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 id="evennia.commands.command.Command.parse">
|
||
<code class="sig-name descname">parse</code><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">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.parse" title="Permalink 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 id="evennia.commands.command.Command.get_command_info">
|
||
<code class="sig-name descname">get_command_info</code><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">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.get_command_info" title="Permalink 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 id="evennia.commands.command.Command.func">
|
||
<code class="sig-name descname">func</code><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">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.func" title="Permalink 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 id="evennia.commands.command.Command.get_extra_info">
|
||
<code class="sig-name descname">get_extra_info</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">caller</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</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">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.get_extra_info" title="Permalink 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</dt>
|
||
<dd class="field-odd"><ul class="simple">
|
||
<li><p><strong>caller</strong> (<a class="reference internal" href="evennia.typeclasses.models.html#evennia.typeclasses.models.TypedObject" title="evennia.typeclasses.models.TypedObject"><em>TypedObject</em></a>) – The caller who typed an ambiguous</p></li>
|
||
<li><p><strong>handed to the search function.</strong> (<em>term</em>) – </p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</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 id="evennia.commands.command.Command.get_help">
|
||
<code class="sig-name descname">get_help</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">caller</span></em>, <em class="sig-param"><span class="n">cmdset</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.get_help"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.get_help" title="Permalink 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</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.cmdset.html#evennia.commands.cmdset.CmdSet" title="evennia.commands.cmdset.CmdSet"><em>CmdSet</em></a>) – the command set (if you need additional commands).</p></li>
|
||
</ul>
|
||
</dd>
|
||
<dt class="field-even">Returns</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 id="evennia.commands.command.Command.client_width">
|
||
<code class="sig-name descname">client_width</code><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">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.client_width" title="Permalink 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</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 id="evennia.commands.command.Command.client_height">
|
||
<code class="sig-name descname">client_height</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.client_height"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.client_height" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Get the client screenheight for the session using this command.</p>
|
||
<dl class="field-list simple">
|
||
<dt class="field-odd">Returns</dt>
|
||
<dd class="field-odd"><p><em>client height (int)</em> – The height (in characters) of the client window.</p>
|
||
</dd>
|
||
</dl>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.commands.command.Command.styled_table">
|
||
<code class="sig-name descname">styled_table</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_table"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_table" title="Permalink 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</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</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</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 id="evennia.commands.command.Command.styled_header">
|
||
<code class="sig-name descname">styled_header</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_header"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_header" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Create a pretty header.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.commands.command.Command.styled_separator">
|
||
<code class="sig-name descname">styled_separator</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_separator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_separator" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Create a separator.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py method">
|
||
<dt id="evennia.commands.command.Command.styled_footer">
|
||
<code class="sig-name descname">styled_footer</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/command.html#Command.styled_footer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.Command.styled_footer" title="Permalink to this definition">¶</a></dt>
|
||
<dd><p>Create a pretty footer.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.lock_storage">
|
||
<code class="sig-name descname">lock_storage</code><em class="property"> = 'cmd:all();'</em><a class="headerlink" href="#evennia.commands.command.Command.lock_storage" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
<dl class="py attribute">
|
||
<dt id="evennia.commands.command.Command.save_for_next">
|
||
<code class="sig-name descname">save_for_next</code><em class="property"> = False</em><a class="headerlink" href="#evennia.commands.command.Command.save_for_next" title="Permalink to this definition">¶</a></dt>
|
||
<dd></dd></dl>
|
||
|
||
</dd></dl>
|
||
|
||
<dl class="py exception">
|
||
<dt id="evennia.commands.command.InterruptCommand">
|
||
<em class="property">exception </em><code class="sig-prename descclassname">evennia.commands.command.</code><code class="sig-name descname">InterruptCommand</code><a class="reference internal" href="../_modules/evennia/commands/command.html#InterruptCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.command.InterruptCommand" title="Permalink 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>
|
||
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<p class="logo"><a href="../index.html">
|
||
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
|
||
</a></p>
|
||
<div 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" />
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>$('#searchbox').show(0);</script>
|
||
<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">Home page</a> </li>
|
||
<li><a href="https://github.com/evennia/evennia">Evennia Github</a> </li>
|
||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||
<li><a href="http://webchat.freenode.net/?channels=evennia&uio=MT1mYWxzZSY5PXRydWUmMTE9MTk1JjEyPXRydWUbb">IRC</a> -
|
||
<a href="https://discord.gg/NecFePw">Discord</a> -
|
||
<a href="https://groups.google.com/forum/#%21forum/evennia">Forums</a>
|
||
</li>
|
||
<li><a href="http://evennia.blogspot.com/">Evennia Dev blog</a> </li>
|
||
</ul>
|
||
<h3>Versions</h3>
|
||
<ul>
|
||
<li><a href="../../1.0-dev/api/evennia.commands.command.html">1.0-dev (develop branch)</a></li>
|
||
<li><a href="evennia.commands.command.html">0.9.5 (v0.9.5 branch)</a></li>
|
||
</ul>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="related navigation">
|
||
<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="nav-item nav-item-0"><a href="../index.html">Evennia 0.9.5</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">evennia.commands.command</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2020, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |