Simple count up timer
Posted: Mon Apr 13, 2015 6:16 pm
I have this simple count up script... The bug happens when you multiple times click on the start/stop buttons in very short time... Than the clock goes crazy...
I need to somehow block the count up script if the button is pressed more than 1 time in 1 second. Any ideas?
I need to somehow block the count up script if the button is pressed more than 1 time in 1 second. Any ideas?
Code: Select all
on mouseUp
put "Start Clock" into startLabel
put "Stop Clock" into stopLabel
if the label of me is startLabel then
set the label of me to stopLabel
set the backgroundcolor of me to green
DoCountUp
else
set the label of me to startLabel
set the backgroundcolor of me to red
end if
end mouseUp
on DoCountUp
put "Start Clock" into startLabel
put "Stop Clock" into stopLabel
if the label of ME is stopLabel then
set the numberformat to 00
add 1 to field GameClockSec
if field GameClockSec = 60 then
add 1 to field GameClockMin
put 00 into field GameClockSec
else
end if
send "DoCountUp tNewTime" to me in 1 second
end if
end DoCountUp