Variable confusion
Variable confusion
(OP)
I am currently creating an educational application using director.
I have had little training in this software though and i have come into some difficulties when trying to create a quiz section.
I want to have 10 questions with buttons that you press to advance, and i want to keep track of the score as they progress through the quiz using variables. So for example
if they push the correct button i want it to go to "question 2" and then something like myVariable = myVariable + 2
so that when it gets to the end of the quiz it will check this variable and go to a certain page depending on how well they scored.
eg.
on mouseUp me
if myVariable = <5 then
go to "bronze"
else if myVariable = 5> then
go to "gold"
end if
end
Any help would be appreciated...thanks
Peter Butler
Tandokuno Design
I have had little training in this software though and i have come into some difficulties when trying to create a quiz section.
I want to have 10 questions with buttons that you press to advance, and i want to keep track of the score as they progress through the quiz using variables. So for example
if they push the correct button i want it to go to "question 2" and then something like myVariable = myVariable + 2
so that when it gets to the end of the quiz it will check this variable and go to a certain page depending on how well they scored.
eg.
on mouseUp me
if myVariable = <5 then
go to "bronze"
else if myVariable = 5> then
go to "gold"
end if
end
Any help would be appreciated...thanks
Peter Butler
Tandokuno Design
RE: Variable confusion
Kenneth Kawamoto
www.materiaprima.co.uk
RE: Variable confusion
The only problem i seem to have now is with the script on the start button.
I have got some editable text fields on the first welcome page of the quiz, these take the childs Name, Age, Class and School. This is done so that on the last page of the quiz a certificate can be shown with all these details etc..
Here is the script i placed on the button, if you would be so kind as to instruct me of what is wrong on it i would be very grateful (as it keeps giving me a script error).
_____________________________________________
on mouseUp me
if member(52).text = "" then
alert("please Enter Your Name")
else
member(58).text = "Congratulations" & RETURN & RETURN && member(52).text
&& "has successfully completed the sewerby challenge" & RETURN & RETURN && member(52).text
&& "aged" && member(53).text && "from class" && member(54).text && "at" && member(55).text
&& "scored" member(22).text & RETURN & RETURN "Well Done!!!!"
end if
end
_____________________________________
And the error i get is:
Script error: Comma expected
&&"scored" member(22).text & RETURN & RETURN
"Well Done!!!!"?
________________________________________
Thanks again
Peter Butler
Tandokuno-Design.com
RE: Variable confusion
"&" is missing.
Kenneth Kawamoto
www.materiaprima.co.uk
RE: Variable confusion
on mouseUp me
if member(52).text = "" then
alert("please Enter Your Name")
else
member(58).text = "Congratulations" & RETURN & RETURN && member(52).text\
&& "has successfully completed the sewerby challenge" & RETURN & RETURN && member(52).text\
&& "aged" && member(53).text && "from class" && member(54).text && "at" && member(55).text\
&& "scored" member(22).text & RETURN & RETURN && "Well Done"
go to 5
end if
end
it came up with a new error though, says 'expected end of statement"
any ideas?
(thankyou for your patience btw, its very hard to find people that are good at director, and most textbooks arent very good)
Peter Butler
Tandokuno Design
RE: Variable confusion
"&" is missing.
Kenneth Kawamoto
www.materiaprima.co.uk
RE: Variable confusion
Just one final problem ^_^ everything you said works perfect the only element that doesnt work is the score bit. I thought this might be because it uses a global variable?
with this:
on mouseUp me
if member(52).text = "" then
alert("please Enter Your Name")
else
member(58).text = "Congratulations" & RETURN & RETURN && member(52).text\
&& "has successfully completed the sewerby challenge" & RETURN & RETURN && member(52).text\
&& "aged" && member(53).text && "from class" && member(54).text && "at" && member(55).text\
&& "scored" && member(22).text & RETURN & RETURN && "Well Done"
go to 5
end if
end
it displays it as 0 regardless of what you score... I tried replacing the && member(22).text with && myVariable but it still shows it as 0. I remmbered to put the 'global myVariable' at the top so it's not that ? hmm
any ideas?
also how did you learn to use director so well? you are such an asset to this forum thanks for all the help you give people. I've ordered a Lingo in a nutshell book which im hoping might help me learn this coding.
Peter Butler
Tandokuno Design
(Ill show you the finished project when its done ^_^)
RE: Variable confusion
--
put myVariable
--
What do you get?
I learned Director initially at college but real learning all came from doing work. If you have to deliver something there's no choice but you have to learn quickly and complete the task!
Kenneth Kawamoto
www.materiaprima.co.uk