evennia/docs/0.x/api/evennia.contrib.tutorial_examples.red_button.html
2023-12-20 19:10:09 +01:00

211 lines
No EOL
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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.contrib.tutorial_examples.red_button &#8212; 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> &#187;</li>
<li class="nav-item nav-item-this"><a href="">evennia.contrib.tutorial_examples.red_button</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="module-evennia.contrib.tutorial_examples.red_button">
<span id="evennia-contrib-tutorial-examples-red-button"></span><h1>evennia.contrib.tutorial_examples.red_button<a class="headerlink" href="#module-evennia.contrib.tutorial_examples.red_button" title="Permalink to this headline"></a></h1>
<p>This is a more advanced example object. It combines functions from
script.examples as well as commands.examples to make an interactive
button typeclass.</p>
<p>Create this button with</p>
<blockquote>
<div><p>&#64;create/drop examples.red_button.RedButton</p>
</div></blockquote>
<p>Note that you must drop the button before you can see its messages!</p>
<dl class="py class">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.tutorial_examples.red_button.</code><code class="sig-name descname">RedButton</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/contrib/tutorial_examples/red_button.html#RedButton"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.objects.objects.html#evennia.objects.objects.DefaultObject" title="evennia.objects.objects.DefaultObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.objects.DefaultObject</span></code></a></p>
<p>This class describes an evil red button. It will use the script
definition in contrib/examples/red_button_scripts to blink at regular
intervals. It also uses a series of script and commands to handle
pushing the button and causing effects when doing so.</p>
<dl class="simple">
<dt>The following attributes can be set on the button:</dt><dd><p>desc_lid_open - description when lid is open
desc_lid_closed - description when lid is closed
desc_lamp_broken - description when lamp is broken</p>
</dd>
</dl>
<dl class="py method">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.at_object_creation">
<code class="sig-name descname">at_object_creation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorial_examples/red_button.html#RedButton.at_object_creation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.at_object_creation" title="Permalink to this definition"></a></dt>
<dd><p>This function is called when object is created. Use this
instead of e.g. __init__.</p>
</dd></dl>
<dl class="py method">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.open_lid">
<code class="sig-name descname">open_lid</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorial_examples/red_button.html#RedButton.open_lid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.open_lid" title="Permalink to this definition"></a></dt>
<dd><p>Opens the glass lid and start the timer so it will soon close
again.</p>
</dd></dl>
<dl class="py method">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.close_lid">
<code class="sig-name descname">close_lid</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorial_examples/red_button.html#RedButton.close_lid"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.close_lid" title="Permalink to this definition"></a></dt>
<dd><p>Close the glass lid. This validates all scripts on the button,
which means that scripts only being valid when the lid is open
will go away automatically.</p>
</dd></dl>
<dl class="py method">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.break_lamp">
<code class="sig-name descname">break_lamp</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">feedback</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorial_examples/red_button.html#RedButton.break_lamp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.break_lamp" title="Permalink to this definition"></a></dt>
<dd><p>Breaks the lamp in the button, stopping it from blinking.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>feedback</strong> (<em>bool</em>) Show a message about breaking the lamp.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.press_button">
<code class="sig-name descname">press_button</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">pobject</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorial_examples/red_button.html#RedButton.press_button"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.press_button" title="Permalink to this definition"></a></dt>
<dd><p>Someone was foolish enough to press the button!</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>pobject</strong> (<em>Object</em>) The person pressing the button</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.blink">
<code class="sig-name descname">blink</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorial_examples/red_button.html#RedButton.blink"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.blink" title="Permalink to this definition"></a></dt>
<dd><p>The script system will regularly call this
function to make the button blink. Now and then
it wont blink at all though, to add some randomness
to how often the message is echoed.</p>
</dd></dl>
<dl class="py exception">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.DoesNotExist">
<em class="property">exception </em><code class="sig-name descname">DoesNotExist</code><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.DoesNotExist" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.objects.objects.html#evennia.objects.objects.DefaultObject.DoesNotExist" title="evennia.objects.objects.DefaultObject.DoesNotExist"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.objects.DefaultObject.DoesNotExist</span></code></a></p>
</dd></dl>
<dl class="py exception">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.MultipleObjectsReturned">
<em class="property">exception </em><code class="sig-name descname">MultipleObjectsReturned</code><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.MultipleObjectsReturned" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.objects.objects.html#evennia.objects.objects.DefaultObject.MultipleObjectsReturned" title="evennia.objects.objects.DefaultObject.MultipleObjectsReturned"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.objects.DefaultObject.MultipleObjectsReturned</span></code></a></p>
</dd></dl>
<dl class="py attribute">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.path">
<code class="sig-name descname">path</code><em class="property"> = 'evennia.contrib.tutorial_examples.red_button.RedButton'</em><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt id="evennia.contrib.tutorial_examples.red_button.RedButton.typename">
<code class="sig-name descname">typename</code><em class="property"> = 'RedButton'</em><a class="headerlink" href="#evennia.contrib.tutorial_examples.red_button.RedButton.typename" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</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.contrib.tutorial_examples.red_button.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/index.html">1.0-dev (develop branch)</a></li>
<li><a href="evennia.contrib.tutorial_examples.red_button.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> &#187;</li>
<li class="nav-item nav-item-this"><a href="">evennia.contrib.tutorial_examples.red_button</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, The Evennia developer community.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
</body>
</html>