Aarlot Adept

Joined: 30 Dec 2003 Posts: 226
|
Posted: Tue Jun 08, 2004 7:09 am
Buttons staying up to date, expression triggers |
I have two problems here, actually. I'm attempting to make a timer system that does not use the tick timer, since I use that for other things. I'm using the %time functions, and it works great so far, except in two minor details. Here is the coding I have so far:
Code: |
#CLASS {Timers}
#ALIAS timeron {
#MATH starttime (%eval( @tinsec) + %eval( @tinmin*60) + %eval( @tinhour*3600))
#MATH endtime (@starttime + @timersec + %eval( @timermin*60))
#IF (@endtime > 86399) {#ADD endtime -86400}
#BUTTON 5 "%eval( @endtime - %eval( %time( s) + %eval( %time( n)*60) + %eval( %time( h)*3600))) seconds" {} {} {} {%eval( @endtime - %eval(%time( s) + %eval(%time( n)*60) + %eval(%time( h)*3600)))} {} {} {Size} {160} {23} {} {} {} {32} {} {Gauge||12|%%eval(@endtime - @starttime)|5|7} {} "Timers|Timerbuttonclass" {Explore|Inset} {Time left on Timer} {Timershow2}
}
#ALIAS timeroff {#DELCLASS Timers|Timerbuttonclass}
#VAR timermin {2}
#VAR timersec {6}
#VAR tinsec {%time( s)}
#VAR tinmin {%time( n)}
#VAR tinhour {%time( h)}
#VAR starttime {83688}
#VAR endtime {83814}
#VAR secsleft {%math( @endtime - (%time( s) + (%time( n)*60) + (%time( h)*3600)))}
#ONINPUT {timer (%d)m (%d)s} {
timermin = %1
timersec = %2
#IF (@timersec > 60) {
#UNTIL (@timersec < 60) {
#ADD timermin 1
#ADD timersec -60
}
}
#GAG
#ECHO Timer now at @timermin minutes and @timersec seconds.
}
#TRIGGER (%eval( @secsleft) = "0") {
#ECHO Time's up!
timeroff
}
#CLASS 0
|
My problem is that, since there is no variable being changed for the time left, the gauge does not update unless clicked on, and the trigger will not fire, since "expression trigger (expression is tested whenever a variable is changed)" according to the help files. Any way to keep these up to date without having a trigger fire every second and slowing the comp waaaaay down? Advance thanks for any help.
(BTW, I know some of it's a bit rough, it's a work in progress. Feel free to give pointers in other areas as well )
*edit - refined the code a bit |
|