At times, saves will load to a screen instead of the saved location

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
meyaoi
Regular
Posts: 61
Joined: Thu Dec 03, 2015 6:07 am
Tumblr: meyaoigames
Deviantart: meyaoi
Contact:

At times, saves will load to a screen instead of the saved location

#1 Post by meyaoi »

Hello there, I have an issue that I've been mulling over for weeks, but never managed to find an answer.

My issue is that, my game's saves will sometimes load to a certain screen (that was shown before saving) instead of the saved location. This doesn't happen every time, and from my experience so far, has been happening pretty randomly, but it is always the same screen (even though there are gazillion other custom screens in-game). Also, it always only happens after the screen is shown at least once, but it usually works just fine until the screen is shown 10-20 times.

Those reasons above made me come to the conclusion that the screen is in fault here, but I'm not really sure what I did wrong. I mean, most times it is working just fine (both the saves and the screen), it's just that after players start using the save function a LOT (saving and reloading often), the save file will be broken (by "roll-backing" to that particular screen, for some reason)

This can get confusing, so actual example of the issue is like below:
1. Day variable is 14, the screen is shown
2. The screen has been hidden, the game is saved in a dialogue section, and day variable is 17
3. When the save for the day 17's data is loaded, the game is redirected to the screen AND the day variable reverts to 14.

EDIT: I used an external save editor to check the variable value saved in the .SAVE file and apparently, the day variable is indeed 17 in that save file. It's just that, when it is loaded, somehow the variable changes to 14...

My method of using the screen:
1. I'm showing the screen on a different layer, which is a custom layer called "bglayer", which is positioned under the "master" layer. I'm doing this to ensure that the screen is below any say dialogue.
2. After certain part of the screen is clicked, the dialogues are shown (the screen is not hidden because it stays below the dialogue. I need the screen to stay below there & visible)
3. After the scene is done, I finally hide the custom screen by using renpy.scene for the "bglayer" layer.

I've tried multiple ways to fix the issue, with methods below:
1) Part of the code was bad, in that I sometimes mixed up "call" and "jump" (there were some "call" labels without a "return"). That has been fixed since then, but the error stays the same.
2) I was using the old method of defining variable, using $ instead of default (was said to make reloading a mess). The variables have now been defined properly using default / define. Error still persists.
3) Might not really applicable here, since I'm not trying to save any data from screen, but I was also using $ renpy.retain_after_load() before calling my screen, which doesn't really change anything.

I no longer have any idea to even attempt at this point, so any sort of suggestion is appreciated!
Last edited by meyaoi on Tue Oct 09, 2018 9:16 am, edited 1 time in total.

User avatar
meyaoi
Regular
Posts: 61
Joined: Thu Dec 03, 2015 6:07 am
Tumblr: meyaoigames
Deviantart: meyaoi
Contact:

Re: At times, saves will load to a screen instead of the saved location

#2 Post by meyaoi »

Bumping this question...

Prussan
Newbie
Posts: 3
Joined: Mon Oct 10, 2016 9:11 pm
Contact:

Re: At times, saves will load to a screen instead of the saved location

#3 Post by Prussan »

I'm having exactly the same problem, except mine is persistent, it happens every time (and it's utterly maddening).

Also, interestingly, when I've set the game up to autoreload when the script is saved, and the game is at a point after that screen, it will reload to the screen, instead of the place the game was at prior to autoreload.

It's incredibly frustrating, and I have no idea what to do about it.


Defining the screen:

Code: Select all

screen TM1:
    zorder 99
    imagemap:
        idle "images/Town Map.png"
        hotspot (195,135,90,90) clicked ui.callsinnewcontext("campground")
And calling the screen:

Code: Select all

label TownMap:
    $renpy.notify("Click on the campground to move there")
    call screen TM1

label campground:
    scene forest
Here's what the problem looks like for me (gif):
Image

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: At times, saves will load to a screen instead of the saved location

#4 Post by philat »

OP: Nobody can help you without code.



Prussan wrote: Wed Oct 10, 2018 11:12 pm

Code: Select all

screen TM1:
    zorder 99
    imagemap:
        idle "images/Town Map.png"
        hotspot (195,135,90,90) clicked ui.callsinnewcontext("campground")
Don't use callsinnewcontext. Jump.

Prussan
Newbie
Posts: 3
Joined: Mon Oct 10, 2016 9:11 pm
Contact:

Re: At times, saves will load to a screen instead of the saved location

#5 Post by Prussan »

I tried using jump first, but I couldn't get it to work. I get the "u'jump' is not a keyword argument or valid child for the hotspot statement" parsing error.

Using callsinnewcontext was the only way I could get it to behave.

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: At times, saves will load to a screen instead of the saved location

#6 Post by xavimat »

Prussan wrote: Thu Oct 11, 2018 1:22 am I tried using jump first, but I couldn't get it to work. I get the "u'jump' is not a keyword argument or valid child for the hotspot statement" parsing error.

Using callsinnewcontext was the only way I could get it to behave.
Try Jump instead of jump. Python and renpy are case sensitive.
New contexts are tricky and used for short labels; save/load work differently on them.

Also (some suggestions not related to this problem) try to update your code to current renpy standards. Use always parenthesis on screen definitions, even empty, use action instead of clicked, avoid the very old ui. functions.
Last edited by xavimat on Thu Oct 11, 2018 1:53 am, edited 1 time in total.
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)


Prussan
Newbie
Posts: 3
Joined: Mon Oct 10, 2016 9:11 pm
Contact:

Re: At times, saves will load to a screen instead of the saved location

#8 Post by Prussan »

Wonderful, thank you all so much. That seems to have fixed the problem (I did have to resave and load from a new save though, because the old one still wanted to load to the screen for some reason).

It's been ages since I did any coding, and I've very new to Ren'Py, so I'll remember all this in future. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users