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.
Hi guys~
This is a follow up on my post about expected statements. I'm still having the same problem, but this time, instead of an expected statement error, I get an error saying that a statement is undefined.
While running game code:
File "game/script.rpy", line 190, in script
menu:
File "game/script.rpy", line 211, in <module>
"Are you his guardian?" if spirit == True:
NameError: name 'spirit' is not defined
menu:
"What do you want to talk about?"
"Where do you guys live?":
pn "So do you guys live close to the campus?"
s "Oh! We live together, actually. We're roommates! We live about a mile off campus in this little rental house."
n "Living with Sera is actually awful. Please save me."
s "Oh shut up, you know you looooove me!"
n "A-As if!"
jump finding_out
"Are you two dating?":
pn "So, uh, are you two...dating?"
n "W-WHAAAAT?!"
s "Nonononononono! We're not dating!"
n "E-Ew. No."
s "Besides, I'm like, the most gay person ever. Like, ever. Feel free to call me the Ultimate Gay. And Naois here is about as straight as a circle."
n "S-Sera!"
s "Oh, I'm sorrrrrry. You're sensitive~ Hehehe"
jump finding_out
"Are you his guardian?" if spirit == True:
pn "Are you Naois' Guardian?"
jump naois_guardian
If it's part of a menu, then it's possible that line of code will never have ran by the time you get to that evaluation.
So what you should do is set that variable to false at the top of your script. That way, even if you never got to that point where it was true, it will still be defined.
SuperbowserX wrote:If it's part of a menu, then it's possible that line of code will never have ran by the time you get to that evaluation.
So what you should do is set that variable to false at the top of your script. That way, even if you never got to that point where it was true, it will still be defined.
So at the top I'd just put spirit = false? Or is it something else?
While running game code:
File "game/script.rpy", line 191, in script
menu:
File "game/script.rpy", line 212, in <module>
"Are you his guardian?" if spirit == True:
NameError: name 'spirit' is not defined
(ignore this next sentence if you're not programming familiar) You don't need that operator for boolean evaluations. Simply saying if boolean is basically telling it "if this boolean is true".
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?)