Countdown HH:MM:SS
Roger Eller
roger.e.eller at sealedair.com
Wed Jul 20 15:19:07 EDT 2011
On Wed, Jul 20, 2011 at 1:06 PM, Ken Ray wrote:
> > Using the dateItems is definitely the right direction, but my objective
> is
> > to count backwards from for example; 2 hours, 45 minutes, and 59 seconds
> > while updating the display field every second. When the countdown
> reaches
> > 00:00:00, I would play a sound of do other actions.
>
> Sorry about that... this will work if you just want to count down from a
> fixed amount of time:
>
> on mouseUp
> DoCountDown "2:45:59"
> end mouseUp
>
> on DoCountDown pTime
> convert pTime to seconds
> subtract 1 from pTime
> convert pTime to dateItems
> split pTime by ","
> put format("%02d:%02d:%02d",pTime[4],pTime[5],pTime[6]) into tNewTime
> put tNewTime into fld "Time"
> if tNewTime = "00:00:00" then
> TimesUp
> else
> send "DoCountDown tNewTime" to me in 1 second
> end if
> end DoCountDown
>
> on TimesUp
> answer "Done"
> end TimesUp
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
>
With only a few tweaks like handling a cancel/reset request, this script
does what I need. James' was almost the one, but the time wasn't starting
from a pre-set amount of time such as 1 hour, etc. Thanks to everyone that
contributed!
~Roger
More information about the use-livecode
mailing list