[Solved] Reading Variables in Save Files from Save Screen
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.
[Solved] Reading Variables in Save Files from Save Screen
I am creating a game that will have an explicit content patch that adds additional scenes. With this patch present, a variable would be written to indicate that the adult version is being used. Would it be possible to store such a value in a save file such that a save screen could read it and create an insensitive button in place of a normal hotspot to prevent loading save files that could possibly be stored at a scene not present in the unpatched version?
Last edited by AXYPB on Sun Aug 06, 2017 8:06 pm, edited 1 time in total.
Re: Reading Variables in Save Files from Save Screen
I don't think players would really expect that save files would be compatible between patched and unpatched versions in the first place, so I'm not sure what the use case is here.
Re: Reading Variables in Save Files from Save Screen
You can register a callback which can add data to a dictionary (which is then saved into the savegame zip, as JSON in a file named 'json') when a game is saved:
And then in screens.rpy, you can use FileJson() or renpy.slot_json() to get the dictionary from a saved game, at which point you can change the behaviour to disable clicking or show an icon, etc.
Code: Select all
def my_save_method(dict):
pass # add data to the dictionary
config.save_json_callbacks.append(my_save_method)
Re: Reading Variables in Save Files from Save Screen
Thank you. This was the solution I was seeking.
Who is online
Users browsing this forum: RandomHuman64