code, howto, Ren'Py

Ren’Py + Python: Part 4: User-Defined Statements

1_Logo

Working with Ren’Py:

Advanced Ren’Py:

Customizing Ren’Py:

Ren’Py + Python:

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.


 

User-Defined Statements

Like Displayables, authors can also create their own statements.

Note: While user-defined disaplayables can be written within a script.rpy file before the start label, user-defined statements must be added BEFORE any other files that use them. Because Ren’Py loads files based on their names, it is highly recommended to use numbers in its filename.

User-defined statements need a minimum of three properties defined as functions: parse, parse the statement and return an object; execute, function that is called when the statement executes; and lint, checks the statement and should call renpy.error to report errors.

Note: User-defined statements must also use the python early block to signal that the statements should be parsed before any other.

Screenshot 2018-07-26 05.54.19

Screenshot 2018-07-26 05.58.04

Screenshot 2018-07-26 05.58.59

GitHub Gist Version:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s