[Solved] Save problem

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
Wertous
Regular
Posts: 27
Joined: Fri Aug 09, 2019 8:47 am
Contact:

[Solved] Save problem

#1 Post by Wertous »

Hello everyone!
I have previously read a lot of topics about save on Renpy but I never saw a solution in them
The problem I am facing is as follows
If I use some kind of screen using operator Show or renpy.show_screen let's say it's inventory and I carry out some manipulations in it - for example, I dress or remove objects from my character.
Then, after closing the screen and saving when loading, I found that all my manipulations inside the inventory were reset
I also found that if after closing the inventory I switch to another label and save there, then everything will be fine.
Also, the saves work correctly if I use the screen with the operator Call
The problem is that my inventory is shown through a imagebutton and therefore I can only use the operator Show
One of the possible solutions is to switch to another game label before saving, but the problem is that when you return to the old label, you need to initiate it completely again and not from the place where the inventory was called
I think there must be some kind of solution to this problem - I will be very grateful if you tell me how you solve it for yourself
Last edited by Wertous on Thu Mar 25, 2021 10:31 am, edited 1 time in total.

Wertous
Regular
Posts: 27
Joined: Fri Aug 09, 2019 8:47 am
Contact:

Re: Save problem

#2 Post by Wertous »

I think I almost found a solution to this problem.
Who cares - on the exit button from the inventory or any screen in which the interaction will be put in actin jump ("label_x") or call - not yet sure which is better
But the bottom line is that after closing the inventory window, the player moves to another label and the save works normally
where is label_x it just a label for the opportunity to save game correct
Earlier I was worried that I would not be able to return to the label from which I opened the inventory screen
But in fact, this turned out to be not too necessary for me - since I do not have a novel, but an RPG-style game, and all the buttons and interaction icons from the previous label are also transferred to the new one.
if there is a need to return to the label from which we opened the inventory, then it is better to use the Call operator to the "save" label, which will make it possible to return later to the next event of the original label

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Save problem

#3 Post by _ticlock_ »

Hi, Wertous,

If you have inventory button that should open inventory at any point in the label, you can use Call action with argument from_current = True to return to the same line in the label.

Code: Select all

screen inventory_button():
    imagebutton:
        idle "inventory.png"
        action Call("inventory", from_current = True)
        
screen inventory():
    ...# inventory screen

label inventory:
    call screen inventory()
    return

Code: Select all

label start:
    show screen inventory_button()
    "You can open inventory at any point in the label"
    "It will direct you to inventory and return to current statement in this label"

Wertous
Regular
Posts: 27
Joined: Fri Aug 09, 2019 8:47 am
Contact:

Re: Save problem

#4 Post by Wertous »

thank you very much for the answer!
How could I myself have not thought of such an obvious solution with a screen call
It's so obvious - I just didn't know about the argument from_current = True
Thanks again, this solves a lot of my questions

Post Reply

Who is online

Users browsing this forum: No registered users