Reset Script for Clock Timer
Posted: Mon Mar 02, 2015 12:59 am
I've borrowed bits and pieces from other post for my clock script.
The script is to time the length of a baseball game based on first pitch and last out.
I can get the clock to start and stop, but my reset script merely clears out the game clock field
but does not reset the timer as hoped. Any help with reset code would be much appreciated.
Clock Script
local tsec, tmin, thr
on mouseUp
If the label of ME is "First Pitch" then
set the label of ME to "Final Out"
set the backgroundcolor of ME to gray
set the foregroundcolor of me to red
else
set the label ME to "First Pitch"
set the backgroundcolor of ME to green
set the foregroundcolor of Me to black
end if
startClock field GameClock
end mouseUp
on startClock
set the numberFormat to "00"
add 1 to tSec
if tSec = 60 then
add 1 to tMin
put 00 into tSec
If tMin = 60 then
add 1 to tHr
put 00 into tmin
end if
end if
if tMin = 0 then put 00 into tMin
if tHr = 0 then put 00 into tHr
put tHr & ":"& tMin & ":" & tSec into fld GameClock
if label of button "ClockButton" is "First Pitch"
else
send startClock to me in 1 sec --go back to the top and do it again in 1 sec
end if
end startClock
on TimesUp
end TimesUp
Reset Script
local tsec, tmin, thr
on mouseUp
If the label of me is "RESET" then
put 00 into tSec
put 00 into tMin
put 00 into tHr
put empty into field "GameClock"
end if
end mouseUp
The script is to time the length of a baseball game based on first pitch and last out.
I can get the clock to start and stop, but my reset script merely clears out the game clock field
but does not reset the timer as hoped. Any help with reset code would be much appreciated.
Clock Script
local tsec, tmin, thr
on mouseUp
If the label of ME is "First Pitch" then
set the label of ME to "Final Out"
set the backgroundcolor of ME to gray
set the foregroundcolor of me to red
else
set the label ME to "First Pitch"
set the backgroundcolor of ME to green
set the foregroundcolor of Me to black
end if
startClock field GameClock
end mouseUp
on startClock
set the numberFormat to "00"
add 1 to tSec
if tSec = 60 then
add 1 to tMin
put 00 into tSec
If tMin = 60 then
add 1 to tHr
put 00 into tmin
end if
end if
if tMin = 0 then put 00 into tMin
if tHr = 0 then put 00 into tHr
put tHr & ":"& tMin & ":" & tSec into fld GameClock
if label of button "ClockButton" is "First Pitch"
else
send startClock to me in 1 sec --go back to the top and do it again in 1 sec
end if
end startClock
on TimesUp
end TimesUp
Reset Script
local tsec, tmin, thr
on mouseUp
If the label of me is "RESET" then
put 00 into tSec
put 00 into tMin
put 00 into tHr
put empty into field "GameClock"
end if
end mouseUp