Code: Select all
on openCard
put field "MasterList" into field "questionBank"
hide field "MasterList"
hide field "questionBank"
show button "Ready"
end openCard
on pickQuestion
put number of lines in fld "questionBank" into lineCount
if lineCount = 0 then
go to card ResultsCard
exit to top
end if
put random(lineCount) into currentQues
put line currentQues of fld "questionBank" into qLine
delete line currentQues of field "questionBank"
put item 1 of qLine into fld "Question"
put "answer1 answer2 answer3 answer4" into fldList
repeat with i = 2 to 5
get random(the number of words in fldList)
put word it of fldList into fldName
delete word it of fldList
put item i of qLine into fld fldName
if i = 2 then
put item i of qLine into corrTarget
set the corrAnswer of group "groupLetters" to corrTarget
end if
end repeat
put 278,205 into location1
put 732,205 into location2
put 278,534 into location3
put 732,534 into location4
put fld "answer1" into currentTarget
set the loc of group currentTarget to location1
put fld "answer2" into currentTarget
set the loc of group currentTarget to location2
put fld "answer3" into currentTarget
set the loc of group currentTarget to location3
put fld "answer4" into currentTarget
set the loc of group currentTarget to location4
show group groupLetters
show group "Animal 1"
show group "Animal 2"
show group "Animal 3"
show group "Animal 4"
hide button "Ready"
if corrTarget = "Animal 1" then
play audioclip "touchGo.wav"
end if
if corrTarget = "Animal 2" then
play audioclip "touchRun.wav"
end if
end pickQuestion
on checkAnswer
put fld "Question" into CurrentTrialNumber
put the corrAnswer of group "groupLetters" into checkWork
put checkWork into fld "checkWork"
if target = fld checkWork then
put "J" into fld "Feedback"
put "Correct" into fld CurrentTrialNumber on card ResultsCard
play audioclip "Praise.wav"
hide group "groupLetters"
show fld "Feedback"
wait 4 seconds
put empty into fld "Feedback"
hide fld "Feedback"
else
put "Wrong" into fld CurrentTrialNumber on card ResultsCard
if checkWork = "Animal 1" then
play audioclip "CorrectionGo.wav"
hide group "Animal 4"
hide group "Animal 3"
hide group "Animal 2"
show group "Animal 1"
wait 4 seconds
end if
if checkWork = "Animal 2" then
play audioclip "CorrectionRun.wav"
hide group "Animal 1"
hide group "Animal 3"
hide group "Animal 4"
show group "Animal 2"
wait 4 seconds
end if
end if
hide group "groupLetters"
put empty into field "Question"
put empty into field "Answer1"
put empty into field "Answer2"
put empty into field "Answer3"
put empty into field "Answer4"
wait 1 seconds
show button "Ready"
end checkAnswer
Many thanks in advance!!!