evennia/docs/2.x/Concepts/Inline-Functions.html
Evennia docbuilder action e535f5782a Updated HTML docs.
2023-10-19 20:22:27 +00:00

168 lines
No EOL
7.9 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>Inline functions &#8212; Evennia 2.x 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>
<link rel="shortcut 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="Messages varying per receiver" href="Change-Message-Per-Receiver.html" />
<link rel="prev" title="Clickable links" href="Clickable-Links.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="right" >
<a href="Change-Message-Per-Receiver.html" title="Messages varying per receiver"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="Clickable-Links.html" title="Clickable links"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="Concepts-Overview.html" >Core Concepts</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="Tags-Parsed-By-Evennia.html" accesskey="U">In-text tags parsed by Evennia</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Inline functions</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<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>
<h4>Previous topic</h4>
<p class="topless"><a href="Clickable-Links.html"
title="previous chapter">Clickable links</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="Change-Message-Per-Receiver.html"
title="next chapter">Messages varying per receiver</a></p>
<div role="note" aria-label="source link">
<!--h3>This Page</h3-->
<ul class="this-page-menu">
<li><a href="../_sources/Concepts/Inline-Functions.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="Inline-Functions.html">2.x (main branch)</a></li>
<ul>
<li><a href="../1.3.0/index.html">1.3.0 (v1.3.0 branch)</a></li>
<li><a href="../0.9.5/index.html">0.9.5 (v0.9.5 branch)</a></li>
</ul>
</div>
</div>
<div class="bodywrapper">
<div class="body" role="main">
<section class="tex2jax_ignore mathjax_ignore" id="inline-functions">
<h1>Inline functions<a class="headerlink" href="#inline-functions" title="Permalink to this headline"></a></h1>
<aside class="sidebar">
<p>For much more information about inline functions, see the <a class="reference internal" href="../Components/FuncParser.html"><span class="doc std std-doc">FuncParser</span></a> documentation</p>
</aside>
<p><em>Inline functions</em>, also known as <em>funcparser functions</em> are embedded strings on the form</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$funcname(args, kwargs)
</pre></div>
</div>
<p>For example</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&gt; say the answer is $eval(24 * 12)!
You say, &quot;the answer is 288!&quot;
</pre></div>
</div>
<p>General processing of outgoing strings is disabled by default. To activate inline-function parsing of outgoing strings, add this to your settings file:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>FUNCPARSER_PARSE_OUTGOING_MESSAGES_ENABLED=True
</pre></div>
</div>
<p>Inline functions are provided by the <a class="reference internal" href="../Components/FuncParser.html"><span class="doc std std-doc">FuncParser</span></a>. It is enabled in a few other situations:</p>
<ul class="simple">
<li><p>Processing of <a class="reference internal" href="../Components/Prototypes.html"><span class="doc std std-doc">Prototypes</span></a>; these prototypefuncs allow for prototypes whose values change dynamically upon spawning. For example, you would set <code class="docutils literal notranslate"><span class="pre">{key:</span> <span class="pre">'$choice([&quot;Bo&quot;,</span> <span class="pre">&quot;Anne&quot;,</span> <span class="pre">&quot;Tom&quot;])'</span></code> and spawn a random-named character every time.</p></li>
<li><p>Processing of strings to the <code class="docutils literal notranslate"><span class="pre">msg_contents</span></code> method. This allows for <a class="reference internal" href="Change-Message-Per-Receiver.html"><span class="doc std std-doc">sending different messages depending on who will see them</span></a>.</p></li>
</ul>
</section>
</div>
</div>
</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="right" >
<a href="Change-Message-Per-Receiver.html" title="Messages varying per receiver"
>next</a> |</li>
<li class="right" >
<a href="Clickable-Links.html" title="Clickable links"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="Concepts-Overview.html" >Core Concepts</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="Tags-Parsed-By-Evennia.html" >In-text tags parsed by Evennia</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Inline functions</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2023, The Evennia developer community.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
</body>
</html>