stopping a send/repeat loop?
John Tenny
jtenny at willamette.edu
Sun Jul 20 18:46:00 EDT 2003
First, thanks for all the encouragement. Must have been having a bad
beard day.
Working on a timer where there are two clocks. Clicking on timer 1
starts it and display no of seconds and % of total time; clicking on
timer 2 stops the first timer and starts it own set of displays.
Clicking back on timer 1 stops timer B and restarts timer 1.
Only it doesn't. I'm sure it simpler than this. Sometimes I can get one
clock working, but the second button won't stop it. The following
script, although they appear similar to me, get stopped by the debug
mechanism at different points. I kinda had more success with
switch/case, but could never get the first timer to stop when clicking
the button for the second timer.
Anyway: -------------------Timer 1----------------
--this is off task button 1093
global passingtime1,passingtime2,passingtime3,gswitch
set the numberFormat to "0."
on mouseup
send CountDown to me in 1 secs
end mouseup
------------
on CountDown
put false into gswitch
repeat until gswitch = true
add 1 to passingtime2--timer no. 2
put passingtime2 into cd fld "b1f2x"--display timer 2
add 1 to passingtime3--total time both timers
put passingtime3 into cd fld "b1f3x"--disply total time
put (passingtime2/passingtime3*100) & "% off task" into cd fld
"b1f3"
-- % time off task
put (100-(passingtime2/passingtime3*100)) & "% on task" into cd
fld "b1f2"
-- % time on task
end repeat
end countdown
----------------end of timer 1-----------------
-----------------timer 2-----------------
--this is on task button 1092
global passingtime1,passingtime2,passingtime3,gswitch
set the numberFormat to "0."
on mouseup
send "CountDown" to me in 1 secs
end mouseup
------------
on CountDown
put true into gswitch
repeat until gswitch = false
add 1 to passingtime1 -- timer no 1
put passingtime1 into cd fld "b1f1x" -- display time 1
add 1 to passingtime3 -- total time both timers
put passingtime3 into cd fld "b1f3x" --display total time
put (passingtime1/passingtime3*100) & "% on task" into cd fld "b1f2"
-- % time on task
put (100-(passingtime1/passingtime3*100)) & "% off task" into cd
fld "b1f3"
-- % time off task
end repeat
end CountDown
------------------end of timer 2---------------
Hope you can help. My head hurts, my eyes won't focus, and I have to go
to the bathroom really bad.
John
More information about the use-livecode
mailing list