Wow there are elephants everywhere

and from now I will remember to always put one in Cairo
Thanks again Dixie that is great
I have used two global variables 'gCorrect' and 'gWrong'... The way I have set this up is not the best way to go about it, but it works and does not mess with your stack too much, and I hope that it gives you some ideas.
Great, simpler than what I was trying to do

So a Global Variable is like a more permanent type of variable that works on all the button, fields etc. on the stack?
Instead of using global variables I would suggest that you use custom properties... but that is maybe for something a little later to try... but it would do no harm for you to read about variables and custom properties in the user manual...
Would the custom properties be used in a different way to the custom property that is already being used?
I understand that you can't 'write to' (is that the right term) a custom property you have to use a variable and then set the variable to a custom property? Did I get that right?
I am still not sure how that would keep a score?
Code: Select all
global gCorrect,gWrong
on openCard
lock screen
put 0 into gCorrect
put 0 into gWrong
put empty into fld "score"
setTheTest
end openCard
on closeCard
repeat with count = 1 to 3
set the label of button count to space
end repeat
end closeCard
on setTheTest
lock screen
put gCorrect & "/" & gWrong into fld "score"
set the label of button "buttonL" to space
set the label of button "buttonR" to space
set itemDel to tab
put the cNumberPairs of this card into thePairs
sort lines of thePairs by random(the number of lines of thePairs)
put random(2) into whichNumber
set the label of button "testNumber" to item whichNumber of line 1 of thePairs
if whichNumber = 1 then
set the label of button "ButtonR" to item 1 of line 1 of thePairs
set the label of button "ButtonL" to item 2 of line 1 of thePairs
else
set the label of button "ButtonL" to item 2 of line 1 of thePairs
set the label of button "ButtonR" to item 1 of line 1 of thePairs
end if
end setTheTest
Many thanks HJay
p.s. still don't understand why the button labels are set to space?
