Working with Ren’Py:
- Part 1: Downloading and Configuring
- Part 2: Editing and Creating Characters
- Part 3: Scenes and Showing Images
- Part 4: Menus, Labels, and Jumps
- Part 5: Variables and Conditional Statements
- Part 6: Transitions
- Part 7: Building Distributions
- Part 1: Screen Language
- Part 2: Position Style Properties
- Part 3: Animation and Transformation Language
- Part 4: Text and Button
- Part 5: Bar and VBar
- Part 6: Textbutton and Imagebutton
- Part 7: Input, Key, and Mousearea
- Part 1: Editing options.rpy
- Part 2: Editing gui.rpy
- Part 3: Style Inspector and Overriding Styles
- Part 4: Special Screen Names and Overriding Screens
- Part 5: Replacing Default GUI Images
Ren’Py + Python:
- Part 1: Setting and Using Flags
- Part 2: Python Blocks
- Part 3: User-Defined Displayables
- Part 4: User-Defined Statements
- Part 5: Custom Text Tags
Ren’Py is a engine for creating visual novels. It comes with a suite of tools for taking code and transforming it into programs that can be run on Windows, Mac, Linux, and even, with a little more work, mobile platforms like Android and iOS.
Beyond the showing of text and images, Ren’Py can also be extended through introducing new user interface elements, changing its defaults images, and combining Python with its own code to create even more interactive projects.
In visual novel terminology, a “flag” is some type of signal that tells a project to go down a new path or do something different than it would have normally done. In Ren’Py, a “flag” is a variable created in Python and used in conjunction with conditional statements.
Because flags are variables in Python, this also means that all data types are available. Everything from simple integers to more complex dictionaries can be used as part of a project in Ren’Py.
Using Flags with Conditional Statements
Once created, variables can be used as part of conditional statements. Beyond testing if a boolean is true or false, other comparisons can be carried out as well.
As variables, flags can also be updated. However, as Python is separate from Ren’Py’s own dialect, any lines containing Python code need to start with a dollar sign, $.
Through combining variables with other functionality in Ren’Py, it is possible to create repeating dialogue actions that loop based on a value.
In this example, a single menu choice “Climb the stairs” repeats as long as the value of steps is less than four.
GitHub Gist Version: