How do I disable saves from old versions?
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.
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.
- Wiceramond
- Regular
- Posts: 25
- Joined: Mon Dec 07, 2020 8:40 am
- Contact:
How do I disable saves from old versions?
I want to disable old save files for loading based on the game's version. I have defined the config.version in every version. So let's say my game's latest version is 2.6 and I want to disable saves from 2.5 2.4 2.3 etc. Is it possible? And if it's possible, how?
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How do I disable saves from old versions?
pretty much yeah. you can try this...
create a list of versions that are compatible with the current build. The versions in this list must be a valid version, a version that you once put in the `config.version` inside `options.rpy`
then on line 676 of screens.rpy (inside screen file_slots), add a sensitive property for the button
create a list of versions that are compatible with the current build. The versions in this list must be a valid version, a version that you once put in the `config.version` inside `options.rpy`
Code: Select all
define _compatible_versions = (
"2.5", "2.6", "2.7", # assume that 2.7 here is your current build's `config.version`, and the minimum playable save version is 2.5
)
Code: Select all
button:
action FileAction(slot)
sensitive (FileJson(slot, "_version") in _compatible_versions) # by default config.version is already stored in your save as _version, so we will fetch that and compare if that version is compatible.
- Wiceramond
- Regular
- Posts: 25
- Joined: Mon Dec 07, 2020 8:40 am
- Contact:
Re: How do I disable saves from old versions?
Thanks a lot, it's almost working for me, but I can't save anything at all, quick save works fine, not by clicking on the empty slot tho. Basically I can't click on any empty slots.hell_oh_world wrote: ↑Sun Feb 28, 2021 9:40 am pretty much yeah. you can try this...
create a list of versions that are compatible with the current build. The versions in this list must be a valid version, a version that you once put in the `config.version` inside `options.rpy`then on line 676 of screens.rpy (inside screen file_slots), add a sensitive property for the buttonCode: Select all
define _compatible_versions = ( "2.5", "2.6", "2.7", # assume that 2.7 here is your current build's `config.version`, and the minimum playable save version is 2.5 )
Code: Select all
button: action FileAction(slot) sensitive (FileJson(slot, "_version") in _compatible_versions) # by default config.version is already stored in your save as _version, so we will fetch that and compare if that version is compatible.
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How do I disable saves from old versions?
right. sorry. try this.
Code: Select all
sensitive (FileJson(slot, "_version", missing=config.version) in _compatible_versions)
- Wiceramond
- Regular
- Posts: 25
- Joined: Mon Dec 07, 2020 8:40 am
- Contact:
Re: How do I disable saves from old versions?
Oh, I'm really sorry. Tried that one but it's just the same. Also, even if it works players won't be able to overwrite old saves I guess. That's okay but can I use grayscale on disabled saves' images?hell_oh_world wrote: ↑Sun Feb 28, 2021 10:13 am right. sorry. try this.Code: Select all
sensitive (FileJson(slot, "_version", missing=config.version) in _compatible_versions)
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How do I disable saves from old versions?
Right, so sorry again, i missed one more parameter in that code, so it should look like this now.
also, modify the compatible versions to be like this (observe that we're using {} instead of []).
Code: Select all
sensitive (FileJson(slot, "_version", config.version, config.version) in _compatible_versions)
Code: Select all
define _compatible_versions = {
"old_config_version_1", "old_config_version_2", config.version # ensure that your current game's version is included in the compatible versions.
}
Ren'Py 7.4 should allow you to do this, so be sure you're using the latest version of renpy.That's okay but can I use grayscale on disabled saves' images?
Code: Select all
# moved above the button
$ compatible = (FileJson(slot, "_version", config.version, config.version) in _compatible_versions)
button:
action FileAction(slot)
sensitive compatible
has vbox
# change your screenshot to this...
add FileScreenshot(slot):
xalign 0.5
if not compatible:
at transform:
matrixcolor SaturationMatrix(0.0)
Correct. to do that, you need to modify the condition a bit.Also, even if it works players won't be able to overwrite old saves I guess.
Code: Select all
# moved above the button
$ compatible = (FileJson(slot, "_version", config.version, config.version) in _compatible_versions)
$ compatible = compatible if renpy.get_screen("load") else True
button:
action FileAction(slot)
- Wiceramond
- Regular
- Posts: 25
- Joined: Mon Dec 07, 2020 8:40 am
- Contact:
Re: How do I disable saves from old versions?
Thanks a lot, it's working now. You saved me there.hell_oh_world wrote: ↑Sun Feb 28, 2021 11:03 am Right, so sorry again, i missed one more parameter in that code, so it should look like this now.also, modify the compatible versions to be like this (observe that we're using {} instead of []).Code: Select all
sensitive (FileJson(slot, "_version", config.version, config.version) in _compatible_versions)
Code: Select all
define _compatible_versions = { "old_config_version_1", "old_config_version_2", config.version # ensure that your current game's version is included in the compatible versions. }
Ren'Py 7.4 should allow you to do this, so be sure you're using the latest version of renpy.That's okay but can I use grayscale on disabled saves' images?Code: Select all
# moved above the button $ compatible = (FileJson(slot, "_version", config.version, config.version) in _compatible_versions) button: action FileAction(slot) sensitive compatible has vbox # change your screenshot to this... add FileScreenshot(slot): xalign 0.5 if not compatible: at transform: matrixcolor SaturationMatrix(0.0)
Correct. to do that, you need to modify the condition a bit.Also, even if it works players won't be able to overwrite old saves I guess.Code: Select all
# moved above the button $ compatible = (FileJson(slot, "_version", config.version, config.version) in _compatible_versions) $ compatible = compatible if renpy.get_screen("load") else True button: action FileAction(slot)
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3808
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: How do I disable saves from old versions?
I'm curious why you're interested in such a feature. I can't think of any reason why you would want this feature other than trying to fix loading errors from improperly defined variables.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Who is online
Users browsing this forum: Bing [Bot], Majestic-12 [Bot], Semrush [Bot]