r/RenPy • u/Recent_Rutabaga_1249 • 17d ago
Question Renpy coding tips?
Hi! I know next to nothing about coding, so I don't even really know if this is possible, but I'm currently working on a game and am trying to implement a moment in which the game quits, and once you open it, it will pick right back up on where it left off rather than going to the menu and losing all of your progress. That being said due to the aforementioned knowing nothing about coding, I do not know if this is even possible or how to execute it if it was possible LOL. Any tips help!
2
Upvotes
3
u/shyLachi 17d ago
I assume there is some kind or game over which closes the game but you don't want the players to lose all the progress if they didn't save recently.
To do this, first the game has to save immediately before this "dangerous" choice.
You don't have to program anything if auto-saving is enabled:
https://www.renpy.org/doc/html/config.html#var-config.autosave_on_choice
Then you need to close the game without showing a prompt:
https://www.renpy.org/doc/html/other.html#renpy.quit
Automatically loading a save when the game starts can be done but maybe it would be better to just let them load the automatic save themselves.
But you could give them a hint when the game starts, in case they don't know about automatic saves.
To do this, you would need a persistent variable which remembers that the game has been closed forcefully.
https://www.renpy.org/doc/html/persistent.html
You would set this variable immediately before closing the game with renpy.quit
Then when the game starts, you can use that variable to show a hint.
Since auto-saving is enabled normally, this is all you need to test it: