Hey, guys.
Over the last couple of weeks, I've had a couple of PC auto shutdowns and graphics driver updates that caused my games to crash, meaning that their persistent data never got saved.
I found that annoying (especially since gallery unlocks, read lines, etc, are almost always contained in that file), so I wanted to write a small script that people would be able to add to their games to auto-save.
Now, programmatically saving persistent data is extremely easy. Just simply need to call:
My problem lies with being able to do the saving automatically, say, every 15 minutes.
I tried two methods (with a 60 second interval to simplify testing), but both failed in different ways with the games I tested.
The following are from the scenarios I tested on the game "Luke's Way", which is using
Method A (renpy.ui.timer):
With this method I get a console output of
But as time goes by, the
Method B:
With this method, the console output is simply:
Can anybody explain what I'm doing wrong or give me an alternative to running a timer / repeating timed event in Ren'Py? Preferably something that is supported in old versions as well?
Over the last couple of weeks, I've had a couple of PC auto shutdowns and graphics driver updates that caused my games to crash, meaning that their persistent data never got saved.
I found that annoying (especially since gallery unlocks, read lines, etc, are almost always contained in that file), so I wanted to write a small script that people would be able to add to their games to auto-save.
Now, programmatically saving persistent data is extremely easy. Just simply need to call:
Code:
renpy.save_persistent()
I tried two methods (with a 60 second interval to simplify testing), but both failed in different ways with the games I tested.
The following are from the scenarios I tested on the game "Luke's Way", which is using
Ren'Py 7.3.5.606
:Method A (renpy.ui.timer):
Code:
ui.timer(60.0, renpy.save_persistent, True)
Code:
<Timer at {some memory address}>
save_persistent
method never seems to get calledMethod B:
Code:
timer 60.0 repeat True action renpy.save_persistent
Code:
File "game/zzz_persistentTimer.rpy", line 2: expected statement.
timer 60.0 repeat True action renpy.save_persistent
^