Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
I got the problem that i set the variable $ choice1 = "1" but the player sometimes never reaches this point.and if I check the choice later in the game(if choice1 == "1") I get the "name choice1 is not defined" error. I know that I can set $choice1 = "0" at the beginning of my script. But I rather not, because my game gets updated about every month and the players should be able to use their old save files to continue
here is an example:
You need to define your variables. The current best practice is to use default for variables that will change, define for those that won't. So in your case:
Note: by using default it will only set the variable as "0" if it had not been previously set. So it should be fine with saves.
Second note: I notice you are defining your variable as a string ("1") rather than as a number (1). Is that really what you want to do?
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?)
trooper6 wrote: ↑Tue Mar 20, 2018 12:55 pm
You need to define your variables. The current best practice is to use default for variables that will change, define for those that won't. So in your case:
Note: by using default it will only set the variable as "0" if it had not been previously set. So it should be fine with saves.
Second note: I notice you are defining your variable as a string ("1") rather than as a number (1). Is that really what you want to do?
thanks, this is perfect. This was my first choice I ever made and I made this mistake to save it as a string. but I realised that you can save them as numbers later on. but thanks