1222 lines
76 KiB
HTML
1222 lines
76 KiB
HTML
|
<!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>Other Functions and Variables — Ren'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="Building Distributions" href="build.html" />
|
||
|
<link rel="prev" title="Model-Based Rendering" href="model.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'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 & 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"><a class="reference internal" href="statement_equivalents.html">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 current"><a class="current reference internal" href="#">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="#">Other Functions and Variables</a><ul>
|
||
|
<li><a class="reference internal" href="#ren-py-version">Ren'Py Version</a></li>
|
||
|
<li><a class="reference internal" href="#platform-detection">Platform Detection</a></li>
|
||
|
<li><a class="reference internal" href="#memory-profiling">Memory Profiling</a></li>
|
||
|
<li><a class="reference internal" href="#contexts">Contexts</a></li>
|
||
|
<li><a class="reference internal" href="#renpy-random">renpy.random</a></li>
|
||
|
<li><a class="reference internal" href="#sdl">SDL</a></li>
|
||
|
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-md-9 content">
|
||
|
|
||
|
<div class="section" id="other-functions-and-variables">
|
||
|
<h1>Other Functions and Variables<a class="headerlink" href="#other-functions-and-variables" title="Permalink to this headline"> link</a></h1>
|
||
|
<p>We're in the process of migrating the documentation over to a new
|
||
|
tool. As not every page has been migrated yet, this exists to document
|
||
|
new functionality that has no other place to go.</p>
|
||
|
<div class="section" id="ren-py-version">
|
||
|
<h2>Ren'Py Version<a class="headerlink" href="#ren-py-version" title="Permalink to this headline"> link</a></h2>
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.version">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">version</code><span class="sig-paren">(</span><em>tuple=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.version" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>If <cite>tuple</cite> is false, returns a string containing "Ren'Py ", followed by
|
||
|
the current version of Ren'Py.</p>
|
||
|
<p>If <cite>tuple</cite> is true, returns a tuple giving each component of the
|
||
|
version as an integer.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.version_string">
|
||
|
<code class="descname">renpy.version_string</code><a class="headerlink" href="#var-renpy.version_string" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>The version number of Ren'Py, as a string of the form "Ren'Py 1.2.3.456".</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.version_only">
|
||
|
<code class="descname">renpy.version_only</code><a class="headerlink" href="#var-renpy.version_only" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>The version number of Ren'Py, without the Ren'Py prefix. A string of
|
||
|
the form "1.2.3.456".</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.version_tuple">
|
||
|
<code class="descname">renpy.version_tuple</code><a class="headerlink" href="#var-renpy.version_tuple" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>The version number of Ren'Py, as a tuple of the form (1, 2, 3, 456).</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.version_name">
|
||
|
<code class="descname">renpy.version_name</code><a class="headerlink" href="#var-renpy.version_name" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>A human readable version name, of the form "Example Version."</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.license">
|
||
|
<code class="descname">renpy.license</code><a class="headerlink" href="#var-renpy.license" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>A string giving license text that should be included in a game's
|
||
|
about screen.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
</div>
|
||
|
<div class="section" id="platform-detection">
|
||
|
<h2>Platform Detection<a class="headerlink" href="#platform-detection" title="Permalink to this headline"> link</a></h2>
|
||
|
<p>Ren'Py includes a number of variables that are set based on which platform
|
||
|
it's running on.</p>
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.windows">
|
||
|
<code class="descname">renpy.windows</code><a class="headerlink" href="#var-renpy.windows" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Has a true value when running on Windows.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.macintosh">
|
||
|
<code class="descname">renpy.macintosh</code><a class="headerlink" href="#var-renpy.macintosh" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Has a true value when running on macOS.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.linux">
|
||
|
<code class="descname">renpy.linux</code><a class="headerlink" href="#var-renpy.linux" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Has a true value when running on Linux or other POSIX-like operating systems.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.android">
|
||
|
<code class="descname">renpy.android</code><a class="headerlink" href="#var-renpy.android" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Has a true value when running on Android.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.ios">
|
||
|
<code class="descname">renpy.ios</code><a class="headerlink" href="#var-renpy.ios" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Has a true value when running on iOS.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.emscripten">
|
||
|
<code class="descname">renpy.emscripten</code><a class="headerlink" href="#var-renpy.emscripten" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Has a true value when running in the browser.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="var">
|
||
|
<dt id="var-renpy.mobile">
|
||
|
<code class="descname">renpy.mobile</code><a class="headerlink" href="#var-renpy.mobile" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Has a true value when running on Android or iOS or in the browser.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<p>These are only set when running on the actual devices, not when running on
|
||
|
in the emulators. These are more intended for use in platform-specific
|
||
|
Python. For display layout, use <a class="reference internal" href="screens.html#screen-variants"><span class="std std-ref">screen variants</span></a>.</p>
|
||
|
</div>
|
||
|
<div class="section" id="memory-profiling">
|
||
|
<h2>Memory Profiling<a class="headerlink" href="#memory-profiling" title="Permalink to this headline"> link</a></h2>
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.diff_memory">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">diff_memory</code><span class="sig-paren">(</span><em>update=True</em>, <em>skip_constants=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.diff_memory" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Profiles objects, surface, and texture memory use by Ren'Py and the game.
|
||
|
Writes (to memory.txt and stdout) the difference in memory usage from the
|
||
|
last time this function was called with <cite>update</cite> true.</p>
|
||
|
<p>The accounting is by names in the store and in the Ren'Py implementation
|
||
|
that the memory is reachable from. If an object is reachable from more
|
||
|
than one name, it's assigned to the name it's most directly reachable
|
||
|
from.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>skip_constants</cite></dt>
|
||
|
<dd>If True, the profiler will skip scanning of large Ren'Py's containers,
|
||
|
that are intended to be immutable after startup.</dd>
|
||
|
</dl>
|
||
|
<p>As it has to scan all memory used by Ren'Py, this function may take a
|
||
|
long time to complete.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.profile_memory">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">profile_memory</code><span class="sig-paren">(</span><em>fraction=1.0</em>, <em>minimum=0</em>, <em>skip_constants=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.profile_memory" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Profiles object, surface, and texture memory use by Ren'Py and the
|
||
|
game. Writes an accounting of memory use by to the memory.txt file and
|
||
|
stdout.</p>
|
||
|
<p>The accounting is by names in the store and in the Ren'Py implementation
|
||
|
that the memory is reachable from. If an object is reachable from more
|
||
|
than one name, it's assigned to the name it's most directly reachable
|
||
|
from.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>fraction</cite></dt>
|
||
|
<dd>The fraction of the total memory usage to show. 1.0 will show all
|
||
|
memory usage, .9 will show the top 90%.</dd>
|
||
|
<dt><cite>minimum</cite></dt>
|
||
|
<dd>If a name is accounted less than <cite>minimum</cite> bytes of memory, it will
|
||
|
not be printed.</dd>
|
||
|
<dt><cite>skip_constants</cite></dt>
|
||
|
<dd>If True, the profiler will skip scanning of large Ren'Py's containers,
|
||
|
that are intended to be immutable after startup.</dd>
|
||
|
</dl>
|
||
|
<p>As it has to scan all memory used by Ren'Py, this function may take a
|
||
|
long time to complete.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.profile_rollback">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">profile_rollback</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.profile_rollback" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Profiles memory used by the rollback system. Writes (to memory.txt and
|
||
|
stdout) the memory used by the rollback system. This tries to account
|
||
|
for rollback memory used by various store variables, as well as by
|
||
|
internal aspects of the rollback system.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
</div>
|
||
|
<div class="section" id="contexts">
|
||
|
<h2>Contexts<a class="headerlink" href="#contexts" title="Permalink to this headline"> link</a></h2>
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.context">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">context</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.context" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns an object that is unique to the current context. The object
|
||
|
is copied when entering a new context, but changes to the copy do
|
||
|
not change the original.</p>
|
||
|
<p>The object is saved and participates in rollback.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.context_nesting_level">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">context_nesting_level</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.context_nesting_level" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the nesting level of the current context. This is 0 for the
|
||
|
outermost context (the context that is saved, loaded, and rolled-back),
|
||
|
and is non-zero in other contexts, such as menu and replay contexts.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
</div>
|
||
|
<div class="section" id="renpy-random">
|
||
|
<h2>renpy.random<a class="headerlink" href="#renpy-random" title="Permalink to this headline"> link</a></h2>
|
||
|
<p>This object is a random number generator that implements
|
||
|
<a class="reference external" href="https://docs.python.org/library/random.html">the Python random number generation interface</a>.
|
||
|
Randomness can be generated by calling the various methods this object
|
||
|
exposes. See the Python documentation for the full list, but the most useful
|
||
|
are:</p>
|
||
|
<ul class="simple">
|
||
|
<li><code class="docutils literal notranslate"><span class="pre">renpy.random.random()</span></code></li>
|
||
|
</ul>
|
||
|
<p>Return the next random floating point number in the range (0.0, 1.0).</p>
|
||
|
<ul class="simple">
|
||
|
<li><code class="docutils literal notranslate"><span class="pre">renpy.random.randint(a,</span> <span class="pre">b)</span></code></li>
|
||
|
</ul>
|
||
|
<p>Return a random integer such that a <= N <= b.</p>
|
||
|
<ul class="simple">
|
||
|
<li><code class="docutils literal notranslate"><span class="pre">renpy.random.choice(seq)</span></code></li>
|
||
|
</ul>
|
||
|
<p>Return a random element from the non-empty sequence <cite>seq</cite>.</p>
|
||
|
<ul class="simple">
|
||
|
<li><code class="docutils literal notranslate"><span class="pre">renpy.random.shuffle(seq)</span></code></li>
|
||
|
</ul>
|
||
|
<p>Shuffles the elements of the sequence <cite>seq</cite> in place. This does not return
|
||
|
a list, but changes an existing one.</p>
|
||
|
<p>Unlike the standard Python random number generator, this object cooperates with
|
||
|
rollback, generating the same numbers regardless of how many times we rollback.
|
||
|
It should be used instead of the standard Python random module.</p>
|
||
|
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="c1"># return a random float between 0 and 1</span>
|
||
|
<span class="k">$</span> <span class="n">randfloat</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>
|
||
|
|
||
|
<span class="c1"># return a random integer between 1 and 20</span>
|
||
|
<span class="k">$</span> <span class="n">d20roll</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
|
||
|
|
||
|
<span class="c1"># return a random element from a list</span>
|
||
|
<span class="k">$</span> <span class="n">randfruit</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="k">choice</span><span class="p">([</span><span class="s1">'apple'</span><span class="p">,</span> <span class="s1">'orange'</span><span class="p">,</span> <span class="s1">'plum'</span><span class="p">])</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<ul class="simple">
|
||
|
<li><code class="docutils literal notranslate"><span class="pre">renpy.random.Random(seed=None)</span></code></li>
|
||
|
</ul>
|
||
|
<p>Returns a new random number generator object separate from the main one, seeded
|
||
|
with the specified value if provided.</p>
|
||
|
</div>
|
||
|
<div class="section" id="sdl">
|
||
|
<span id="id1"></span><h2>SDL<a class="headerlink" href="#sdl" title="Permalink to this headline"> link</a></h2>
|
||
|
<p>These functions let you use the Python ctypes module to call functions in
|
||
|
the SDL dll. There are no guarantees as to the version of SDL2 that's included
|
||
|
with Ren'Py, including which features will or will not be compiled in. These
|
||
|
functions may fail on platforms that can otherwise run Ren'Py, and so it's
|
||
|
important to check for None before proceeding.</p>
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_sdl_dll">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_sdl_dll</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_sdl_dll" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This returns a ctypes.cdll object that refers to the library that contains
|
||
|
the instance of SDL2 that Ren'Py is using.</p>
|
||
|
<p>If this can not be done, None is returned.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_sdl_window_pointer">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_sdl_window_pointer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_sdl_window_pointer" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns a pointer (of type ctypes.c_void_p) to the main window, or None
|
||
|
if the main window is not displayed, or some other problem occurs.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
|
||
|
|
||
|
<span class="kn">import</span> <span class="nn">ctypes</span>
|
||
|
|
||
|
<span class="k">def</span> <span class="nf">get_window_position</span><span class="p">():</span>
|
||
|
<span class="sd">"""</span>
|
||
|
<span class="sd"> Retrieves the position of the window from SDL2. Returns</span>
|
||
|
<span class="sd"> the (x, y) of the upper left corner of the window, or</span>
|
||
|
<span class="sd"> (0, 0) if it's not known.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
|
||
|
<span class="n">sdl</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">get_sdl_dll</span><span class="p">()</span>
|
||
|
|
||
|
<span class="k">if</span> <span class="n">sdl</span> <span class="k">is</span> <span class="kc">None</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||
|
|
||
|
<span class="n">win</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">get_sdl_window_pointer</span><span class="p">()</span>
|
||
|
|
||
|
<span class="k">if</span> <span class="n">win</span> <span class="k">is</span> <span class="kc">None</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||
|
|
||
|
<span class="n">SDL_GetWindowPosition</span> <span class="o">=</span> <span class="n">sdl</span><span class="o">.</span><span class="n">SDL_GetWindowPosition</span>
|
||
|
|
||
|
<span class="n">x</span> <span class="o">=</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">c_int</span><span class="p">()</span>
|
||
|
<span class="n">y</span> <span class="o">=</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">c_int</span><span class="p">()</span>
|
||
|
|
||
|
<span class="n">SDL_GetWindowPosition</span><span class="p">(</span><span class="n">win</span><span class="p">,</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">byref</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">ctypes</span><span class="o">.</span><span class="n">byref</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section" id="miscellaneous">
|
||
|
<h2>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline"> link</a></h2>
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.add_layer">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">add_layer</code><span class="sig-paren">(</span><em>layer</em>, <em>above=None</em>, <em>below=None</em>, <em>menu_clear=True</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.add_layer" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Adds a new layer to the screen. If the layer already exists, this
|
||
|
function does nothing.</p>
|
||
|
<p>One of <cite>behind</cite> or <cite>above</cite> must be given.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>layer</cite></dt>
|
||
|
<dd>A string giving the name of the new layer to add.</dd>
|
||
|
<dt><cite>above</cite></dt>
|
||
|
<dd>If not None, a string giving the name of a layer the new layer will
|
||
|
be placed above.</dd>
|
||
|
<dt><cite>below</cite></dt>
|
||
|
<dd>If not None, a string giving the name of a layer the new layer will
|
||
|
be placed below.</dd>
|
||
|
<dt><cite>menu_clear</cite></dt>
|
||
|
<dd>If true, this layer will be cleared when entering the game menu
|
||
|
context, and restored when leaving the</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.add_python_directory">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">add_python_directory</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.add_python_directory" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Adds <cite>path</cite> to the list of paths searched for Python modules and packages.
|
||
|
The path should be a string relative to the game directory. This must be
|
||
|
called before an import statement.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.add_to_all_stores">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">add_to_all_stores</code><span class="sig-paren">(</span><em>name</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.add_to_all_stores" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Adds the <cite>value</cite> by the <cite>name</cite> to all creator defined namespaces. If the name
|
||
|
already exist in that namespace - do nothing for it.</p>
|
||
|
<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.call_stack_depth">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">call_stack_depth</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.call_stack_depth" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the depth of the call stack of the current context - the number
|
||
|
of calls that have run without being returned from or popped from the
|
||
|
call stack.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.capture_focus">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">capture_focus</code><span class="sig-paren">(</span><em>name=u'default'</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.capture_focus" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>If a displayable is currently focused, captured the rectangular bounding
|
||
|
box of that displayable, and stores it with <cite>name</cite>. If not, removes any
|
||
|
focus stored with <cite>name</cite>.</p>
|
||
|
<p>Captured focuses are not saved when the game is saveed.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>name</cite></dt>
|
||
|
<dd>Should be a string. The name "tooltip" is special, as it's
|
||
|
automatically captured when a displayable with a tooltip gains focus.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.choice_for_skipping">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">choice_for_skipping</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.choice_for_skipping" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Tells Ren'Py that a choice is coming up soon. This currently has
|
||
|
two effects:</p>
|
||
|
<ul class="simple">
|
||
|
<li>If Ren'Py is skipping, and the Skip After Choices preferences is set
|
||
|
to stop skipping, skipping is terminated.</li>
|
||
|
<li>An auto-save is triggered.</li>
|
||
|
</ul>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.clear_capture_focus">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">clear_capture_focus</code><span class="sig-paren">(</span><em>name=u'default'</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.clear_capture_focus" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Clear the captured focus with <cite>name</cite>.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.clear_game_runtime">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">clear_game_runtime</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.clear_game_runtime" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Resets the game runtime counter.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.clear_keymap_cache">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">clear_keymap_cache</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.clear_keymap_cache" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Clears the keymap cache. This allows changes to <a class="reference internal" href="config.html#var-config.keymap"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.keymap</span></code></a> to
|
||
|
take effect without restarting Ren'Py.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.context_dynamic">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">context_dynamic</code><span class="sig-paren">(</span><em>*vars</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.context_dynamic" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This can be given one or more variable names as arguments. This makes
|
||
|
the variables dynamically scoped to the current context. The variables will
|
||
|
be reset to their original value when the call returns.</p>
|
||
|
<p>An example call is:</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="n">context_dynamic</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="s2">"y"</span><span class="p">,</span> <span class="s2">"z"</span><span class="p">)</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.count_dialogue_blocks">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">count_dialogue_blocks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.count_dialogue_blocks" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the number of dialogue blocks in the game's original language.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.count_newly_seen_dialogue_blocks">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">count_newly_seen_dialogue_blocks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.count_newly_seen_dialogue_blocks" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the number of dialogue blocks the user has seen for the first time
|
||
|
during this session.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.count_seen_dialogue_blocks">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">count_seen_dialogue_blocks</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.count_seen_dialogue_blocks" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the number of dialogue blocks the user has seen in any play-through
|
||
|
of the current game.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.display_notify">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">display_notify</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.display_notify" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>The default implementation of <a class="reference internal" href="#renpy.notify" title="renpy.notify"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.notify()</span></code></a>.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.dynamic">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">dynamic</code><span class="sig-paren">(</span><em>*vars</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.dynamic" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This can be given one or more variable names as arguments. This makes
|
||
|
the variables dynamically scoped to the current call. The variables will
|
||
|
be reset to their original value when the call returns.</p>
|
||
|
<p>If the variables are given as keyword arguments, the value of the argument
|
||
|
is assigned to the variable name.</p>
|
||
|
<p>Example calls are:</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="n">dynamic</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="s2">"y"</span><span class="p">,</span> <span class="s2">"z"</span><span class="p">)</span>
|
||
|
<span class="k">$</span> <span class="n">renpy</span><span class="o">.</span><span class="n">dynamic</span><span class="p">(</span><span class="n">players</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">score</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.flush_cache_file">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">flush_cache_file</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.flush_cache_file" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This flushes all image cache entries that refer to the file <cite>fn</cite>. This
|
||
|
may be called when an image file changes on disk to force Ren'Py to
|
||
|
use the new version.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.focus_coordinates">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">focus_coordinates</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.focus_coordinates" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This attempts to find the coordinates of the currently-focused
|
||
|
displayable. If it can, it will return them as a (x, y, w, h)
|
||
|
tuple. If not, it will return a (None, None, None, None) tuple.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.force_autosave">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">force_autosave</code><span class="sig-paren">(</span><em>take_screenshot=False</em>, <em>block=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.force_autosave" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Forces a background autosave to occur.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>take_screenshot</cite></dt>
|
||
|
<dd>If True, a new screenshot will be taken. If False, the existing
|
||
|
screenshot will be used.</dd>
|
||
|
<dt><cite>block</cite></dt>
|
||
|
<dd>If True, blocks until the autosave completes.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.free_memory">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">free_memory</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.free_memory" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Attempts to free some memory. Useful before running a renpygame-based
|
||
|
minigame.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.full_restart">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">full_restart</code><span class="sig-paren">(</span><em>transition=False</em>, <em>label=u'_invoke_main_menu'</em>, <em>target=u'_main_menu'</em>, <em>save=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.full_restart" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Causes Ren'Py to restart, returning the user to the main menu.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>transition</cite></dt>
|
||
|
<dd>If given, the transition to run, or None to not run a transition.
|
||
|
False uses <a class="reference internal" href="config.html#var-config.end_game_transition"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.end_game_transition</span></code></a>.</dd>
|
||
|
<dt><cite>save</cite></dt>
|
||
|
<dd>If true, the game is saved in <a class="reference internal" href="store_variables.html#var-_quit_slot"><code class="xref std std-var docutils literal notranslate"><span class="pre">_quit_slot</span></code></a> before Ren'Py
|
||
|
restarts and returns the user to the main menu.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_adjustment">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_adjustment</code><span class="sig-paren">(</span><em>bar_value</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_adjustment" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Given <cite>bar_value</cite>, a <a class="reference internal" href="screen_python.html#BarValue" title="BarValue"><code class="xref py py-class docutils literal notranslate"><span class="pre">BarValue</span></code></a>, returns the <a class="reference internal" href="screen_python.html#ui.adjustment" title="ui.adjustment"><code class="xref py py-func docutils literal notranslate"><span class="pre">ui.adjustment()</span></code></a>
|
||
|
if uses. The adjustment has the following to attributes defined:</p>
|
||
|
<dl class="attribute">
|
||
|
<dt id="renpy.value">
|
||
|
<code class="descname">value</code><a class="headerlink" href="#renpy.value" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>The current value of the bar.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="attribute">
|
||
|
<dt id="range">
|
||
|
<code class="descname">range</code><a class="headerlink" href="#range" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>The current range of the bar.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_autoreload">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_autoreload</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_autoreload" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Gets the autoreload flag.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_game_runtime">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_game_runtime</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_game_runtime" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the game runtime counter.</p>
|
||
|
<p>The game runtime counter counts the number of seconds that have
|
||
|
elapsed while waiting for user input in the top-level context.
|
||
|
(It does not count time spent in the main or game menus.)</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_image_load_log">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_image_load_log</code><span class="sig-paren">(</span><em>age=None</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_image_load_log" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>A generator that yields a log of image loading activity. For the last 100
|
||
|
image loads, this returns:</p>
|
||
|
<ul class="simple">
|
||
|
<li>The time the image was loaded (in seconds since the epoch).</li>
|
||
|
<li>The filename of the image that was loaded.</li>
|
||
|
<li>A boolean that is true if the image was preloaded, and false if the
|
||
|
game stalled to load it.</li>
|
||
|
</ul>
|
||
|
<p>The entries are ordered from newest to oldest.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>age</cite></dt>
|
||
|
<dd>If not None, only images that have been loaded in the past <cite>age</cite>
|
||
|
seconds are included.</dd>
|
||
|
</dl>
|
||
|
<p>The image load log is only kept if config.developer = True.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_mouse_name">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_mouse_name</code><span class="sig-paren">(</span><em>interaction=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_mouse_name" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the name of the mouse that should be shown.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>interaction</cite></dt>
|
||
|
<dd>If true, get a mouse name that is based on the type of interaction
|
||
|
occuring. (This is rarely useful.)</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_mouse_pos">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_mouse_pos</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_mouse_pos" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns an (x, y) tuple giving the location of the mouse pointer or the
|
||
|
current touch location. If the device does not support a mouse and is not
|
||
|
currently being touched, x and y are numbers, but not meaningful.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_physical_size">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_physical_size</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_physical_size" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the size of the physical window.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_refresh_rate">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_refresh_rate</code><span class="sig-paren">(</span><em>precision=5</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_refresh_rate" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the refresh rate of the current screen, as a floating-point
|
||
|
number of frames per second.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>precision</cite></dt>
|
||
|
<dd><p class="first">The raw data Ren'Py gets is number of frames per second, rounded down.
|
||
|
This means that a monitor that runs at 59.95 frames per second will
|
||
|
be reported at 59 fps. The precision argument reduces the precision
|
||
|
of this reading, such that the only valid readings are multiples of
|
||
|
the precision.</p>
|
||
|
<p class="last">Since all monitor framerates tend to be multiples of 5 (25, 30, 60,
|
||
|
75, and 120), this likely will improve accuracy. Setting precision
|
||
|
to 1 disables this.</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_renderer_info">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_renderer_info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_renderer_info" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns a dictionary, giving information about the renderer Ren'Py is
|
||
|
currently using. Defined keys are:</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">"renderer"</span></code></dt>
|
||
|
<dd>A string giving the name of the renderer that is in use.</dd>
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">"resizable"</span></code></dt>
|
||
|
<dd>True if and only if the window is resizable.</dd>
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">"additive"</span></code></dt>
|
||
|
<dd>True if and only if the renderer supports additive blending.</dd>
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">"model"</span></code></dt>
|
||
|
<dd>Present and true if model-based rendering is supported.</dd>
|
||
|
</dl>
|
||
|
<p>Other, renderer-specific, keys may also exist. The dictionary should
|
||
|
be treated as immutable. This should only be called once the display
|
||
|
has been started (that is, after the init phase has finished).</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_say_attributes">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_say_attributes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_say_attributes" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Gets the attributes associated with the current say statement, or
|
||
|
None if no attributes are associated with this statement.</p>
|
||
|
<p>This is only valid when executing or predicting a say statement.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_skipping">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_skipping</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_skipping" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns "slow" if the Ren'Py is skipping, "fast" if Ren'Py is fast skipping,
|
||
|
and None if it is not skipping.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.get_transition">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">get_transition</code><span class="sig-paren">(</span><em>layer=None</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.get_transition" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Gets the transition for <cite>layer</cite>, or the entire scene if
|
||
|
<cite>layer</cite> is None. This returns the transition that is queued up
|
||
|
to run during the next interaction, or None if no such
|
||
|
transition exists.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.iconify">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">iconify</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.iconify" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Iconifies the game.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.invoke_in_thread">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">invoke_in_thread</code><span class="sig-paren">(</span><em>fn</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.invoke_in_thread" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Invokes the function <cite>fn</cite> in a background thread, passing it the
|
||
|
provided arguments and keyword arguments. Restarts the interaction
|
||
|
once the thread returns.</p>
|
||
|
<p>This function creates a daemon thread, which will be automatically
|
||
|
stopped when Ren'Py is shutting down.</p>
|
||
|
<p>This thread is very limited in what it can do with the Ren'Py API.
|
||
|
Changing store variables is allowed, as is calling the <a class="reference internal" href="#renpy.queue_event" title="renpy.queue_event"><code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.queue_event()</span></code></a>
|
||
|
function. Most other portions of the Ren'Py API are expected to be called from
|
||
|
the main thread.</p>
|
||
|
<p>The primary use of this function is to place accesss to a web API in a second
|
||
|
thread, and then update variables with the results of that call, by storing
|
||
|
the result in variables and then relying on the interaction restart to cause
|
||
|
screens to display those variables.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.is_init_phase">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">is_init_phase</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.is_init_phase" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns True if Ren'Py is currently executing init code, or False otherwise.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.is_mouse_visible">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">is_mouse_visible</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.is_mouse_visible" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns True if the mouse cursor is visible, False otherwise.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.is_seen">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">is_seen</code><span class="sig-paren">(</span><em>ever=True</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.is_seen" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns true if the current line has been seen by the player.</p>
|
||
|
<p>If <cite>ever</cite> is true, we check to see if the line has ever been seen by the
|
||
|
player. If false, we check if the line has been seen in the current
|
||
|
play-through.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.is_skipping">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">is_skipping</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.is_skipping" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns True if Ren'Py is currently skipping (in fast or slow skip mode),
|
||
|
or False otherwise.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.is_start_interact">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">is_start_interact</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.is_start_interact" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns true if restart_interaction has not been called during the current
|
||
|
interaction. This can be used to determine if the interaction is just being
|
||
|
started, or has been restarted.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.language_tailor">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">language_tailor</code><span class="sig-paren">(</span><em>chars</em>, <em>cls</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.language_tailor" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This can be used to override the line breaking class of a character. For
|
||
|
example, the linebreaking class of a character can be set to ID to
|
||
|
treat it as an ideograph, which allows breaks before and after that
|
||
|
character.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>chars</cite></dt>
|
||
|
<dd>A string containing each of the characters to tailor.</dd>
|
||
|
<dt><cite>cls</cite></dt>
|
||
|
<dd>A string giving a character class. This should be one of the classes defined in Table
|
||
|
1 of <a class="reference external" href="http://www.unicode.org/reports/tr14/tr14-30.html">UAX #14: Unicode Line Breaking Algorithm</a>.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.load_module">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">load_module</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.load_module" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This loads the Ren'Py module named name. A Ren'Py module consists of Ren'Py script
|
||
|
that is loaded into the usual (store) namespace, contained in a file named
|
||
|
name.rpym or name.rpymc. If a .rpym file exists, and is newer than the
|
||
|
corresponding .rpymc file, it is loaded and a new .rpymc file is created.</p>
|
||
|
<p>All of the init blocks (and other init-phase code) in the module are run
|
||
|
before this function returns. An error is raised if the module name cannot
|
||
|
be found, or is ambiguous.</p>
|
||
|
<p>Module loading may only occur from inside an init block.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.load_string">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">load_string</code><span class="sig-paren">(</span><em>s</em>, <em>filename=u'<string>'</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.load_string" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Loads <cite>s</cite> as Ren'Py script that can be called.</p>
|
||
|
<p>Returns the name of the first statement in s.</p>
|
||
|
<p><cite>filename</cite> is the name of the filename that statements in the string will
|
||
|
appear to be from.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.maximum_framerate">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">maximum_framerate</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.maximum_framerate" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Forces Ren'Py to draw the screen at the maximum framerate for <cite>t</cite> seconds.
|
||
|
If <cite>t</cite> is None, cancels the maximum framerate request.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.munge">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">munge</code><span class="sig-paren">(</span><em>name</em>, <em>filename=None</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.munge" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Munges <cite>name</cite>, which must begin with __.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>filename</cite></dt>
|
||
|
<dd>The filename the name is munged into. If None, the name is munged
|
||
|
into the filename containing the call to this function.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.not_infinite_loop">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">not_infinite_loop</code><span class="sig-paren">(</span><em>delay</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.not_infinite_loop" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Resets the infinite loop detection timer to <cite>delay</cite> seconds.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.notify">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">notify</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.notify" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Causes Ren'Py to display the <cite>message</cite> using the notify screen. By
|
||
|
default, this will cause the message to be dissolved in, displayed
|
||
|
for two seconds, and dissolved out again.</p>
|
||
|
<p>This is useful for actions that otherwise wouldn't produce feedback,
|
||
|
like screenshots or quicksaves.</p>
|
||
|
<p>Only one notification is displayed at a time. If a second notification
|
||
|
is displayed, the first notification is replaced.</p>
|
||
|
<p>This function just calls <a class="reference internal" href="config.html#var-config.notify"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.notify</span></code></a>, allowing its implementation
|
||
|
to be replaced by assigning a new function to that variable.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.pop_call">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">pop_call</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.pop_call" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Pops the current call from the call stack, without returning to
|
||
|
the location.</p>
|
||
|
<p>This can be used if a label that is called decides not to return
|
||
|
to its caller.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.predicting">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">predicting</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.predicting" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns true if Ren'Py is currently in a predicting phase.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.queue_event">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">queue_event</code><span class="sig-paren">(</span><em>name</em>, <em>up=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.queue_event" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Queues an event with the given name. <cite>Name</cite> should be one of the event
|
||
|
names in <a class="reference internal" href="config.html#var-config.keymap"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.keymap</span></code></a>, or a list of such names.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>up</cite></dt>
|
||
|
<dd>This should be false when the event begins (for example, when a keyboard
|
||
|
button is pressed.) It should be true when the event ends (when the
|
||
|
button is released.)</dd>
|
||
|
</dl>
|
||
|
<p>The event is queued at the time this function is called. This function will
|
||
|
not work to replace an event with another - doing so will change event order.
|
||
|
(Use <a class="reference internal" href="config.html#var-config.keymap"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.keymap</span></code></a> instead.)</p>
|
||
|
<p>This method is threadsafe.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.quit">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">quit</code><span class="sig-paren">(</span><em>relaunch=False</em>, <em>status=0</em>, <em>save=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.quit" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This causes Ren'Py to exit entirely.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>relaunch</cite></dt>
|
||
|
<dd>If true, Ren'Py will run a second copy of itself before quitting.</dd>
|
||
|
<dt><cite>status</cite></dt>
|
||
|
<dd>The status code Ren'Py will return to the operating system.
|
||
|
Generally, 0 is success, and positive integers are failure.</dd>
|
||
|
<dt><cite>save</cite></dt>
|
||
|
<dd>If true, the game is saved in <a class="reference internal" href="store_variables.html#var-_quit_slot"><code class="xref std std-var docutils literal notranslate"><span class="pre">_quit_slot</span></code></a> before Ren'Py
|
||
|
terminates.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.quit_event">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">quit_event</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.quit_event" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Triggers a quit event, as if the player clicked the quit button in the
|
||
|
window chrome.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.reload_script">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">reload_script</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.reload_script" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Causes Ren'Py to save the game, reload the script, and then load the
|
||
|
save.</p>
|
||
|
<p>This should only be called during development. It works on Windows, macOS,
|
||
|
and Linux, but may not work on other platforms.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.reset_physical_size">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">reset_physical_size</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.reset_physical_size" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Attempts to set the size of the physical window to the specified values
|
||
|
in renpy.config. (That is, screen_width and screen_height.) This has the
|
||
|
side effect of taking the screen out of fullscreen mode.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.restart_interaction">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">restart_interaction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.restart_interaction" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Restarts the current interaction. Among other things, this displays
|
||
|
images added to the scene, re-evaluates screens, and starts any
|
||
|
queued transitions.</p>
|
||
|
<p>This only does anything when called from within an interaction (for
|
||
|
example, from an action). Outside an interaction, this function has
|
||
|
no effect.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.screenshot">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">screenshot</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.screenshot" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Saves a screenshot in <cite>filename</cite>.</p>
|
||
|
<p>Returns True if the screenshot was saved successfully, False if saving
|
||
|
failed for some reason.</p>
|
||
|
<p>The <a class="reference internal" href="config.html#var-config.screenshot_pattern"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.screenshot_pattern</span></code></a> and <a class="reference internal" href="store_variables.html#var-_screenshot_pattern"><code class="xref std std-var docutils literal notranslate"><span class="pre">_screenshot_pattern</span></code></a>
|
||
|
variables control the file the screenshot is saved in.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.screenshot_to_bytes">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">screenshot_to_bytes</code><span class="sig-paren">(</span><em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.screenshot_to_bytes" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns a screenshot as a bytes object, that can be passed to im.Data().
|
||
|
The bytes will be a png-format image, such that:</p>
|
||
|
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">$</span> <span class="n">data</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">screenshot_to_bytes</span><span class="p">((</span><span class="mi">640</span><span class="p">,</span> <span class="mi">360</span><span class="p">))</span>
|
||
|
<span class="k">show</span> <span class="k">expression</span> <span class="n">im</span><span class="o">.</span><span class="n">Data</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s2">"screenshot.png"</span><span class="p">):</span>
|
||
|
<span class="na">align</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<p>Will show the image. The bytes objects returned can be stored in save
|
||
|
files and persistent data. However, these may be large, and care should
|
||
|
be taken to not include too many.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>size</cite></dt>
|
||
|
<dd>The size the screenshot will be resized to. If None, the screenshot
|
||
|
will be resized, and hence will be the size of the player's window,
|
||
|
without any letterbars.</dd>
|
||
|
</dl>
|
||
|
<p>This function may be slow, and so it's intended for save-like screenshots,
|
||
|
and not realtime effects.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.scry">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">scry</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.scry" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the scry object for the current statement.</p>
|
||
|
<p>The scry object tells Ren'Py about things that must be true in the
|
||
|
future of the current statement. Right now, the scry object has the
|
||
|
following fields:</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">nvl_clear</span></code></dt>
|
||
|
<dd>Is true if an <code class="docutils literal notranslate"><span class="pre">nvl</span> <span class="pre">clear</span></code> statement will execute before the
|
||
|
next interaction.</dd>
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">say</span></code></dt>
|
||
|
<dd>Is true if an <code class="docutils literal notranslate"><span class="pre">say</span></code> statement will execute before the
|
||
|
next interaction.</dd>
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">menu_with_caption</span></code></dt>
|
||
|
<dd>Is true if a <code class="docutils literal notranslate"><span class="pre">menu</span></code> statement with a caption will execute
|
||
|
before the next interaction.</dd>
|
||
|
<dt><code class="docutils literal notranslate"><span class="pre">who</span></code></dt>
|
||
|
<dd>If a <code class="docutils literal notranslate"><span class="pre">say</span></code> or <code class="docutils literal notranslate"><span class="pre">menu-with-caption</span></code> statement will execute
|
||
|
before the next interaction, this is the character object it will use.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.set_autoreload">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">set_autoreload</code><span class="sig-paren">(</span><em>autoreload</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.set_autoreload" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Sets the autoreload flag, which determines if the game will be
|
||
|
automatically reloaded after file changes. Autoreload will not be
|
||
|
fully enabled until the game is reloaded with <code class="xref py py-func docutils literal notranslate"><span class="pre">renpy.utter_restart()</span></code>.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.set_mouse_pos">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">set_mouse_pos</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>duration=0</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.set_mouse_pos" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Jump the mouse pointer to the location given by arguments x and y.
|
||
|
If the device does not have a mouse pointer, this does nothing.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>duration</cite></dt>
|
||
|
<dd>The time it will take to perform the move, in seconds.
|
||
|
During this time, the mouse may be unresponsive.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.set_physical_size">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">set_physical_size</code><span class="sig-paren">(</span><em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.set_physical_size" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Attempts to set the size of the physical window to <cite>size</cite>. This has the
|
||
|
side effect of taking the screen out of fullscreen mode.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.shown_window">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">shown_window</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#renpy.shown_window" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Call this to indicate that the window has been shown. This interacts
|
||
|
with the "window show" statement, which shows an empty window whenever
|
||
|
this functions has not been called during an interaction.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.split_properties">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">split_properties</code><span class="sig-paren">(</span><em>properties</em>, <em>*prefixes</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.split_properties" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Splits up <cite>properties</cite> into multiple dictionaries, one per <cite>prefix</cite>. This
|
||
|
function checks each key in properties against each prefix, in turn.
|
||
|
When a prefix matches, the prefix is stripped from the key, and the
|
||
|
resulting key is mapped to the value in the corresponding dictionary.</p>
|
||
|
<p>If no prefix matches, an exception is thrown. (The empty string, "",
|
||
|
can be used as the last prefix to create a catch-all dictionary.)</p>
|
||
|
<p>For example, this splits properties beginning with text from
|
||
|
those that do not:</p>
|
||
|
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="n">text_properties</span><span class="p">,</span> <span class="n">button_properties</span> <span class="o">=</span> <span class="n">renpy</span><span class="o">.</span><span class="n">split_properties</span><span class="p">(</span><span class="na">properties</span><span class="p">,</span> <span class="s2">"text_"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.substitute">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">substitute</code><span class="sig-paren">(</span><em>s</em>, <em>scope=None</em>, <em>translate=True</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.substitute" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Applies translation and new-style formatting to the string <cite>s</cite>.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>scope</cite></dt>
|
||
|
<dd>If not None, a scope which is used in formatting, in addition to the
|
||
|
default store.</dd>
|
||
|
<dt><cite>translate</cite></dt>
|
||
|
<dd>Determines if translation occurs.</dd>
|
||
|
</dl>
|
||
|
<p>Returns the translated and formatted string.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.transition">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">transition</code><span class="sig-paren">(</span><em>trans</em>, <em>layer=None</em>, <em>always=False</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.transition" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Sets the transition that will be used during the next interaction.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>layer</cite></dt>
|
||
|
<dd>The layer the transition applies to. If None, the transition
|
||
|
applies to the entire scene.</dd>
|
||
|
<dt><cite>always</cite></dt>
|
||
|
<dd>If false, this respects the transition preference. If true, the
|
||
|
transition is always run.</dd>
|
||
|
</dl>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="renpy.vibrate">
|
||
|
<code class="descclassname">renpy.</code><code class="descname">vibrate</code><span class="sig-paren">(</span><em>duration</em><span class="sig-paren">)</span><a class="headerlink" href="#renpy.vibrate" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Causes the device to vibrate for <cite>duration</cite> seconds. Currently, this
|
||
|
is only supported on Android.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="function">
|
||
|
<dt id="layout.yesno_screen">
|
||
|
<code class="descclassname">layout.</code><code class="descname">yesno_screen</code><span class="sig-paren">(</span><em>message</em>, <em>yes=None</em>, <em>no=None</em><span class="sig-paren">)</span><a class="headerlink" href="#layout.yesno_screen" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>This causes the a yes/no prompt screen with the given message
|
||
|
to be displayed. The screen will be hidden when the user hits
|
||
|
yes or no.</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>message</cite></dt>
|
||
|
<dd>The message that will be displayed.</dd>
|
||
|
<dt><cite>yes</cite></dt>
|
||
|
<dd>An action that is run when the user chooses yes.</dd>
|
||
|
<dt><cite>no</cite></dt>
|
||
|
<dd>An action that is run when the user chooses no.</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>
|
||
|
© 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>
|