/usr/share/doc/renpy/html/uds.html is in renpy-doc 6.17.6-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Creator-Defined Statements — Ren'Py Documentation</title>
<link rel="stylesheet" href="_static/screen.css" type="text/css" media="screen, projection"/>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="print" />
<!--[if lt IE 8]>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="screen, projection"/>
<![endif]-->
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '6.16.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Ren'Py Documentation" href="index.html" />
<link rel="next" title="Creator-Defined Displayables" href="udd.html" />
<link rel="prev" title="Modes" href="modes.html" />
</head>
<body>
<div class="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="udd.html" title="Creator-Defined Displayables"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="modes.html" title="Modes"
accesskey="P">previous</a> |</li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
<div class="container">
<div class="span4">
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Creator-Defined Statements</a><ul>
<li><a class="reference internal" href="#lint-utility-functions">Lint Utility Functions</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="modes.html"
title="previous chapter">Modes</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="udd.html"
title="next chapter">Creator-Defined Displayables</a></p>
<h4>Search</h4>
<div id="cse-search-form" style="width: 100%;"></div>
<div class="copydata">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
<br>
</div>
</div>
</div>
</div>
<div class="document span20 last">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="creator-defined-statements">
<h1>Creator-Defined Statements<a class="headerlink" href="#creator-defined-statements" title="Permalink to this headline">¶</a></h1>
<p>Creator-defined statements allow you to add your own statements to Ren'Py. This
makes it possible to add things that are not supported by the current syntax of
Ren'Py. creator-defined statements are currently limited to a single line, and may
not contain blocks.</p>
<p>Creator-defined statements must be defined in a python early block. What's more,
the filename containing the user-defined statement must be be loaded earlier
than any file that uses it. Since Ren'Py loads files in unicode sort order, it
generally makes sense to prefix the name of any file containing a user-defined
statement with 00. A user-defined statement cannot be used in the file in which
it is defined.</p>
<div class="section" id="lint-utility-functions">
<h2>Lint Utility Functions<a class="headerlink" href="#lint-utility-functions" title="Permalink to this headline">¶</a></h2>
<p>These functions are useful in writing lint functions.</p>
<p>The creates a new statement "line" that allows lines of text to be specified
without quotes.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">python</span> <span class="n">early</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">parse_smartline</span><span class="p">(</span><span class="n">lex</span><span class="p">):</span>
<span class="n">who</span> <span class="o">=</span> <span class="n">lex</span><span class="o">.</span><span class="n">simple_expression</span><span class="p">()</span>
<span class="n">what</span> <span class="o">=</span> <span class="n">lex</span><span class="o">.</span><span class="n">rest</span><span class="p">()</span>
<span class="k">return</span> <span class="p">(</span><span class="n">who</span><span class="p">,</span> <span class="n">what</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">execute_smartline</span><span class="p">(</span><span class="n">o</span><span class="p">):</span>
<span class="n">who</span><span class="p">,</span> <span class="n">what</span> <span class="o">=</span> <span class="n">o</span>
<span class="n">renpy</span><span class="o">.</span><span class="n">say</span><span class="p">(</span><span class="n">who</span><span class="p">,</span> <span class="n">what</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">lint_smartline</span><span class="p">(</span><span class="n">o</span><span class="p">):</span>
<span class="n">who</span><span class="p">,</span> <span class="n">what</span> <span class="o">=</span> <span class="n">o</span>
<span class="k">try</span><span class="p">:</span>
<span class="nb">eval</span><span class="p">(</span><span class="n">who</span><span class="p">)</span>
<span class="k">except</span><span class="p">:</span>
<span class="n">renpy</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"Character not defined: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="n">who</span><span class="p">)</span>
<span class="n">tte</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="k">text</span><span class="o">.</span><span class="n">extras</span><span class="o">.</span><span class="n">check_text_tags</span><span class="p">(</span><span class="n">what</span><span class="p">)</span>
<span class="k">if</span> <span class="n">tte</span><span class="p">:</span>
<span class="n">renpy</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">tte</span><span class="p">)</span>
<span class="n">renpy</span><span class="o">.</span><span class="n">statements</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="s">"line"</span><span class="p">,</span> <span class="n">parse</span><span class="o">=</span><span class="n">parse_smartline</span><span class="p">,</span> <span class="n">execute</span><span class="o">=</span><span class="n">execute_smartline</span><span class="p">,</span> <span class="n">lint</span><span class="o">=</span><span class="n">lint_smartline</span><span class="p">)</span>
</pre></div>
</div>
<p>This is used like</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">line</span> <span class="n">e</span> <span class="s">"These quotes will show up,"</span> <span class="n">Eileen</span> <span class="n">said</span><span class="p">,</span> <span class="s">"and don't need to be backslashed."</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="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="udd.html" title="Creator-Defined Displayables"
>next</a> |</li>
<li class="right" >
<a href="modes.html" title="Modes"
>previous</a> |</li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
</body>
</html>
|