Reaching last card in stack based on countdown timer

Sarah Reichelt sarahr at genesearch.com.au
Sun Nov 21 20:48:31 EST 2004


You want the "send in time" command.

When your quiz starts, store the seconds in a global variable (I called 
it gStartTime in the script below) and put the maximum number of 
seconds (I used 60 below) into your timer field. Then have a line 
saying:
send timerUpdate to field "Timer" in 1 second

In the script for field "Timer" have this:

on timerUpdate
   global gStartTime
   put 60 - (the seconds - gStartTime) into timeRemaining
   if timeRemaining <= 0 then
	put 0 into me
     go to last card
   else
     put timeRemaining into me
     send "timerUpdate" to me in 1 second
   end if
end timerUpdate

Make the Timer field part of a group placed on each card and with it's 
sharedText set to true so it shows the same data on each card.

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/

On 22 Nov 2004, at 10:32 am, Salinas, Ruben (GE Healthcare) wrote:

> I would like to code a timer that runs through a specified time, while 
> the user is answering multiple choice questions (for a timed quiz). If 
> the timer reaches zero, regardless of where the user is on the quiz 
> (what question he /she is on), the application will automatically 
> "shut down" and take the user to the final card where he/she will be 
> presented with a score. Can you guys give me some ideas on how to code 
> that timer and make it a global variable so I can continuously show it 
> at the top of each question card?
>
> Thanks in advance...
>
> Harvjag



More information about the use-livecode mailing list