mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I saw this as a missing feature, and found related feature suggestions back at least to 2008.

https://forums.mirc.com/ubbthreads.php/topics/225653/

Currently there's not a way to use $timer() to externally inspect a timer to find out whether $timer().delay of 5000 is '5000 seconds' or '5000 milliseconds'. If the timer was a multimedia timer created using the -h switch, you can use ().mmt to know that 5000 means milliseconds. But if it were created with -m only, the only way I can think of for a script to inspect whether a non-mmt timer's delay interval is measured in seconds or milliseconds is to contrive to send the output of '/timer' to a @window then inspect the line contents for the first parameter following "time(s)" to see if the next parameter ends with 's' or 'ms'.

Code:
//var %i 1 | if (!$timer(0)) echo 4 -g * No active timers | else  echo 4 -s * Active timers: | while (%i <= $timer(0)) { echo $color(info) -a * Timer $timer(%i) $timer(%i).time $timer(%i).reps time(s) $timer(%i).delay $+ $iif($timer(%i).mmt,ms,s) delay $timer(%i).com $+($chr(40),$scid($timer(%i).cid).network,$chr(41)) | inc %i }


This somewhat mimics the /timer command, and can correctly identify the delay for the multimedia timer if it's active, but can't tell if any of the other timers actually have a delay defined in milliseconds.

Instead of ().ms returning $true or false like .mmt does, it would be more useful if it were something like .secs except that it instead returns the value in milliseconds remaining, additionally ending with .0 if the timer was created with -m or -h. It appears that .secs returns a time that has the fraction removed, so .secs returning 1 is actually expecting to execute anywhere from 1.0 to 1.9 seconds in the future.

It would be useful for both normal and -m timers to report a more accurate time until execution. $().ms or $().millisecs returning a value of 1500 would inform that the timer is 'due' to execute in 1.5 seconds and the ().delay number is defined in seconds, while the value 1500.0 containing a period would additionally indicate that ().delay should be interpreted as milliseconds.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Yes, this has been asked so many times on this forum, it could overflow. I support this.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Very nice suggestion. +1

I prefer .mt on $timer() identifier that will specify $true/$false and then you can add your IF checks to check if the .delay value is seconds or milliseconds.

Last edited by westor; 16/06/18 11:00 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard