Page 1 of 1

Answer dialog disrupts wait command

Posted: Thu Dec 13, 2012 11:32 pm
by MisMel
Hi all. I need some help getting my program to wait a certain amount of time, allowing input from the user during that time, and then respond to the input. For example, I want the user to do math problems for 30 seconds, and after they submit their response for each math problem, I want a dialog box to tell them whether their response is correct. The problem is, when I use the "answer" command, it cancels the wait period and automatically moves on in the program. To illustrate what I want, here is some of my code:

Code: Select all

go to card "MathTest"
wait 30 seconds with messages
go to card "EndTest"
Then, in the card which I have called "MathTest," there are some math problems, with answer fields. Here is the script associated with one of those fields:

Code: Select all

on returninfield
   put field "ans1" of card "math" into tans
   if tans = (142) then
      answer "Correct!"
   else
      answer "That is incorrect. Please try harder next time."
   end if 
end returninfield
No matter how much time has passed, as soon as they click "Ok" in the Answer dialog box it moves on to the card "EndTest." Is there some option for using an Answer dialog box without canceling out the Wait command?

Re: Answer dialog disrupts wait command

Posted: Thu Dec 13, 2012 11:43 pm
by Mark
Hi,

That's right, the answer dialog contains a bug that kills wait commands with messages. You can use the send command instead.

Code: Select all

go cd "MathTest"
send "goEnd" to me in 30 secs

on goEnd
  go cd "EndTest"
end goEnd
Kind regards,

Mark

Re: Answer dialog disrupts wait command

Posted: Sat Feb 02, 2013 11:51 pm
by MisMel
I did not see your reply until now. Thanks, Mark!!