Count right answers in macromedia director?
December 4th, 2009 | by admin |i have to make a basic quiz using director and lingo, i have the quiz but not sure on the lingo i should use to make it count the number of right answers that chosen out of 10 questions. Can anyone give me an idea on the code that i will need to use. Thanks
Hi its hard to know what to write as I’ve no idea of your quiz. ANyway, heres some pointers. In frame 1 you need a frame script that sets a global variable to zero, this will be the variable that holds the correct scores.
for example
global gCorrect
on exitFrame me
gCorrect=0
end
you need to put a text box(its the A shape in the tool bar) and in the cast rename it to Answer or what ever you want
then whenever a player gets a correct score, for example if they click a right answer you put on the answer button this:
global gCorrect
on mouseUp me
gCorrect=gCorrect+1
member("Answer").text=string(gCorrect)
end
So whenevr they hit a correct answer the score held in variable gCorrect is shown in the text field you called answer.
If you want to check it works, do this. draw a simple box on youe stage and a text (member name is Answer), right click the box and choose script… then paste this in
on exitFrame me
go The Frame
end
global gCorrect
on mouseUp me
gCorrect=gCorrect+10
member("Answer").text=string(gCorrect)
end
now when you run the thing you should see your score go up. Hope that helps but like I said without knowing your quiz idea its pretty much guess work. good luck
One Response to “Count right answers in macromedia director?”
By ralphus on Dec 4, 2009 | Reply
Hi its hard to know what to write as I’ve no idea of your quiz. ANyway, heres some pointers. In frame 1 you need a frame script that sets a global variable to zero, this will be the variable that holds the correct scores.
for example
global gCorrect
on exitFrame me
gCorrect=0
end
you need to put a text box(its the A shape in the tool bar) and in the cast rename it to Answer or what ever you want
then whenever a player gets a correct score, for example if they click a right answer you put on the answer button this:
global gCorrect
on mouseUp me
gCorrect=gCorrect+1
member("Answer").text=string(gCorrect)
end
So whenevr they hit a correct answer the score held in variable gCorrect is shown in the text field you called answer.
If you want to check it works, do this. draw a simple box on youe stage and a text (member name is Answer), right click the box and choose script… then paste this in
on exitFrame me
go The Frame
end
global gCorrect
on mouseUp me
gCorrect=gCorrect+10
member("Answer").text=string(gCorrect)
end
now when you run the thing you should see your score go up. Hope that helps but like I said without knowing your quiz idea its pretty much guess work. good luck
References :