Greetings, and thanks for your earlier help.
I've fixed most of my issues with Ren'py and Python, tumbling around, doing stuff. I've made some demos and I've ended pretty satisfied with the final result.
I've decided to build an episodic game, and release new content every month or so. But then I realized that every new build will have new variables, rendering the old saves useless. Since the inability to use saves in between versions could be a dealbreaker, I'm wondering if there is any way to check if there are new variables running when you load a game, and if those variables aren't defined, set them to 0 to avoid "variable non-defined" errors.
New versions, save compatibility, and set new variables to 0
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.
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: New versions, save compatibility, and set new variables
Yes, you do:
There are other ways to test for presence/absence, so take this as mostly a guideline.
Code: Select all
label after_load:
$ store.newvar = getattr(store, "newvar", 0)
return
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: New versions, save compatibility, and set new variables
Thanks for the answer.
Where do I add this, though? And I assume "newvar" is the name of the new variable. Do I need to check for every new variable added?
Where do I add this, though? And I assume "newvar" is the name of the new variable. Do I need to check for every new variable added?
Who is online
Users browsing this forum: Google [Bot]