mIRC Homepage
Posted By: RRX $timer().paused ? - 13/05/07 02:58 PM
How to find out if a timer is paused or not?
When you do /timername -p the timer seems to keep running until the .secs property becomes zero, and then stops, without triggering the command.
If it would immediately set the .secs to zero, I could use if ($timer(name).secs == 0) { timer is paused here } to know it.
So there is something missing here, and having to use a variable for each timer to store the fact that timer was paused is surely a poormans-solution.
Posted By: RusselB Re: $timer().paused ? - 13/05/07 04:58 PM
The fact that the /timer -p command doesn't work as most would expect, ie: stopping the timer until the /timer -r command is used, has been reported before, and a while back. Since there's been at least 2 releases of mIRC since it was reported, I'm going to presume that Khaled is having difficulty figuring out how to amend the timer process.

Unfortunately, I can't think of a better solution than your poormans-solution

Personally, I'd like to see a pause option added to the $timer identifier that returns $true if the timer is paused or $false if it isn't.
Posted By: Spitfire3292 Re: $timer().paused ? - 14/05/07 03:51 AM
That would be very helpful. This should be added. I don't see how this could be too much of a difficulty to add that property to $timer() All it would have to do is check if the -p switch is there and return $true, otherwise return $false.
Posted By: RRX Re: $timer().paused ? - 14/05/07 02:07 PM
Another extra overhead caused by storing this paused status is that you have to clear the variables-whatever up on disconnection since mirc switches online timers automatic off for that network. So using in-between aliases to start/stop/pause/resume timers alone is not enough, the variables or hashitems need to be named in such a way that you can unset/hdel -w them alike hdel -w Net,SomeNetwork,Timerpaused,* with * representing the timername

Maybe something related: I'm busy on a script that makes alot use of timers (command queuing, scanning, timeouts, monitoring and performance-throttling), I name the timers following some rules, some examples:
Code:
* Timer sc_sendqueuewarnings 1800s delay SC_SendQueue_WarnSuspended
* Timer sc_ircscannerwhois 60s delay SC_IRCScanner_Scan COMMAND WHOIS
* Timer sc_sendqueuelowspeedcheck 60s delay SC_SendQueue_CheckLowSpeed
* Timer sc_ircchannelscan 30s delay SC_ChannelList_GlobalScan
* Timer sc_ircscannerjoin 20s delay SC_IRCScanner_Scan COMMAND JOIN
* Timer sc_ircscannerlag 30s delay SC_IRCScanner_Scan COMMAND LAG
* Timer sc_ircscannerwho 20s delay SC_IRCScanner_Scan COMMAND WHO
* Timer sc_scheduler 5s delay SC_Schedules
* Timer sc_ircqueueschopperinterval 5000ms delay SC_IRCQueues_Chopper OFF
* Timer sc_offers 1 time(s) 1642s delay SC_ChannelList_ShowAd TIMER REAL (UnderNet)

Format as SC_<systemname><purpose>
For throttling I sometimes switch a whole system 'off' temporarly, ie, processing stops, all timers for that system are paused, it would eliminate the need for a loop on all timers if you were able to specify wildcards in the timerwildcardedname -p or -r, it already supports it when switching off (timername* off) * 2 timer(s) matching name* halted.
Posted By: Spitfire3292 Re: $timer().paused ? - 14/05/07 06:44 PM
About saying that timers are automatically turned off when disconnected from the network isn't always true. The -o switch in timers allows the timers to keep running even after the network is disconnected. If the mIRC quits, everything is halted so it doesn't matter then anyway.
Posted By: RRX Re: $timer().paused ? - 15/05/07 02:31 PM
Originally Posted By: Spitfire3292
About saying that timers are automatically turned off when disconnected from the network isn't always true. The -o switch in timers allows the timers to keep running even after the network is disconnected. If the mIRC quits, everything is halted so it doesn't matter then anyway.

I know and I did say "switches online timers automatic off", the 'online' there is the opposite of the -o (offline) switch-type timers.
Posted By: RRX Re: $timer().paused ? - 02/08/07 01:35 AM
Another request regarding timers:
When having multiserver scripts, it happens quite frequently something needs to happen globally on a regular base (a timer).
Which is then a script that needs to be executed as long as there is at least one connection, i.e: timers that are removed at the point there are no connections left (not a single one with $status connected).
That would eliminate the need for a script to check at every disconnection if there is still a connection left and if not, stop those timers (that were created with -oi).
Posted By: qwerty Re: $timer().paused ? - 02/08/07 07:09 AM
That's what -i alone does already.
Posted By: Wims Re: $timer().paused ? - 25/05/08 11:36 PM
The $timer(name).paused hasn't been added to mIRC 6.32, i'm not sure why, i think it's a very useful suggestion and should be added since there is no workaround frown
Posted By: RRX Re: $timer().paused ? - 18/07/08 09:55 PM
33.Added $timer().pause property.
YAY!
Now about timerABC* -p to pause all matching timers similar to timerABC* OFF grin
© mIRC Discussion Forums