NameError traceback occuring on if statements.
Posted: Tue Mar 08, 2011 1:59 pm
So, I'm only a week into using Renpy, and one of the things I'm working on features a system where the game is supposed to remember choices you make to influence the game. However, I've been having trouble in getting the game to recognize the python script I set up earlier. Here's the traceback text:
The game continues fine if I pick the options that get you the choice5 = "friendly" option, but it shuts down if this isn't the case. This also happens for some script later in the game. I don't understand how this could happen, because I managed to make code like this work earlier in the game, but it refuses to do it now without any noticable difference between this and the other code I wrote. Any help would be appreciated.
And here is the code for the section where the game itself runs into the traceback:I'm sorry, but an uncaught exception occurred.
NameError: name 'choice5' is not defined
While running game code:
- script at line 220 of C:\Users\Desktop\Ryan/game/script.rpy
- python at line 220 of C:\Users\Desktop\Ryan/game/script.rpy.
-- Full Traceback ------------------------------------------------------------
File "C:\Users\Desktop\renpy-6.12.0\renpy\bootstrap.py", line 279, in bootstrap
File "C:\Users\Desktop\renpy-6.12.0\renpy\main.py", line 320, in main
File "C:\Users\Desktop\renpy-6.12.0\renpy\main.py", line 93, in run
File "C:\Users\Desktop\renpy-6.12.0\renpy\execution.py", line 259, in run
File "C:\Users\Desktop\renpy-6.12.0\renpy\ast.py", line 1321, in execute
File "C:\Users\Desktop\renpy-6.12.0\renpy\python.py", line 994, in py_eval
File "C:\Users\Desktop\Ryan/game/script.rpy", line 220, in <module>
NameError: name 'choice5' is not defined
While running game code:
- script at line 220 of C:\Users\Desktop\Ryan/game/script.rpy
- python at line 220 of C:\Users\Desktop\Ryan/game/script.rpy.
Ren'Py Version: Ren'Py 6.12.0e
Code: Select all
label choice6_done:
r "Joey gets to school like normal, and sees someone hanging out with his friends..."
if choice5 == "friendly":
r "Arthur is busy chatting up Joey's friends, and talks with Joey about bodybuilding."
r "Joey sort of likes the positive attention, but inwardly knows he wouldn't be able to keep up the lie for long."
jump choice7_start
else:
r "Molly, who is good friends with Sue, mentions casually how she saw Joey pigging out at the snack machines yesterday."
if choice3 == "give":
r "Sally tries to speak up for Joey, but Molly gets talked down by Molly."
r "Joey finds himself at odds with the people around him, and has to make a choice."
jump choice7_start