Wrong inheritance about save and persistent data

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
yuuri88
Newbie
Posts: 20
Joined: Fri Aug 02, 2019 11:58 am
Contact:

Wrong inheritance about save and persistent data

#1 Post by yuuri88 »

This is a wired question. When I save at the old version, the newer version can see what I save in this computer. It also happen on many questions as screen resolution and the persistent data I made from script.

How can I let these settings can't be inherit from old version :?: :cry: :cry:

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Wrong inheritance about save and persistent data

#2 Post by hell_oh_world »

yuuri88 wrote: Thu Aug 29, 2019 8:40 pm This is a wired question. When I save at the old version, the newer version can see what I save in this computer. It also happen on many questions as screen resolution and the persistent data I made from script.

How can I let these settings can't be inherit from old version :?: :cry: :cry:
I'm confused... Do you want your newer version of the game to not read saves from an older version? Is that what you're trying to achieve?

yuuri88
Newbie
Posts: 20
Joined: Fri Aug 02, 2019 11:58 am
Contact:

Re: Wrong inheritance about save and persistent data

#3 Post by yuuri88 »

Yes, that's the part of what I want.

All in all is to prevent the old version influence the newer version

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Wrong inheritance about save and persistent data

#4 Post by isobellesophia »

How about you'll try copying the save file from its game? And paste it right after, just maybe because newer version had changed alot though.. and try edit out some things first.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Wrong inheritance about save and persistent data

#5 Post by hell_oh_world »

yuuri88 wrote: Thu Aug 29, 2019 10:32 pm Yes, that's the part of what I want.

All in all is to prevent the old version influence the newer version
That's a bit tricky... I'm sure others have their own much easier workaround for this but this is mine...
Assuming that youre still using the default file_slots screen in screens.rpy....
**YOU CAN FIND THESE IN file_slots screen in screens.rpy**

Code: Select all


for i in range(gui.file_slot_cols * gui.file_slot_rows):

                    $ slot = i + 1

                    button:
                        action FileAction(slot)

                        has vbox

                        add FileScreenshot(slot) xalign 0.5

                        text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                            style "slot_time_text"

                        text FileSaveName(slot):
                            style "slot_name_text"

                        key "save_delete" action FileDelete(slot)

Change the above code to this...

Code: Select all

 

for i in range(gui.file_slot_cols * gui.file_slot_rows):

                $ slot = i + 1
		if FileSaveName(slot) == config.version: ## Added a condition which checks the version of the save file.
                    	button:
                        	action FileAction(slot)

                        	has vbox

                        	add FileScreenshot(slot) xalign 0.5

                        	text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
                           	 	style "slot_time_text"

                        	text FileSaveName(slot):
                            		style "slot_name_text"

                        	key "save_delete" action FileDelete(slot)
                        	
                        	
Now for the last part... assuming that your game versions update per episodical release...
Therefore, you have different labels that will be called or jumped for the start of each episode...
Eg. version 0.1.0 is your episode1.rpy and version 0.2.0 is your episode2.rpy.

Code: Select all

## IN YOUR episode1.rpy (version 0.1.0)
label start:
	$ save_name = config.version # The save name version will be 0.1.0

## IN YOUR episode2.rpy (version 0.2.0)
label episode2_start:
	$ save_name = config.version # The save name version will be 0.2.0
	## Trying to load a game with an older version from this point and onwards will not be feasible.
	## But if you save a game from this point and onwards that saved game will be eligible for loading.
In shorter terms... You need to reinitialize the save_name store variable for the starting label of your update. The save_name then will be stored when you save so if I am currently playing episode 1 which is v0.1.0 the version of the save will be 0.1.0. Now if I played episode 2 I will be redirected to label episode2_start. Then If I try to load or save the save file will not present on the file_slots screen as the older saves which are 0.1.0 is not equal to the current build of the game. Hope it makes sense, maybe others have a better idea on this.

Post Reply

Who is online

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