mIRC Home    About    Download    Register    News    Help

Print Thread
#176711 13/05/07 02:58 PM
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
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.

RRX #176723 13/05/07 04:58 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

Last edited by RusselB; 13/05/07 05:00 PM.
Joined: Mar 2007
Posts: 60
S
Babel fish
Offline
Babel fish
S
Joined: Mar 2007
Posts: 60
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.


"In order to succeed, your desire for success should be greater than your fear of failure."
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
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.

RRX #176826 14/05/07 06:44 PM
Joined: Mar 2007
Posts: 60
S
Babel fish
Offline
Babel fish
S
Joined: Mar 2007
Posts: 60
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.


"In order to succeed, your desire for success should be greater than your fear of failure."
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
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.

RRX #181918 02/08/07 01:35 AM
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
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).

RRX #181924 02/08/07 07:09 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
That's what -i alone does already.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
RRX #200007 25/05/08 11:36 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #202253 18/07/08 09:55 PM
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
33.Added $timer().pause property.
YAY!
Now about timerABC* -p to pause all matching timers similar to timerABC* OFF grin

Last edited by RRX; 18/07/08 10:04 PM.

Link Copied to Clipboard