/usr/share/doc/renpy/html/modes.html is in renpy-doc 6.15.7-1ubuntu1.
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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Modes — 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.15.6',
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="Screens and Python" href="screen_python.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="screen_python.html" title="Screens and Python"
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="#">Modes</a><ul>
<li><a class="reference internal" href="#default-modes">Default Modes</a></li>
<li><a class="reference internal" href="#mode-callbacks">Mode Callbacks</a><ul>
<li><a class="reference internal" href="#example-mode-callbacks">Example Mode Callbacks</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="screen_python.html"
title="previous chapter">Screens and Python</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="modes">
<span id="id1"></span><h1>Modes<a class="headerlink" href="#modes" title="Permalink to this headline">¶</a></h1>
<p>In Ren'Py, a mode is a concise way of describing the type of an
interaction. When a mode is reported to Ren'Py, user-defined callbacks
can be run. These calbacks can be used to react to a change in mode,
perhaps by reconfiguring the user interface. For example, one can
cause a transition to occur when switching from ADV-mode to NVL-mode,
or when going to a menu, etc.</p>
<p>The goal of the mode systems is to provide a powerful and flexible
way of detecting and responding to these changes.</p>
<div class="section" id="default-modes">
<h2>Default Modes<a class="headerlink" href="#default-modes" title="Permalink to this headline">¶</a></h2>
<p>The following are the modes corresponding to built-in interactions:</p>
<dl class="docutils">
<dt>start</dt>
<dd>This is the mode that Ren'Py is in when a new context is
created, such as at the start of a game. Ren'Py never
automatically enters this mode, but instead, initializes the list
of modes to include start.</dd>
<dt>say</dt>
<dd>The mode Ren'Py enters when an ADV-mode say executes.</dd>
<dt>menu</dt>
<dd>The mode Ren'Py enters when an ADV-mode menu executes.</dd>
<dt>nvl</dt>
<dd>The mode Ren'Py enters when an NVL-mode say executes.</dd>
<dt>nvl_menu</dt>
<dd>The mode Ren'Py enters when an NVL-mode menu executes.</dd>
<dt>pause</dt>
<dd>The mode Ren'Py enters when <tt class="xref py py-func docutils literal"><span class="pre">renpy.pause()</span></tt> is run. This is
also the mode Ren'Py is in when a <tt class="docutils literal"><span class="pre">pause</span></tt> statement of indefinite
duration occurs.</dd>
<dt>with</dt>
<dd><p class="first">The mode Ren'Py enters when a transition introduced by the <tt class="docutils literal"><span class="pre">with</span></tt>
statement occurs. This is also used for <tt class="docutils literal"><span class="pre">pause</span></tt> statement with
a duration specified.</p>
<p class="last">Note that the with mode is entered at the start of the with
statement, which is after any preceding scene, show, or hide
statements have been run.</p>
</dd>
<dt>screen</dt>
<dd>The mode Ren'Py enters when a screen is invoked using the <tt class="docutils literal"><span class="pre">call</span>
<span class="pre">screen</span></tt> statement.</dd>
<dt>imagemap</dt>
<dd>The mode Ren'Py enters when an old-style imagemap is invoked using
<tt class="xref py py-func docutils literal"><span class="pre">renpy.imagemap()</span></tt>.</dd>
<dt>input</dt>
<dd>The mode Ren'Py enters when text input is requested using the
<a class="reference internal" href="input.html#renpy.input" title="renpy.input"><tt class="xref py py-func docutils literal"><span class="pre">renpy.input()</span></tt></a> function.</dd>
</dl>
<p>Other modes can be entered by calling the renpy.mode function.</p>
<dl class="function">
<dt id="renpy.mode">
<tt class="descclassname">renpy.</tt><tt class="descname">mode</tt><big>(</big><em>mode</em><big>)</big><a class="headerlink" href="#renpy.mode" title="Permalink to this definition">¶</a></dt>
<dd><p>Causes Ren'Py to enter the named mode, or stay in that mode if it's
already in it.</p>
</dd></dl>
</div>
<div class="section" id="mode-callbacks">
<h2>Mode Callbacks<a class="headerlink" href="#mode-callbacks" title="Permalink to this headline">¶</a></h2>
<p>The <a class="reference internal" href="config.html#var-config.mode_callbacks"><tt class="xref std std-var docutils literal"><span class="pre">config.mode_callbacks</span></tt></a> variable contains a list of mode
callbacks that are invoked whenever Ren'Py enters a mode. The mode
callbacks are called with two parameters:</p>
<dl class="docutils">
<dt>mode</dt>
<dd>A string giving the name of the mode that we are entering.</dd>
<dt>old_modes</dt>
<dd>A list of strings, giving the modes that the system has previously
entered, ordered from most recent to least recent.</dd>
</dl>
<p>Note that when entering a mode we're already in, the first item in
<cite>old_modes</cite> will be equal to <cite>mode</cite>.</p>
<div class="section" id="example-mode-callbacks">
<h3>Example Mode Callbacks<a class="headerlink" href="#example-mode-callbacks" title="Permalink to this headline">¶</a></h3>
<p>This mode callback causes transitions to occur when switching from ADV
to NVL mode, and vice-versa. This ships as part of Ren'Py, so there's
no need to actually use it.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">_nvl_adv_callback</span><span class="p">(</span><span class="n">mode</span><span class="p">,</span> <span class="n">old_modes</span><span class="p">):</span>
<span class="n">old</span> <span class="o">=</span> <span class="n">old_modes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">if</span> <span class="n">config</span><span class="o">.</span><span class="n">adv_nvl_transition</span><span class="p">:</span>
<span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s">"nvl"</span> <span class="ow">or</span> <span class="n">mode</span> <span class="o">==</span> <span class="s">"nvl_menu"</span><span class="p">:</span>
<span class="k">if</span> <span class="n">old</span> <span class="o">==</span> <span class="s">"say"</span> <span class="ow">or</span> <span class="n">old</span> <span class="o">==</span> <span class="s">"menu"</span><span class="p">:</span>
<span class="n">nvl_show</span><span class="p">(</span><span class="n">config</span><span class="o">.</span><span class="n">adv_nvl_transition</span><span class="p">)</span>
<span class="k">if</span> <span class="n">config</span><span class="o">.</span><span class="n">nvl_adv_transition</span><span class="p">:</span>
<span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s">"say"</span> <span class="ow">or</span> <span class="n">mode</span> <span class="o">==</span> <span class="s">"menu"</span><span class="p">:</span>
<span class="k">if</span> <span class="n">old</span> <span class="o">==</span> <span class="s">"nvl"</span> <span class="ow">or</span> <span class="n">old</span> <span class="o">==</span> <span class="s">"nvl_menu"</span><span class="p">:</span>
<span class="n">nvl_hide</span><span class="p">(</span><span class="n">config</span><span class="o">.</span><span class="n">nvl_adv_transition</span><span class="p">)</span>
<span class="n">config</span><span class="o">.</span><span class="n">mode_callbacks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">_nvl_adv_callback</span><span class="p">)</span>
</pre></div>
</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="screen_python.html" title="Screens and Python"
>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>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en' });
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('012476843541036121001:gx3sqkoaxkm');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchboxOnly("http://www.google.com/cse?cx=012476843541036121001:gx3sqkoaxkm");
customSearchControl.draw('cse-search-form', options);
}, true);
</script>
</body>
</html>
|