Can't find handler error
Posted: Wed Feb 04, 2009 12:23 pm
Hi there,
I've written a script to help me with my psychology experiments. Basically it takes a list of words held in a CSV file, randomises the order of them and then displays each word on screen for a short time. When it gets to the end of the list, it re-randomises them and then does it all over again 5 times. However, about midway through the final set it usually bugs out and says it can't find the "DisplayWords" handler, which is odd since it has been using that handler for about 360 words before that. It seems to happen fairly consistently at the 360th word. I can't find anything in the script that might make that happen - anyone have any ideas? I've included the relevant part of the script below. sStudyCondition is a variable that is set at the beginning dictating if the words are to be displayed once or 5 times over, and sStudywords will have had an 80 line CSV file placed in it with the words themselves. Any help would be much appreciated!
Greg
on opencard
if gStudyCondition is 1 then
put "" into gRandomLines
wait 1 seconds
DisplayWords
end opencard
on DisplayWords
put line gLineNumber of sStudyWords into sDisplayWord
if sDisplayWord is empty
then
CheckEnd
else
put sDisplayWord into field StudyWord1
show field StudyWord1
wait 1 seconds
put "" into field StudyWord1
wait 0.25 seconds
SelectWords
end if
end DisplayWords
On SelectWords
add 1 to gLineNumber
put gLineNumber into field "page"
DisplayWords
end SelectWords
On CheckEnd
add 1 to sStrengthCondition
If sStrengthCondition is 5 then
go to card "PauseCard"
else
put 1 into gLineNumber
sort lines of sStudyWords by random(the number of lines of sStudyWords)
DisplayWords
end if
end CheckEnd
I've written a script to help me with my psychology experiments. Basically it takes a list of words held in a CSV file, randomises the order of them and then displays each word on screen for a short time. When it gets to the end of the list, it re-randomises them and then does it all over again 5 times. However, about midway through the final set it usually bugs out and says it can't find the "DisplayWords" handler, which is odd since it has been using that handler for about 360 words before that. It seems to happen fairly consistently at the 360th word. I can't find anything in the script that might make that happen - anyone have any ideas? I've included the relevant part of the script below. sStudyCondition is a variable that is set at the beginning dictating if the words are to be displayed once or 5 times over, and sStudywords will have had an 80 line CSV file placed in it with the words themselves. Any help would be much appreciated!
Greg
on opencard
if gStudyCondition is 1 then
put "" into gRandomLines
wait 1 seconds
DisplayWords
end opencard
on DisplayWords
put line gLineNumber of sStudyWords into sDisplayWord
if sDisplayWord is empty
then
CheckEnd
else
put sDisplayWord into field StudyWord1
show field StudyWord1
wait 1 seconds
put "" into field StudyWord1
wait 0.25 seconds
SelectWords
end if
end DisplayWords
On SelectWords
add 1 to gLineNumber
put gLineNumber into field "page"
DisplayWords
end SelectWords
On CheckEnd
add 1 to sStrengthCondition
If sStrengthCondition is 5 then
go to card "PauseCard"
else
put 1 into gLineNumber
sort lines of sStudyWords by random(the number of lines of sStudyWords)
DisplayWords
end if
end CheckEnd