I have issues in the code below,
ERROR MESSAGE:
[issue] File "game/script.rpy", line 5, in keywords
vbox:
File "<screen language>", line 5, in <module>
NameError: name 'totalval' is not definedscreen blah:
[/issue]
CODE:
screen blah:
hbox:
vbox:
imagebutton auto "right_%s.png" clicked SetVariable("totalval", totalval + 1) # action blah blah
imagebutton auto "right_%s.png" action NullAction
imagebutton auto "wrong_%s.png" action NullAction
vbox:
imagebutton auto "wrong_%s.png" action NullAction# action blah blah
imagebutton auto "right_%s.png" action NullAction
imagebutton auto "wrong_%s.png" action NullAction
vbox:
imagebutton auto "wrong_%s.png" action NullAction# action blah blah
imagebutton auto "right_%s.png" action NullAction
imagebutton auto "right_%s.png" action NullAction
define r = Character('Amanda')
label start:
$totalval = 1
r "Hello"
show screen blah
r "bye"
return
Please help me I donno what I am doing wrong here..
Help. Variable not defined
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.
-
- Newbie
- Posts: 1
- Joined: Sun Nov 19, 2017 3:01 am
- Contact:
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Help. Variable not defined
You need to move to before the start label as
I'm not sure, but also check if 'setvalue' works like that.
Code: Select all
$totalval = 1
Code: Select all
default totalval = 1
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Who is online
Users browsing this forum: Google [Bot]