I can't find the original thread now (go me), but I recall it saying something along the lines that if a variable is not defined in a label, it isn't saved (as part of a save game) if its value is changed somewhere else later on.
Is this right, or have I got the wrong end of the stick here? Thanks.
Possibly stupid Q: Variables must be defined where?
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.
- Sslaxx
- Regular
- Posts: 52
- Joined: Thu Jul 18, 2013 7:35 pm
- Deviantart: sslaxx
- Github: Sslaxx
- Skype: Sslaxx
- Location: Malvern, UK
- Discord: Sslaxx#0159
- Contact:
Possibly stupid Q: Variables must be defined where?
Stuart "Sslaxx" Moore.
-
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Re: Possibly stupid Q: Variables must be defined where?
Variables need to be defined in the "init" block. For example:
Code: Select all
init:
$cheetoseaten = 0
- Sslaxx
- Regular
- Posts: 52
- Joined: Thu Jul 18, 2013 7:35 pm
- Deviantart: sslaxx
- Github: Sslaxx
- Skype: Sslaxx
- Location: Malvern, UK
- Discord: Sslaxx#0159
- Contact:
Re: Possibly stupid Q: Variables must be defined where?
Hmmm. So, then, like this?
Shall keep this in mind.
Code: Select all
init:
define EndType = "END"
Stuart "Sslaxx" Moore.
-
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Re: Possibly stupid Q: Variables must be defined where?
Define might work too, but you probably don't need the "init" with that one, it's just stand alone. Having an init block is the way most people do it, though.
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Possibly stupid Q: Variables must be defined where?
You can define variables also in the labels. Make sure to define your variables before they are used.
The save function must save the current value of your variables (I presume).
The save function must save the current value of your variables (I presume).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Who is online
Users browsing this forum: barsunduk