renpy/doc/statement_equivalents.html

551 lines
36 KiB
HTML
Raw Normal View History

2023-01-18 22:13:55 +00:00
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Statement Equivalents &#8212; Ren&#39;Py Documentation</title>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></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>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Saving, Loading, and Rollback" href="save_load_rollback.html" />
<link rel="prev" title="Splashscreen and Presplash" href="splashscreen_presplash.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head><body>
<div id="navbar" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
Ren&#39;Py Documentation</a>
<span class="navbar-text navbar-version pull-left"><b>7.5.3</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li><a href="https://www.renpy.org">Home Page</a></li>
<li><a href="https://www.renpy.org/doc/html/">Online Documentation</a></li>
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui.html">GUI Customization Guide</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="language_basics.html">Language Basics</a></li>
<li class="toctree-l1"><a class="reference internal" href="label.html">Labels &amp; Control Flow</a></li>
<li class="toctree-l1"><a class="reference internal" href="dialogue.html">Dialogue and Narration</a></li>
<li class="toctree-l1"><a class="reference internal" href="displaying_images.html">Displaying Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="menus.html">In-Game Menus</a></li>
<li class="toctree-l1"><a class="reference internal" href="python.html">Python Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="conditional.html">Conditional Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="audio.html">Audio</a></li>
<li class="toctree-l1"><a class="reference internal" href="movie.html">Movie</a></li>
<li class="toctree-l1"><a class="reference internal" href="voice.html">Voice</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="text.html">Text</a></li>
<li class="toctree-l1"><a class="reference internal" href="translation.html">Translation</a></li>
<li class="toctree-l1"><a class="reference internal" href="displayables.html">Displayables</a></li>
<li class="toctree-l1"><a class="reference internal" href="transforms.html">Transforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="transitions.html">Transitions</a></li>
<li class="toctree-l1"><a class="reference internal" href="atl.html">Animation and Transformation Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="matrixcolor.html">Matrixcolor</a></li>
<li class="toctree-l1"><a class="reference internal" href="layeredimage.html">Layered Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="3dstage.html">3D Stage</a></li>
<li class="toctree-l1"><a class="reference internal" href="live2d.html">Live2D Cubism</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="style.html">Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="style_properties.html">Style Properties</a></li>
<li class="toctree-l1"><a class="reference internal" href="screens.html">Screens and Screen Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_actions.html">Screen Actions, Values, and Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_special.html">Special Screen Names</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_optimization.html">Screen Language Optimization</a></li>
<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="preferences.html">Preference Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="store_variables.html">Store Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="mouse.html">Custom Mouse Cursors</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="launcher.html">Launcher</a></li>
<li class="toctree-l1"><a class="reference internal" href="developer_tools.html">Developer Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="director.html">Interactive Director</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="nvl_mode.html">NVL-Mode Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="input.html">Text Input</a></li>
<li class="toctree-l1"><a class="reference internal" href="side_image.html">Side Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="rooms.html">Image Gallery, Music Room, and Replay Actions</a></li>
<li class="toctree-l1"><a class="reference internal" href="drag_drop.html">Drag and Drop</a></li>
<li class="toctree-l1"><a class="reference internal" href="sprites.html">Sprites</a></li>
<li class="toctree-l1"><a class="reference internal" href="keymap.html">Customizing the Keymap</a></li>
<li class="toctree-l1"><a class="reference internal" href="achievement.html">Achievements</a></li>
<li class="toctree-l1"><a class="reference internal" href="history.html">Dialogue History</a></li>
<li class="toctree-l1"><a class="reference internal" href="multiple.html">Multiple Character Dialogue</a></li>
<li class="toctree-l1"><a class="reference internal" href="splashscreen_presplash.html">Splashscreen and Presplash</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Statement Equivalents</a></li>
<li class="toctree-l1"><a class="reference internal" href="save_load_rollback.html">Saving, Loading, and Rollback</a></li>
<li class="toctree-l1"><a class="reference internal" href="persistent.html">Persistent Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="trans_trans_python.html">Transforms and Transitions in Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui_advanced.html">Advanced GUI</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_python.html">Screens and Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="modes.html">Modes</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdd.html">Creator-Defined Displayables</a></li>
<li class="toctree-l1"><a class="reference internal" href="cds.html">Creator-Defined Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="custom_text_tags.html">Custom Text Tags</a></li>
<li class="toctree-l1"><a class="reference internal" href="character_callbacks.html">Character Callbacks</a></li>
<li class="toctree-l1"><a class="reference internal" href="file_python.html">File Access</a></li>
<li class="toctree-l1"><a class="reference internal" href="color_class.html">Color Class</a></li>
<li class="toctree-l1"><a class="reference internal" href="matrix.html">Matrix</a></li>
<li class="toctree-l1"><a class="reference internal" href="model.html">Model-Based Rendering</a></li>
<li class="toctree-l1"><a class="reference internal" href="other.html">Other Functions and Variables</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="build.html">Building Distributions</a></li>
<li class="toctree-l1"><a class="reference internal" href="updater.html">Web Updater</a></li>
<li class="toctree-l1"><a class="reference internal" href="android.html">Android</a></li>
<li class="toctree-l1"><a class="reference internal" href="chromeos.html">Chrome OS/Chromebook</a></li>
<li class="toctree-l1"><a class="reference internal" href="ios.html">iOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="iap.html">In-App Purchasing</a></li>
<li class="toctree-l1"><a class="reference internal" href="gesture.html">Gestures</a></li>
<li class="toctree-l1"><a class="reference internal" href="raspi.html">Raspberry Pi</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="security.html">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="problems.html">Dealing with Problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="environment_variables.html">Environment Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="self_voicing.html">Self-Voicing</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="editor.html">Text Editor Integration</a></li>
<li class="toctree-l1"><a class="reference internal" href="skins.html">Skins</a></li>
<li class="toctree-l1"><a class="reference internal" href="translating_renpy.html">Translating Ren'Py</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog (Ren'Py 7.x-)</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog6.html">Changelog (Ren'Py 6.11 - 6.99)</a></li>
<li class="toctree-l1"><a class="reference internal" href="incompatible.html">Incompatible Changes</a></li>
<li class="toctree-l1"><a class="reference internal" href="distributor.html">Distributor Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="credits.html">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="sponsors.html">Ren'Py Development Sponsors</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="thequestion.html">Script of The Question</a></li>
<li class="toctree-l1"><a class="reference internal" href="thequestion_nvl.html">NVL-mode script for The Question</a></li>
</ul>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-3">
<div id="sidebar" class="bs-sidenav" role="complementary"><ul>
<li><a class="reference internal" href="#">Statement Equivalents</a><ul>
<li><a class="reference internal" href="#dialogue">Dialogue</a></li>
<li><a class="reference internal" href="#choice-menus">Choice Menus</a></li>
<li><a class="reference internal" href="#displaying-images">Displaying Images</a></li>
<li><a class="reference internal" href="#transitions">Transitions</a></li>
<li><a class="reference internal" href="#jump">Jump</a></li>
<li><a class="reference internal" href="#call">Call</a></li>
<li><a class="reference internal" href="#pause">Pause</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="col-md-9 content">
<div class="section" id="statement-equivalents">
<h1>Statement Equivalents<a class="headerlink" href="#statement-equivalents" title="Permalink to this headline"> link</a></h1>
<p>To allow Ren'Py to be scripted in Python, each Ren'Py statement has
a Python equivalent. This usually consists of a Python function,
but may also consist of a pattern of Python calls that perform an action
equivalent to the statement.</p>
<p>Note that using statement equivalents in lieu of the original statements
usually removes any possible <a class="reference internal" href="developer_tools.html#lint"><span class="std std-ref">Lint</span></a> checks and prediction
optimizations, making your game less easily checkable and possibly less
fluid.</p>
<div class="section" id="dialogue">
<h2>Dialogue<a class="headerlink" href="#dialogue" title="Permalink to this headline"> link</a></h2>
<p>The Ren'Py <a class="reference internal" href="dialogue.html#say-statement"><span class="std std-ref">Say Statement</span></a> is equivalent to calling the character
object as a function. The following displays the same line twice:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="n">e</span> <span class="s2">&quot;Hello, world.&quot;</span>
<span class="k">$</span> <span class="n">e</span><span class="p">(</span><span class="s2">&quot;Hello, world.&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>Displaying narration can be done the same way, by using the
<code class="docutils literal notranslate"><span class="pre">narrator</span></code> character. When calling a character, it's possible to
supply the keyword argument <code class="docutils literal notranslate"><span class="pre">interact</span></code>. When <code class="docutils literal notranslate"><span class="pre">interact</span></code> is False,
Ren'Py will display the character dialogue box, and will then
return before performing an interaction.</p>
<p>This equivalence of characters and function objects works in the other
direction as well. It is possible to declare a Python function, and
then use that function in the place of a character object. For
example, the following function uses a variable to choose between
two characters.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">define</span> <span class="n">lucy_normal</span> <span class="o">=</span> <span class="n">Character</span><span class="p">(</span><span class="s2">&quot;Lucy&quot;</span><span class="p">)</span>
<span class="k">define</span> <span class="n">lucy_evil</span> <span class="o">=</span> <span class="n">Character</span><span class="p">(</span><span class="s2">&quot;Evil Lucy&quot;</span><span class="p">)</span>
<span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">l</span><span class="p">(</span><span class="n">what</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="k">if</span> <span class="n">lucy_is_evil</span><span class="p">:</span>
<span class="n">lucy_evil</span><span class="p">(</span><span class="n">what</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">lucy_normal</span><span class="p">(</span><span class="n">what</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">label</span> <span class="n">start</span><span class="p">:</span>
<span class="k">$</span> <span class="n">lucy_is_evil</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">l</span> <span class="s2">&quot;Usually, I feel quite normal.&quot;</span>
<span class="k">$</span> <span class="n">lucy_is_evil</span> <span class="o">=</span> <span class="kc">True</span>
<span class="n">l</span> <span class="s2">&quot;But sometimes, I get really mad!&quot;</span>
</pre></div>
</div>
<p>A function used in this way should either ignore unknown keyword
arguments, or pass them to a character function. Doing this will
allow the game to continue working if Ren'Py adds additional keyword
arguments to character calls.</p>
<dl class="function">
<dt id="renpy.say">
<code class="descclassname">renpy.</code><code class="descname">say</code><span class="sig-paren">(</span><em>who</em>, <em>what</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.say" title="Permalink to this definition"> link</a></dt>
<dd><p>The equivalent of the say statement.</p>
<dl class="docutils">
<dt><cite>who</cite></dt>
<dd>Either the character that will say something, None for the narrator,
or a string giving the character name. In the latter case, the
<a class="reference internal" href="#renpy.say" title="renpy.say"><code class="xref py py-func docutils literal notranslate"><span class="pre">say()</span></code></a> is used to create the speaking character.</dd>
<dt><cite>what</cite></dt>
<dd>A string giving the line to say. Percent-substitutions are performed
in this string.</dd>
<dt><cite>interact</cite></dt>
<dd>If true, Ren'Py waits for player input when displaying the dialogue. If
false, Ren'Py shows the dialogue, but does not perform an interaction.
(This is passed in as a keyword argument.)</dd>
</dl>
<p>This function is rarely necessary, as the following three lines are
equivalent.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="n">e</span> <span class="s2">&quot;Hello, world.&quot;</span>
<span class="k">$</span> <span class="n">renpy</span><span class="o">.</span><span class="n">say</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">&quot;Hello, world.&quot;</span><span class="p">)</span>
<span class="k">$</span> <span class="n">e</span><span class="p">(</span><span class="s2">&quot;Hello, world.&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="choice-menus">
<h2>Choice Menus<a class="headerlink" href="#choice-menus" title="Permalink to this headline"> link</a></h2>
<p>The <a class="reference internal" href="menus.html"><span class="doc">menu statement</span></a> has an equivalent Python function.</p>
<dl class="function">
<dt id="renpy.display_menu">
<code class="descclassname">renpy.</code><code class="descname">display_menu</code><span class="sig-paren">(</span><em>items</em>, <em>*</em>, <em>interact=True</em>, <em>screen=&quot;choice&quot;</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.display_menu" title="Permalink to this definition"> link</a></dt>
<dd><p>This displays a menu to the user. <cite>items</cite> should be a list of 2-item tuples.
In each tuple, the first item is a textual label, and the second item is
the value to be returned if that item is selected. If the value is None,
the first item is used as a menu caption.</p>
<p>This function takes many arguments, of which only a few are documented.
Except for <cite>items</cite>, all arguments should be given as keyword arguments.</p>
<dl class="docutils">
<dt><cite>interact</cite></dt>
<dd>If false, the menu is displayed, but no interaction is performed.</dd>
<dt><cite>screen</cite></dt>
<dd>The name of the screen used to display the menu.</dd>
</dl>
<p>Note that most Ren'Py games do not use menu captions, but use narration
instead. To display a menu using narration, write:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">$</span> <span class="n">narrator</span><span class="p">(</span><span class="s2">&quot;Which direction would you like to go?&quot;</span><span class="p">,</span> <span class="n">interact</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">$</span> <span class="n">result</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">display_menu</span><span class="p">([</span> <span class="p">(</span><span class="s2">&quot;East&quot;</span><span class="p">,</span> <span class="s2">&quot;east&quot;</span><span class="p">),</span> <span class="p">(</span><span class="s2">&quot;West&quot;</span><span class="p">,</span> <span class="s2">&quot;west&quot;</span><span class="p">)</span> <span class="p">])</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="displaying-images">
<h2>Displaying Images<a class="headerlink" href="#displaying-images" title="Permalink to this headline"> link</a></h2>
<p>The image, scene, show, and hide statements each have an equivalent
Python function (see <a class="reference internal" href="displaying_images.html"><span class="doc">Displaying Images</span></a> for the original statements).</p>
<dl class="function">
<dt id="renpy.get_at_list">
<code class="descclassname">renpy.</code><code class="descname">get_at_list</code><span class="sig-paren">(</span><em>name</em>, <em>layer=None</em>, <em>camera=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_at_list" title="Permalink to this definition"> link</a></dt>
<dd><p>Returns the list of transforms being applied to the image with tag <cite>name</cite>
on <cite>layer</cite>. Returns an empty list if no transforms are being applied, or
None if the image is not shown.</p>
<p>If <cite>layer</cite> is None, uses the default layer for the given tag.</p>
</dd></dl>
<dl class="function">
<dt id="renpy.hide">
<code class="descclassname">renpy.</code><code class="descname">hide</code><span class="sig-paren">(</span><em>name</em>, <em>layer=None</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.hide" title="Permalink to this definition"> link</a></dt>
<dd><p>Hides an image from a layer. The Python equivalent of the hide statement.</p>
<dl class="docutils">
<dt><cite>name</cite></dt>
<dd>The name of the image to hide. Only the image tag is used, and
any image with the tag is hidden (the precise name does not matter).</dd>
<dt><cite>layer</cite></dt>
<dd>The layer on which this function operates. If None, uses the default
layer associated with the tag.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="renpy.image">
<code class="descclassname">renpy.</code><code class="descname">image</code><span class="sig-paren">(</span><em>name</em>, <em>d</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.image" title="Permalink to this definition"> link</a></dt>
<dd><p>Defines an image. This function is the Python equivalent of the
image statement.</p>
<dl class="docutils">
<dt><cite>name</cite></dt>
<dd>The name of the image to display, a string.</dd>
<dt><cite>d</cite></dt>
<dd>The displayable to associate with that image name.</dd>
</dl>
<p>This function may only be run from inside an init block. It is an
error to run this function once the game has started.</p>
</dd></dl>
<dl class="function">
<dt id="renpy.scene">
<code class="descclassname">renpy.</code><code class="descname">scene</code><span class="sig-paren">(</span><em>layer=u'master'</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.scene" title="Permalink to this definition"> link</a></dt>
<dd><p>Removes all displayables from <cite>layer</cite>. This is equivalent to the scene
statement, when the scene statement is not given an image to show.</p>
<p>A full scene statement is equivalent to a call to renpy.scene followed by a
call to <a class="reference internal" href="#renpy.show" title="renpy.show"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.show()</span></code></a>. For example:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">scene</span> <span class="n">bg</span> <span class="n">beach</span>
</pre></div>
</div>
<p>is equivalent to:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">$</span> <span class="n">renpy</span><span class="o">.</span><span class="k">scene</span><span class="p">()</span>
<span class="k">$</span> <span class="n">renpy</span><span class="o">.</span><span class="k">show</span><span class="p">(</span><span class="s2">&quot;bg beach&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="renpy.show">
<code class="descclassname">renpy.</code><code class="descname">show</code><span class="sig-paren">(</span><em>name</em>, <em>at_list=[]</em>, <em>layer='master'</em>, <em>what=None</em>, <em>zorder=0</em>, <em>tag=None</em>, <em>behind=[]</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.show" title="Permalink to this definition"> link</a></dt>
<dd><p>Shows an image on a layer. This is the programmatic equivalent of the show
statement.</p>
<dl class="docutils">
<dt><cite>name</cite></dt>
<dd>The name of the image to show, a string.</dd>
<dt><cite>at_list</cite></dt>
<dd>A list of transforms that are applied to the image.
The equivalent of the <code class="docutils literal notranslate"><span class="pre">at</span></code> property.</dd>
<dt><cite>layer</cite></dt>
<dd>A string, giving the name of the layer on which the image will be shown.
The equivalent of the <code class="docutils literal notranslate"><span class="pre">onlayer</span></code> property. If None, uses the default
layer associated with the tag.</dd>
<dt><cite>what</cite></dt>
<dd>If not None, this is a displayable that will be shown in lieu of
looking on the image. (This is the equivalent of the show expression
statement.) When a <cite>what</cite> parameter is given, <cite>name</cite> can be used to
associate a tag with the image.</dd>
<dt><cite>zorder</cite></dt>
<dd>An integer, the equivalent of the <code class="docutils literal notranslate"><span class="pre">zorder</span></code> property. If None, the
zorder is preserved if it exists, and is otherwise set to 0.</dd>
<dt><cite>tag</cite></dt>
<dd>A string, used to specify the image tag of the shown image. The
equivalent of the <code class="docutils literal notranslate"><span class="pre">as</span></code> property.</dd>
<dt><cite>behind</cite></dt>
<dd>A list of strings, giving image tags that this image is shown behind.
The equivalent of the <code class="docutils literal notranslate"><span class="pre">behind</span></code> property.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="renpy.show_layer_at">
<code class="descclassname">renpy.</code><code class="descname">show_layer_at</code><span class="sig-paren">(</span><em>at_list</em>, <em>layer=u'master'</em>, <em>reset=True</em>, <em>camera=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.show_layer_at" title="Permalink to this definition"> link</a></dt>
<dd><p>The Python equivalent of the <code class="docutils literal notranslate"><span class="pre">show</span> <span class="pre">layer</span></code> <cite>layer</cite> <code class="docutils literal notranslate"><span class="pre">at</span></code> <cite>at_list</cite>
statement. If <cite>camera</cite> is True, the equivalent of the <code class="docutils literal notranslate"><span class="pre">camera</span></code> statement.</p>
<dl class="docutils">
<dt><cite>reset</cite></dt>
<dd>If true, the transform state is reset to the start when it is shown.
If false, the transform state is persisted, allowing the new transform
to update that state.</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="transitions">
<h2>Transitions<a class="headerlink" href="#transitions" title="Permalink to this headline"> link</a></h2>
<p>The equivalent of the <a class="reference internal" href="displaying_images.html#with-statement"><span class="std std-ref">With Statement</span></a> is the <a class="reference internal" href="#renpy.with_statement" title="renpy.with_statement"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.with_statement()</span></code></a>
function.</p>
<dl class="function">
<dt id="renpy.with_statement">
<code class="descclassname">renpy.</code><code class="descname">with_statement</code><span class="sig-paren">(</span><em>trans</em>, <em>always=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.with_statement" title="Permalink to this definition"> link</a></dt>
<dd><p>Causes a transition to occur. This is the Python equivalent of the
with statement.</p>
<dl class="docutils">
<dt><cite>trans</cite></dt>
<dd>The transition.</dd>
<dt><cite>always</cite></dt>
<dd>If True, the transition will always occur, even if the user has
disabled transitions.</dd>
</dl>
<p>This function returns true if the user chose to interrupt the transition,
and false otherwise.</p>
</dd></dl>
</div>
<div class="section" id="jump">
<h2>Jump<a class="headerlink" href="#jump" title="Permalink to this headline"> link</a></h2>
<p>The equivalent of the <a class="reference internal" href="label.html#jump-statement"><span class="std std-ref">Jump Statement</span></a> is the <a class="reference internal" href="#renpy.jump" title="renpy.jump"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.jump()</span></code></a> function.</p>
<dl class="function">
<dt id="renpy.jump">
<code class="descclassname">renpy.</code><code class="descname">jump</code><span class="sig-paren">(</span><em>label</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.jump" title="Permalink to this definition"> link</a></dt>
<dd><p>Causes the current statement to end, and control to jump to the given
label.</p>
</dd></dl>
</div>
<div class="section" id="call">
<h2>Call<a class="headerlink" href="#call" title="Permalink to this headline"> link</a></h2>
<p>The equivalent of the <a class="reference internal" href="label.html#call-statement"><span class="std std-ref">Call Statement</span></a> is the <a class="reference internal" href="#renpy.call" title="renpy.call"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.call()</span></code></a> function.</p>
<dl class="function">
<dt id="renpy.call">
<code class="descclassname">renpy.</code><code class="descname">call</code><span class="sig-paren">(</span><em>label</em>, <em>*args</em>, <em>from_current=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.call" title="Permalink to this definition"> link</a></dt>
<dd><p>Causes the current Ren'Py statement to terminate, and a jump to a
<cite>label</cite> to occur. When the jump returns, control will be passed
to the statement following the current statement.</p>
<dl class="docutils">
<dt><cite>from_current</cite></dt>
<dd>If true, control will return to the current statement, rather than
the statement following the current statement. (This will lead to
the current statement being run twice. This must be passed as a
keyword argument.)</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="renpy.return_statement">
<code class="descclassname">renpy.</code><code class="descname">return_statement</code><span class="sig-paren">(</span><em>value=None</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.return_statement" title="Permalink to this definition"> link</a></dt>
<dd><p>Causes Ren'Py to return from the current Ren'Py-level call.</p>
</dd></dl>
</div>
<div class="section" id="pause">
<h2>Pause<a class="headerlink" href="#pause" title="Permalink to this headline"> link</a></h2>
<p>The equivalent of the <a class="reference internal" href="quickstart.html#pause-statement"><span class="std std-ref">Pause Statement</span></a> is the <a class="reference internal" href="#renpy.pause" title="renpy.pause"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.pause()</span></code></a> function.</p>
<dl class="function">
<dt id="renpy.pause">
<code class="descclassname">renpy.</code><code class="descname">pause</code><span class="sig-paren">(</span><em>delay=None</em>, <em>*</em>, <em>hard=False</em>, <em>predict=False</em>, <em>modal=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.pause" title="Permalink to this definition"> link</a></dt>
<dd><p>Causes Ren'Py to pause. Returns true if the user clicked to end the pause,
or false if the pause timed out or was skipped.</p>
<dl class="docutils">
<dt><cite>delay</cite></dt>
<dd>If given, the number of seconds Ren'Py should pause for.</dd>
</dl>
<p>The following should be given as keyword arguments:</p>
<dl class="docutils">
<dt><cite>hard</cite></dt>
<dd><p class="first">This must be given as a keyword argument. When True, Ren'Py may prevent
the user from clicking to interrupt the pause. If the player enables
skipping, the hard pause will be skipped. There may be other circumstances
where the hard pause ends early or prevents Ren'Py from operating properly,
these will not be treated as bugs.</p>
<p>In general, using hard pauses is rude. When the user clicks to advance
the game, it's an explicit request - the user wishes the game to advance.
To override that request is to assume you understand what the player
wants more than the player does.</p>
<p>Calling renpy.pause guarantees that whatever is on the screen will be
displayed for at least one frame, and hence has been shown to the
player.</p>
<p class="last">tl;dr - Don't use renpy.pause with hard=True.</p>
</dd>
<dt><cite>predict</cite></dt>
<dd><p class="first">If True, Ren'Py will end the pause when all prediction, including
prediction scheduled with <a class="reference internal" href="displaying_images.html#renpy.start_predict" title="renpy.start_predict"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.start_predict()</span></code></a> and
<a class="reference internal" href="screen_python.html#renpy.start_predict_screen" title="renpy.start_predict_screen"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.start_predict_screen()</span></code></a>, has been finished.</p>
<p class="last">This also causes Ren'Py to prioritize prediction over display smoothness
for the duration of the pause. Because of that, it's recommended to not
display animations during prediction.</p>
</dd>
<dt><cite>modal</cite></dt>
<dd>If True or None, the pause will not end when a modal screen is being displayed.
If false, the pause will end while a modal screen is being displayed.</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2012-2022, Tom Rothamel.<br/>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.6.<br/>
</p>
</div>
</footer>
</body>
</html>