[Solved] Can Not Load a Saved Game

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
bitgraphic
Regular
Posts: 54
Joined: Fri Aug 02, 2013 8:53 pm
Location: Japan
Contact:

[Solved] Can Not Load a Saved Game

#1 Post by bitgraphic »

Hey guys. I'm having strange problem.
I can save the game, but when I load it, it always starts from the beginning.

I don't think I can fix this problem myself.
Please give us your hand.
Last edited by bitgraphic on Sun Nov 17, 2013 7:10 am, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Can Not Load a Saved Game

#2 Post by xavimat »

Hi, bitgraphic. I'm looking at your code. There are some things I think are not used in the correct way:

- You are defining the images in a label, when the documentation (http://www.renpy.org/doc/html/displayin ... -statement) says "The image statement must be run at init-time, before game code runs."

- Also, you put "if" statements in "init" blocks; the "init" are only run when the program starts, then, the change of the variable "lang" later won't affect the code run in the init. You are using it to define images according to the variable "lang", but RenPy has a simpler way to "translate" images that include text in them ( http://www.renpy.org/doc/html/translati ... anslations )

- The are some translations you are not using, like "YES" and "NO", you define two labels with menus (one in English and one in Japanese) when you can simply translate "YES", "NO" in the tl/jpn/options.rpy file.

- The use of "config.language = persistent.lang" (script.rpy, line 14) seems weird to me. When the init code is run and finds that your persistent.language is not None this only means that the game has been already run, and the language has been already chosen, therefore, the config.language does nothing (it's only used to set the default language of the game, once the language has been chosen, the variable that stores the language is _preferences.language, that "should be treated as a read-only variable".

- You are using "config.main_menu.insert". According to the documentation, the list config.main_menu = [ ... ] is used to set "The default main menu, when not using screens."

I think that the combination of this things *could* be the reason that Renpy doesn't know how to save your games.

As a solution, I can only say how I'm doing the "language selection" thing. I put the "if" statements directly in the screen main_menu, more or less:

Code: Select all

screen main_menu:
    tag menu
    
    if _preferences.language is None:
        textbutton "English" action Language("english")
        textbutton "Spanish" action Language("spanish")
    else:
        textbutton _("Start Game") action Start()
        # more Main Menu buttons ...
        
As you need screen-size choice too, you could do something like:

Code: Select all

screen main_menu:
    if persistent.lang_chosen is None:
        use screen_lang_choose
    elif persistent.size_chosen is None:
        use screen_size_choose
    else:
        # The normal Main Menu
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

bitgraphic
Regular
Posts: 54
Joined: Fri Aug 02, 2013 8:53 pm
Location: Japan
Contact:

Re: Can Not Load a Saved Game

#3 Post by bitgraphic »

@xavimat
Hey there. It worked after I moved defining images at the script.rpy.
Thanks a bunch!

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: [Solved] Can Not Load a Saved Game

#4 Post by xavimat »

You're welcome! :D
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Lucyper