Okay, so I was reading through this article and I must confess to being a bit confused. I'm confused because I wonder, if I define a variable (like an integer) and make changes to it using the standard Python language, DOES the current state of the variable at the time of saving get saved when the game is saved? And when it is loaded up, does the variable get overwritten by the initial instantiation of these variables or not? Like, let's say I assign a variable named "e" at the beginning of the script a value of 50 and at the time of save, it is 74. When that save file is loaded, is it reset to 50 or is the previous value of 74 saved?
Do I have to do something special to make this happen or not? I apologize for asking what may seem like a basic question but I'm legitimately confused.
Ren'Py variables and saving.
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.
- [Elysium] Véronique
- Newbie
- Posts: 9
- Joined: Wed Feb 07, 2018 4:54 pm
- Projects: My First Castellan
- Organization: Elysium Studios
- Deviantart: elysiumcoop
- Github: kawaiidesune
- itch: elysiumgames
- Location: Longmont, CO
- Contact:
Ren'Py variables and saving.
Véronique Bellamy, DPhil
Founder, Elysium Studios
Founder, Elysium Studios
Re: Ren'Py variables and saving.
It's a shame the documentation examples are a bit sparse at the moment and leaves to confusions.
If you read this part of the documentation about define and default as well, it'll make more sense:
https://www.renpy.org/doc/html/python.h ... -statement
Long story short, you want to use default to make sure variables are saved. For ints and strings, defined variables will be saved so long as they're changed within the game flow, the problem is defined objects being referenced can be gone forever.
If you read this part of the documentation about define and default as well, it'll make more sense:
https://www.renpy.org/doc/html/python.h ... -statement
Long story short, you want to use default to make sure variables are saved. For ints and strings, defined variables will be saved so long as they're changed within the game flow, the problem is defined objects being referenced can be gone forever.
- [Elysium] Véronique
- Newbie
- Posts: 9
- Joined: Wed Feb 07, 2018 4:54 pm
- Projects: My First Castellan
- Organization: Elysium Studios
- Deviantart: elysiumcoop
- Github: kawaiidesune
- itch: elysiumgames
- Location: Longmont, CO
- Contact:
Re: Ren'Py variables and saving.
"can be gone forever"
... how, pray tell? I ask because I'd like to try to control for it.
... how, pray tell? I ask because I'd like to try to control for it.
Véronique Bellamy, DPhil
Founder, Elysium Studios
Founder, Elysium Studios
- [Elysium] Véronique
- Newbie
- Posts: 9
- Joined: Wed Feb 07, 2018 4:54 pm
- Projects: My First Castellan
- Organization: Elysium Studios
- Deviantart: elysiumcoop
- Github: kawaiidesune
- itch: elysiumgames
- Location: Longmont, CO
- Contact:
Re: Ren'Py variables and saving.
Also, if I write something like this:
Will sample be equal to 1 or 5 once I load the save file if I put all the logic of the novel AFTER assigning that variable to 5?
Code: Select all
define sample = 1
label start:
sample = 5
# insert game logic here.
Will sample be equal to 1 or 5 once I load the save file if I put all the logic of the novel AFTER assigning that variable to 5?
Véronique Bellamy, DPhil
Founder, Elysium Studios
Founder, Elysium Studios
Re: Ren'Py variables and saving.
Ok just to be on the safe side - I'm going to recommend you do this for any variables that are subjected to change:
And this if the variable will never every change under any circumstances:
Code: Select all
default sample = 1
Code: Select all
define fixed_value = 1
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Ren'Py variables and saving.
If you use default outside of any label to initialize your variables that will change, then it will save those variables. Using default means it will not overwrite the variable.
Default means: If there is no other value for this variable, use the default.
Default means: If there is no other value for this variable, use the default.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Who is online
Users browsing this forum: No registered users