Save and load

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
nibl
Regular
Posts: 36
Joined: Sun Feb 14, 2010 2:59 am
Projects: Lit - Literacy Teaching Game
Contact:

Save and load

#1 Post by nibl » Wed Mar 10, 2010 1:19 pm

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.

User avatar
JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Save and load

#2 Post by JQuartz » Wed Mar 10, 2010 6:48 pm

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
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Nikel