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.
Tells Ren'Py that a choice is coming up soon. This currently has two effects:
Resets the game runtime counter.
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.
Attempts to free some memory. Useful before running a renpygame-based minigame.
Causes Ren'Py to restart, returning the user to the main menu.
Returns the game runtime counter.
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.)
A generator that yields a log of image loading activity. For the last 100 image loads, this returns:
The entries are ordered from newest to oldest.
The image load log is only kept if config.developer = True.
Returns the size of the physical window.
Returns a dictionary, giving information about the renderer Ren'Py is currently using. The dictionary has one required key:
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 code is finished).
Gets the attributes associated with the current say statement, or None if no attributes are associated with this statement.
This is only valid when executing or predicting a say statement.
This attempts to find an image to show as the side image.
It begins by determining a set of image attributes. If image_tag is given, it gets the image attributes from the tag. Otherwise, it gets them from the currently showing character.
It then looks up an image with the tag prefix_tag and those attributes, and returns it if it exists.
If not_showing is True, this only returns a side image if the image the attributes are taken from is not on the screen.
Returns true if the current line has been seen by the player.
If ever 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.
This loads the Ren'Py module named name. A Ren'Py module consists of Ren'Py code 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.
All init code in the module is run before this function returns. An error is raised if the module name cannot be found, or is ambiguous.
Module loading may only occur from inside an init block.
Causes Ren'Py to display the message using the notify screen. By default, this will cause the message to be dissolved in, displayed for two seconds, and dissolved out again.
This is useful for actions that otherwise wouldn't produce feedback, like screenshots or quicksaves.
Only one notification is displayed at a time. If a second notification is displayed, the first notification is replaced.
Causes Ren'Py to pause. Returns true if the user clicked to end the pause, or false if the pause timed out or was skipped.
This causes Ren'Py to exit entirely.
Saves a screenshot in filename.
Attempts to set the size of the physical window to size. This has the side effect of taking the screen out of fullscreen mode.
Causes the device to vibrate for duration seconds. Currently, this is only supported on Android.
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.
This object is a random number generator that implements the Python random number generation interface. Randomness can be generated by calling the the various methods this object exposes. See the Python documentation for the full list, but the most useful are:
Return the next random floating point number in the range (0.0, #0).
Return a random integer such that a <= N <= b.
Return a random element from the non-empty sequence seq.
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(['apple', 'orange', 'plum'])