Page 1 of 1

Save and load

Posted: Wed Mar 10, 2010 1:19 pm
by nibl
Confused newbie question: I can't figure out how you save and load persistent data, or where the data is. I know it's supposed to be in ~/.renpy/persistent (on Linux) but that directory is empty. My game doesn't even show a "save game" option in the menu.

What I need to do is save and load specific values like scores. I tried the following after searching the forums and reference pages, but this caused the game to freeze and not load at all.

Code: Select all

$ persistent.myval = 22
$ renpy.save("SaveFile1")

$ renpy.load("SaveFile1")
$ myval = persistent.myval
Thanks.

Re: Save and load

Posted: Wed Mar 10, 2010 6:48 pm
by JQuartz
nobl wrote:I can't figure out how you save and load persistent data
You can just set it as a variable without needing to save or load it, like so:

Code: Select all

label start:
    $ myval = persistent.myval
    "Game"
    "End"

    if highscore:
        jump highscore_set
    $ renpy.full_restart()

label highscore_set:
    $ persistent.myval = 22