Persistent

« Back to Glossary Index

A persistent variable is a special type of variable which, rather than being tied to a particular playthrough of a game, is tied to the game as a whole, independent of any save files. By default, persistent variables are used for things like volume settings, skip preferences, and text speed – things that the player can adjust, and which aren’t reset after closing the game or starting a new save file.

User-declared persistent variables can be used to do things like unlock extras screens or track which routes a player has finished so you can show them a “True” ending. You can set one up in your script with a line like default persistent.seen_good_end = False.

Ren’Py also tracks information on playthroughs behind-the-scenes which can sometimes be tapped into – things like checking which images the player has seen, which lines of dialogue have been read, or which choices they’ve made in previous playthroughs – this information is also stored using persistent variables.

For more on this topic, take a look at my collaboration Basics of Ren’Py #9: Persistent Data over on Lezalith’s website.

« Back to Glossary Index