Ren’py 7.1.3 «on the road again.»

Say Statement link

The statement is used for dialogue and narration. Since it’s
almost always the most frequently used statement in Ren’Py scripts,
the say statement has a syntax that minimizes the overhead in
writing it. Some example say statements are:

    "This is narration."

    "Eileen" "This is dialogue, with an explicit character name."

    e "This is dialogue, using a character object instead."

    "Bam!!" with vpunch

The first form of the say statement consists of a string by
itself. This form is used for narration, with the narration being the
contents of the string.

The second form consists of two strings. The first string is the name
of the character who is speaking, and the second is the dialogue being
spoken.

The third form consists of a simple expression followed by a
string. The simple expression should evaluate to either a string
giving a character name, or a Character object. In the latter case,
the character object is used to control how the dialogue is shown.

The final form consists of a string and a with clause which has a
transition. In this case, the string is shown and a screen is shaken
at the same time.

Although the precise details of what a say statement does is
controlled by the character object used, the usual effect of a say
statement is to display dialogue on the screen until the user clicks
to dismiss it, then to remove that dialogue on the screen.

Certain characters have special meaning to Ren’Py, and so can’t be
used in dialogue strings. The character begins a text tag, and
the character begins a substitution. To use them in dialogue,
double them. It may also be necessary to precede a quote with a
backslash to prevent it from closing the string. For example:

First and Third-Party Python Modules and Packages link

Ren’Py can import pure-Python modules and packages. First-party modules
and packages – ones written for the game – can be placed directly
into the game directory. Third party packages can be placed into the
game/python-packages directory.

For example, to install the requests package, one can change into the
game’s base directory, and run the command:

pip install --target gamepython-packages requests

In either case, the module or package can be imported from an init python
block:

init python
    import requests

Warning

Python defined in .rpy files is transformed to allow rollback
to work. Python imported from .py files is not. As a result,
objects created in Python will not work with rollback, and
probably should not be changed after creation.

Powerful Effects

Ren’Py can take advantage of hardware acceleration on supported computers, while falling back to software support when it’s not. This acceleration makes it possible to apply sophisticated effects to high definition images.

The Animation and Transformation Language included with Ren’Py makes it possible to animate images, move them around the screen, rotate them, adjust their scaling, and adjust their opacity. All of these can easily be changed over time.

Ren’Py ships with dozens of customizable transitions that can be invoked when a scene changes. In addition to a full set of slides, wipes, and moves, this includes:

  • Pixellation of the old scene, and unpixellation of the new one.
  • Fades to black (or another color), and then to the new scene.
  • Dissolves of the whole screen from one scene to another.
  • Image-controlled dissolves, which use an image to control which portions of the screen dissolve in first. This has been used as the basis for a variety of powerful effects, from blood spatters to transporter beams.

Bar Values link

Bar values are used with bars, to set the bar value, and to allow the bar
to adjust an underlying property. To create a new bar value, subclass
the class. All classes that have the step keyword also accept
the force_step keyword which behavior is described in .

(value=0.0, range=1.0, delay=1.0, old_value=None)

This animates a value, taking delay seconds to vary the value from
old_value to value.

value
The value itself, a number.
range
The range of the value, a number.
delay
The time it takes to animate the value, in seconds. Defaults
to 1.0.
old_value
The old value. If this is None, then the value is taken from the
AnimatedValue we replaced, if any. Otherwise, it is initialized
to value.
(channel=u’music’, update_interval=0.1)

A value that shows the playback position of the audio file playing
in channel.

update_interval
How often the value updates, in seconds.
(dict, key, range, max_is_zero=False, style=u’bar’, offset=0, step=None, action=None, force_step=False)

A value that allows the user to adjust the value of a key
in a dict.

dict
The dict.
key
The key.
range
The range to adjust over.
max_is_zero
If True, then when the value of a key is zero, the value of the
bar will be range, and all other values will be shifted down by 1.
This works both ways — when the bar is set to the maximum, the
value of a key is set to 0.
style
The styles of the bar created.
offset
An offset to add to the value.
step
The amount to change the bar by. If None, defaults to 1/10th of
the bar.
action
If not None, an action to call when the field has changed.
(object, field, range, max_is_zero=False, style=u’bar’, offset=0, step=None, action=None, force_step=False)

A bar value that allows the user to adjust the value of a field
on an object.

object
The object.
field
The field, a string.
range
The range to adjust over.
max_is_zero

If True, then when the field is zero, the value of the
bar will be range, and all other values will be shifted
down by 1. This works both ways — when the bar is set to
the maximum, the field is set to 0.

This is used internally, for some preferences.

style
The styles of the bar created.
offset
An offset to add to the value.
step
The amount to change the bar by. If None, defaults to 1/10th of
the bar.
action
If not None, an action to call when the field has changed.
(mixer)

The value of an audio mixer.

mixer
The name of the mixer to adjust. This is usually one of
«music», «sfx», or «voice», but creators can create new
mixers.
(variable, range, max_is_zero=False, style=u’bar’, offset=0, step=None, action=None, force_step=False)

A bar value that adjusts the value of a variable in a screen.

variable
A string giving the name of the variable to adjust.
range
The range to adjust over.
max_is_zero

If True, then when the field is zero, the value of the
bar will be range, and all other values will be shifted
down by 1. This works both ways — when the bar is set to
the maximum, the field is set to 0.

This is used internally, for some preferences.

style
The styles of the bar created.
offset
An offset to add to the value.
step
The amount to change the bar by. If None, defaults to 1/10th of
the bar.
action
If not None, an action to call when the field has changed.
(value=0.0, range=1.0)

This allows a value to be specified statically.

value
The value itself, a number.
range
The range of the value.
(variable, range, max_is_zero=False, style=u’bar’, offset=0, step=None, action=None, force_step=False)

A bar value that allows the user to adjust the value of a variable
in the default store.

variable
A string giving the name of the variable to adjust.
range
The range to adjust over.
max_is_zero

If True, then when the field is zero, the value of the
bar will be range, and all other values will be shifted
down by 1. This works both ways — when the bar is set to
the maximum, the field is set to 0.

This is used internally, for some preferences.

style
The styles of the bar created.
offset
An offset to add to the value.
step
The amount to change the bar by. If None, defaults to 1/10th of
the bar.
action
If not None, an action to call when the field has changed.
(viewport)

The value of an adjustment that horizontally scrolls the viewport with the
given id, on the current screen. The viewport must be defined before a bar
with this value is.

Announcement

I’m happy to announce Ren’Py 7.3.3. This release is intended to improve
performance and compatibility, fix bugs, and make available minor features
that have been added since Ren’Py 7.3.2 was released.

Some highlights are:

  • An audio directory that allows audio files to define themselves, similar
    to images.
  • The ability for Ren’Py to accept audio files generated at runtime.
  • A lowering of the version of android needed to run Ren’Py.
  • Many improvements to Web platform support.
  • Improved render-to-texture performance.
  • The ability of renpy.input to take custom screens.
  • Ren’Py is now signed and notarized to run on macOS.

Ren’Py 7.3.2 is a patch release to Ren’Py
7.3, mostly intended to fix bugs and address issues that people have
reported. As some of the bugs have significant performance and correctness
impact, everyone who upgraded to Ren’Py 7.3.0 or 7.3.1 should move on to this version.

Ren’Py 7.3.1 added a few minor new features, including the ability to
customize descriptive text.

Ren’Py 7.3 is the first release of
Ren’Py with support for running on the web platform, inside a web browser
supporting HTML 5, Web Assembly, and WebGL. Right now, this support is in
beta, as it’s limited by the capabilities of the web platform itself, but
it’s suitable for making web demos of Ren’Py games.

In addition to that, this release adds many new features to Ren’Py. These
include:

  • Many improvements to creator-defined statements, allowing the parsing
    of Ren’Py statements and block, the catching of errors, and the ability
    to execute a second function after Ren’Py in the body of a statement
    has finished.
  • Screen language improvements, like the ability to capture screen language
    displayables into a variable and to use a property to determine if a screen
    is sensitive to input.
  • Text improvements, with self-closing text tags and the ability to control
    the capitalization of interpolated text.
  • Mobile platforms now support non-rectangular focus masks, and 64-bit Android
    is supported in time for the Google Play deadline.
  • There is a new Turkish translation of the launcher and Spanish translation of
    the tutorial game, while several of the other translations have been updated.

There are also a number of other changes, so check out the changelog for all
of what’s new.

Ren’Py 7.3 is brought to you by:

  • Alisha Taylor
  • Andy_kl
  • Arda Güler
  • Ben Wright
  • DragoonHP
  • Donghyeok Tak
  • Herpior
  • Jan Beich
  • Joshua Fehler
  • Julian Uy
  • Kobaltcore
  • Lee Yunseok
  • Mal Graty
  • Moshibit
  • Nyaatrap
  • Pionere
  • Psunbury
  • Remix
  • Roope Herpiö
  • Sylvain Beucler

and myself, Tom «PyTom» Rothamel.

Downloads of Ren’Py 7.3.3 can be found at:

A full list of changes to Ren’Py can be found at:

A list of changes that may require you to update your game can be found at:

Announcement

I’m pleased to announce Ren’Py 6.99 «Here’s to the crazy ones.» This release
focuses on modernizing Ren’Py by moving to the SDL2 family of libraries. This
modernization will lead to a series of benefits, both now and in the future.

This release is being managed as a rolling release leading to Ren’Py 7.0.
New features may be added in point releases.

Perhaps the most obvious benefit is the addition of iOS support. Ren’Py can
now produce iOS apps, targeting iPhone and iOS devices. To develop for iOS,
you will need a Macintosh computer and paid iOS developer license, and will
need to customize the interface to conform to iOS policies.

In addition, this release includes:

  • Rewritten Android support, based on SDL2. Among other things, Android now
    supports the onscreen keyboard, rotating the screen, and bidirectional text.
  • Audio playback, using the same code on desktop and mobile platforms, so the
    same audio files can be used on all platforms Ren’Py supports.
  • Support for Input Methods (IMEs), allowing text entry in non-English languages.
  • A high-level achievement API, including support for Steam achievements. (Steam
    support will be made available on request to Steam developers.)
  • Improved support for custom text tags.
  • A Russian translation of the tutorial game, and a Finnish translation of
    the launcher.

To this, the 6.99.2 release adds:

  • Support for the images directory. Image files placed into this directory
    are automatically defined as images in Ren’Py,
  • The new AlphaMask displayable, which allows the alpha channel of one
    displayable to be masked by that of another.

The 6.99.4 release adds:

  • The new default statement, which is used to set the initial value of a
    variable in a game.
  • Support for the transclusion of screen language code inside use statements,
    and support for creator-defined screen language statements.

The 6.99.5 release adds:

  • Much faster startup, especially on mobile platforms.
  • Better support for iOS 8.
  • Many other small features.

These releases also include a number of other fixes and improvements.

We’d like to thank Patrick Dawson for writing much of the code of Pygame_SDL2,
a new, SDL2-based implementation of the Pygame API, and Chris Mear, who created
the initial iOS port of Ren’Py that our current support is based on. Other
contributors include:

  • Asfdfdfd
  • Baekansi
  • Bbs3223474
  • Beuc
  • Caryoscelus
  • Daniel Luque
  • Denzil
  • Diapolo10
  • Evilantishad0w
  • Giuseppe Bertone
  • Huang Junjie
  • Javimat
  • Konstantin Nikolayev
  • Kyouryuukunn
  • Lapalissiano
  • Nolanlemahn
  • Renoa
  • RangHo Lee
  • rivvil
  • Tlm-2501
  • Zigmut

and myself, Tom «PyTom» Rothamel.

Downloads of Ren’Py 6.99 can be found at:

A full list of changes to Ren’Py can be found at:

A list of changes that may require you to update your game can be found at:

Simple Scripting Language

Ren’Py allows visual novels to be written in a simple scripting language. Here’s a small excerpt from a game:

label family:
    scene bg beach2
    with dissolve

    "It wasn't long before Mary broke the silence, by asking me a question."

    show mary dark smiling
    with dissolve

    m "I told you a little about my family... but I haven't asked you about yours yet. What's your family like?"

    p "When I'm on the island here, I live with my aunt and uncle, but back home, I live with my mother, father, and sister."

    m "A sister? Is she older or younger?"

As you can see, this example, taken from a working Ren’Py script doesn’t require much extra typing when compared just simply typing in the script for the game. It even lets you abbreviate character names, letting you write instead of «Mary».

Ren’Py lets you define characters and images in a central place, making it easy to change the game. Scripts also provide consistency, ensuring that the placement of text and images does not inadvertently change throughout the game.

Unlike other engines that force you to use particular tools, the Ren’Py script language works with whatever text editors and other tools you choose. While we include the jEdit text editor, there’s nothing forcing you to use it if you have another editor you like better. Other third-party tools can check your game’s spelling, or show you the differences between two versions of the game.

Archives link

Ren’Py supports combining files into a simple archive format. While
not very secure, this protects files from casual copying.

By default, all files classified into the «archive» file list will be
placed in an archive.rpa archive, which is included in the all file
list.

By calling build.archive, it’s possible to declare a new archives and
the file lists they will be included in. (It’s rare to use anything
but the all file list, however.) To use an archive, classify files
into a list with its name.

For example, the following will archive images in images.rpa, and
game scripts into scripts.rpa:

# Declare two archives.
build.archive("scripts", "all")
build.archive("images", "all")

# Put script files into the scripts archive.
build.classify("game/**.rpy", "scripts")
build.classify("game/**.rpyc", "scripts")

# Put images into the images archive.
build.classify("game/**.jpg", "images")
build.classify("game/**.png", "images")

If an archive file is empty, it will not be built.

Featured Games

Ren’Py has been used to create over 1,500 visual novels, games, and other works. You can find them at the official
Ren’Py Games List, and the list of Games made with Ren’Py on itch.io.

Here are just a few of the games made with Ren’Py.


SC2VN, set in the South Korean professional StarCraft 2 gaming scene.


King of the Cul-De-Sac
makes great uses of Ren’Py’s animation language and interactivity.

Highway Blossoms, the tale of two
girls’ epic road trip through the American southwest.


Over the Hills and Far Away
the story of a redcoat and a Shawnee girl, on the run through the colonial-era Northwest Territory.

The desktop version of Doki Doki Literature Club makes
use of Ren’Py to be more than it appears to be.

Additional Downloads

Raspberry Pi Support: renpy-7.3.0-raspi.tar.bz2
Contains files required to allow Ren’Py to run on the Raspberry Pi. This should be untarred in the Ren’Py sdk directory.
Ren’Py Source Code: renpy-7.3.0-source.tar.bz2
Contains the source code of the Ren’Py distribution without any binary components.
Pygame_SDL2 Source Code: pygame_sdl2-2.1.0-for-renpy-7.3.0.tar.gz
Contains the source code for the version of pygame_sdl2 required to run this version of Ren’Py. This may be newer than any released version of pygame_sdl2.
Other Dependencies: https://www.renpy.org/doc/html/license.html
Ren’Py contains free software licensed under a number of licenses, including the GNU Lesser
General Public License. A full list of software and links to git repositories from which the software
can be downloaded is linked above.
Checksums: checksums.txt
Checksums for the various files making up the Ren’Py distribution.

We also maintain a complete list of releases.

renpy.random link

This object is a random number generator that implements
the Python random number generation interface.
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:

renpy.random.random()

Return the next random floating point number in the range (0.0, 1.0).

renpy.random.randint(a, b)

Return a random integer such that a <= N <= b.

renpy.random.choice(seq)

Return a random element from the non-empty sequence seq.

renpy.random.shuffle(seq)

Shuffles the elements of the sequence seq in place. This does not return
a list, but changes an existing one.

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.

# return a random float between 0 and 1
$ randfloat = renpy.random.random()

# return a random integer between 1 and 20
$ d20roll = renpy.random.randint(1, 20)

# return a random element from a list
$ randfruit = renpy.random.choice()

renpy.random.Random(seed=None)

Returns a new random number generator object separate from the main one, seeded
with the specified value if provided.

Interpolating Data link

Ren’Py supports interpolating data into the text string before it is
displayed. For example, if the player’s name is stored in the
variable, one could write a line of dialogue like:

g "Welcome to the Nekomimi Institute, !"

Ren’Py will interpolate variables found in the global store. When
using a text widget in a screen, Ren’Py will also interpolate screen
local variables. (This can be overridden by supplying an explicit
scope argument to the Text displayable.)

Ren’Py isn’t limited to interpolating simple variables. It can also
interpolate fields and components of tuples. So it’s possible to have:

g "My first name is ]."

It’s possible to apply formatting when displaying numbers. This
will display a floating point number to two decimal places:

$ percent = 100.0 * points  max_points
g "I like you  percent!"

Ren’Py’s string interpolation is taken from the PEP 3101 string
formatting syntax. Ren’Py uses [ to introduce string formatting
because { was taken by text tags.

Along with the and conversion flags supported by Python, Ren’Py
supports several more flags. The conversion flag ensures that
text tags are properly quoted, so that displaying a string will not
introduce unwanted formatting constructs. For example:

g "Don't pull a fast one on me, ."

The flag will translate the interpolated string:

if points > 5
    $ mood = _("happy")
else
    $ mood = _("annoyed")

g "I'm  to see you."

Announcement

I’m happy to announce Ren’Py 7.1.3. This is the third bug release for Ren’Py
7.1, which improves Ren’Py while fixing issues. (There was a language bug in
7.1.2 that necessitated a quick re-release. The rest of these notes apply
to 7.1.2.)

There have also been a few feature additions. Some of the highlights are:

  • Transforms that are used once in a screen can now be defined inline.
  • Choice menus can now display as insensitive buttons items selected by the
    if clause.
  • It is now possible to set variables inside a used screen.
  • Ren’Py can now automatically detect the language of the player’s system
    and select the correct translation.
  • The French, German, Korean, Russian, and Simplified Chinese translations
    have been updated.

Some of the more important bugfixes include:

  • A bug that caused Arabic text to display as squares on Windows has been fixed.
  • Lint now handles several cases correctly, including layered images.
  • As Ren’Py generally could not created proper android packages with a 32-bit
    Java 8, it now requires a 64-bit Java Development Kit.

Ren’Py 7.1.3 is brought to you by:

  • Alexandre-T
  • Andy_kl
  • Bryan Tsang
  • Craig P. Donson
  • Felix Lampe
  • Joshua Fehler
  • Konstantin Mozheyko
  • Lee Yunseok
  • Max le Fou
  • Moshibit
  • Muhammad Nur Hidayat Yasuyoshi
  • Ria-kon
  • Saltome
  • Shehriyar Qureshi
  • Sylvain Beucler
  • nyaatraps
  • philat
  • Vollschauer
  • Xavi-mat
  • Xela
  • Zedraxlo

and myself, Tom «PyTom» Rothamel.

Downloads of Ren’Py 7.1.3 can be found at:

A full list of changes to Ren’Py can be found at:

A list of changes that may require you to update your game can be found at:

Additional Downloads

Raspberry Pi Support: renpy-6.99.12.4-raspi.tar.bz2
Contains files required to allow Ren’Py to run on the Raspberry Pi. This should be untarred in the Ren’Py sdk directory.
Ren’Py Source Code: renpy-6.99.12.4-source.tar.bz2
Contains the source code of the Ren’Py distribution without any binary components.
Pygame_SDL2 Source Code: pygame_sdl2-2.1.0-for-renpy-6.99.12.4.tar.gz
Contains the source code for the version of pygame_sdl2 required to run this version of Ren’Py. This may be newer than any released version of pygame_sdl2.
Other Dependencies: https://www.renpy.org/doc/html/license.html
Ren’Py contains free software licensed under a number of licenses, including the GNU Lesser
General Public License. A full list of software and links to git repositories from which the software
can be downloaded is linked above.
Checksums: checksums.txt
Checksums for the various files making up the Ren’Py distribution.

We also maintain a complete list of releases.

Audio Namespace link

The and statements evaluate their arguments in the
audio namespace. This means it is possible to use the define statement
to provide an alias for an audio file.

For example, one can write:

define audio.sunflower = "music/sun-flower-slow-jam.ogg"

and then use:

play music sunflower

Ren’Py will also automatically place sound files in the audio name face,
if found in the directory. Files in this directory with a
supported extension (currently, .wav, .mp2, .mp3, .ogg, and .opus) have the
extension stripped, the rest of the filename forced to lower case, and are
placed into the audio namespace.

Note that just because a file is placed into the audio namespace, that doesn’t
mean it can be used. So while you could play a file named «opening_song.ogg»
by writing:

play music opening_song

Classifying and Ignoring Files link

The build process works by first classifying files in the Ren’Py
distribution and your game into file lists. These file lists are then
added to package files.

The classification is done by the build.classify function. It takes a
patterns and a space-separated list of filenames. Patterns are matched
from first to last, with the first match taking precedence (even if a
more-specific pattern follows.) Patterns are matched with and without
a leading /. Patterns may include the following special characters:

The directory separator.
*
Matches all characters except for the directory separator.
**
Matches all characters.

For example:

**.txt
Matches all txt files.
game/*.txt
Matches txt files in the game directory.

There are seven file lists that files can be classified into by
default. (Ren’Py places its own files into the first six of these.)

all
These files will be included in all packages, and in Android
builds.
linux
These files will be included in packages targeting Linux.
mac
These files will be included in packages targeting Macintosh.
windows
These files will be included in packages targeting Windows.
renpy
These files will be included in packages that require the Ren’Py
engine files. (Linux, Macintosh, and Windows.)
android
These files will be included in Android builds.
archive
These files will be included in the archive.rpa archive.

Files that are not otherwise classified are placed in the «all» file
list.

To exclude files from distribution, classify them as None or the
empty string.

For example:

Advanced Configuration link

The following variables provide further control of the build process:

= True

If true, empty directories (including directories left empty by
file archiving) will be removed from generated packages. If false,
empty directories will be included.

= «{directory_name}-dists»

Gives the path to the directory the archive files will be placed in. This
may be an absolute or a relative path. A relative path is considered to
be relative to the projects directory.

The following values are substituted in using Python’s function.

The value of build.directory_name.
The value of build.executable_name.
The value of build.version.
= True

Allows Ren’Py to run on the integrated GPU on platforms that have both
integrated and discrete GPUs. Right now, this is only supported on Mac
OS X.

= True

When true, files required to support themes that existed before Ren’Py
6.99.9 will be included in the build. When false, such files are excluded.

This is set to False when is called.

= None

Setting this allows the Ren’Py launcher to upload your project to
itch.io. This should be set to the name of a project registered
with itch. (For example, «renpytom/the-question»).

Once this is set, after the distributions have been built, you can
click «Build distributions», «Upload to itch.io» to cause an upload
to occur.

Unsanctioned Translations link

Note

It’s best to ask a game’s creators for permission before
creating an unsanctioned translation.

Ren’Py includes a small amount of support for creating translations
without the active assistance of the game’s creators. This support
consists of the ability to automatically create a string translation
file from all of the strings in the game. Since string translations
are used for untranslated dialogue, this technique makes it possible
to translate a game.

To create a string translation file, perform the following steps:

  • Set the RENPY_LANGUAGE environment variable to the language you want
    to translate to.
  • Set the RENPY_UPDATE_STRINGS environment variable to a non-empty
    value.
  • Play through the game until all text is seen.

This will update the «game/tl/language/strings.rpy» file with a
translation template that contains all of the strings in it.

If a game doesn’t include support for changing the language, it may be
appropriate to use an block to set
to the target language.

Along with the use of string translations for dialogue, unsanctioned
translators may be interested in using the techniques described above
to translate images and styles.

Slow Text Concerns link

Ren’Py allows the creator or user to indicate that text should be
displayed slowly. In this case, Ren’Py will render the text to a
texture, and then draw rectangles from the texture to the screen.

Unfortunately, this means that it’s possible to get rendering
artifacts when characters overlap. To minimize these rendering
artifacts, ensure that the and
properties are large enough that lines do not
overlap. If the bottoms of characters on the first line are clipped,
especially if line_spacing is negative, consider increasing
.

Horizontal artifacts are also possible when characters are kerned
together, but these artifacts are less severe, as they exist for only
a single frame.

Cross Platform — Computer and Mobile

One of Ren’Py’s biggest advantages is that runs on almost every computer. There are three primary platforms we support:

  • Windows XP+ (x86)
  • Mac OS X 10.6+ (x86_64)
  • Linux (x86, x86_64)

The Ren’Py launcher makes it possible to build versions of Ren’Py games for all three from any of these three platforms, making it possible to develop (for example) Mac and Linux versions on Windows.

Ren’Py games are not dependent on any other software on these platforms. There’s no need for your users to download runtimes, drivers, codecs, or anything like that. If a user has one of the supported platforms, Ren’Py will run. (Even if not, Ren’Py is written using portable technologies like pygame, and so can probably be made to run.)

Supporting Flags using the Default, Python and If Statements link

While some games can be made by only using the statements given above,
other games requires data to be stored and recalled later. For example,
it might make sense for a game to remember a choice a player has made,
return to a common section of the script, and act on the choice later. This
is one of the reasons why Ren’Py has embedded Python support.

Here, we’ll show how to store a flag containing information about a choice
the player has made. To initialize the flag, use the default statement, before
label start.

# True if the player has decided to compare a VN to a book.
default book = False

label start

    s "Hi there! How was class?"

The book flag starts off initialized to the special value
(as with the rest of Ren’Py, capitalization matters), meaning that
it is not set. If the book path is chosen, we can set it to True
using a Python assignment statement.

label book

    $ book = True

    m "It's like an interactive book that you can read on a computer or a console."

    jump marry

Lines beginning with a dollar-sign are interpreted as Python statements. The
assignment statement here assigns a value to a variable. Ren’Py has support
for other ways of including Python, such as a multi-line Python statement,
that are discussed in other sections of this manual. Ren’Py supports Python 2.7,
though we strongly recommend you write Python that runs in Python 2 and Python 3.

To check the flag, use the statement:

if book

    "Our first game is based on one of Sylvie's ideas, but afterwards I get to come up with stories of my own, too."

If the condition is true, the block of script is run. If not, it is skipped.
The statement can also take an clause, that introduced a block of
script that is run if the condition is false.

if book

    "Our first game is based on one of Sylvie's ideas, but afterwards I get to come up with stories of my own, too."

else

    "Sylvie helped with the script on our first video game."

Names in the Store link

The default place that Ren’Py stores Python variables is called the
store. It’s important to make sure that the names you use in the
store do not conflict.

The define statement assigns a value to a variable, even when it’s
used to define a character. This means that it’s not possible to
use the same name for a character and a flag.

The following faulty script:

define e = Character("Eileen")

label start

    $ e = 

    e "Hello, world."

    $ e += 1
    e "You scored a point!"

will not work, because the variable is being used as both a
character and a flag. Other things that are usually placed into
the store are transitions and transforms.

Partial Playback link

Ren’Py supports partial of audio files. This is done by putting a playback
specification, enclosed in angle brackets, at the start of the file.
The partial playback specification should consist of alternating
property name and value pairs, with every thing separated by spaces.

The values are always interpreted as seconds from the start of the file.
The three properties are:

Specifies the position in the file at which the first play-through
begins playing. (This defaults to 0.0 seconds.)
Specifies the position in the file at which the file ends playing.
(This defaults to the full duration of the file.)
Specifies the position in the file at which the second and later
play-throughs begin playing. (This defaults to the start time
given by if specified, or to the start of the file.)

For example:

play music "<from 5 to 15.5>waves.opus"

will play 10.5 seconds of waves.opus, starting at the 5 second mark. The statement:

play music "<loop 6.333>song.opus"

Оцените статью
Рейтинг автора
5
Материал подготовил
Андрей Измаилов
Наш эксперт
Написано статей
116
Добавить комментарий