|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
I've decided to script /timers to match in with my theme, but i got a question about one of the properties. I've made a loop to list them all, but i'm using $timer(%i).delay to show the delay of course, but is there a suffix to add to it so it can show if it's a 1 second timer, a 100ms timer, a 1hour timer etc etc. Thanks in advance.
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
I never realized there was no property to return $true/$false for the -m switch. There should be a .ms property for the $timer() identifier. You should suggest it. 
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
Ahh, there's me scouting through the help file to find anything i may have missed, i thought i may have got a reply that said 'have youlooked in the help file' lol I shall do that!
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
This should do the trick: alias isms if ($timer($1).delay) return $iif($calc($timer($1).secs * 1000) <= $v1,$true,$false) $isms(blah) returns $true if 'blah' is a millisecond timer.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
I ran a 500ms timer as a check
* Timer 1 500ms delay time::setup (Stonedpenguin)
$isms(1) returns $false for me
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
It returned $true every time for me when I tried a 500ms timer, named and numbered.
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
hmm, odd. If it's named it returns $true, if it's a number it always returns $false It seems it's not consistant, if i use it in my /timers alias the results keep changing everytime i do /timers My timers that are in seconds sometimes return $false and $true same with the millisecond ones
Last edited by vexed2; 27/04/08 06:25 PM.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
This is not a problem with the alias but with the fact that unnamed (or numerically named) timers are kind of tricky to work with: $timer() accepts either a name or a number, but when a number is specified, it is always treated as an index, not as a timer name. To see this point, try:
//.timertest 1 0 noop | .timer1 1 0 noop | echo -a $timer(1)
So, assuming you can find the right timer instance, $isms should work correctly. Example:
//.timertest -m 6 500 noop | echo -a $isms(test) | .timer 1 2 echo -a $!isms(test)
should output $true twice.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
/timerTEST -m 0 500 echo -a test1 - * Timer test activated -
/timer 0 1 echo -a test2 - * Timer 1 activated -
//echo -a $isms(1) <-- $false <--
~ Edit ~ What he said.
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
but when a number is specified, it is always treated as an index, not as a timer name.
Well it seems that's not always true if you look at my last post, if it were then it should have returned $true, but in my example, the 2nd timer is named 1 and is not a ms timer and your identifier returned $false. If the number 1 were treated as an index in my case, then it should have returned $true becuse the first timer IS a ms timer.
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
I have 2 timers running at 500ms, 1 named, 1 not. The results keep changing They both sometimes return $true and both sometimes return $false AND 1 shows to be $false while the other $true. No consistancy
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
Try using the -d switch when you start the timers and see if there's a difference in consistancy.
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
I don't mean for the actual timers, i'm saying i have two 500ms timers running, 1 named and 1 not. When doing /timers using qwerty's alias they keep changing between $false and $true
[#4 ] [500 ] [online ] [$false ] [1 ] [time::setup ] [#5 ] [500 ] [online ] [$true ] [test ] [time::setup ]
Both 500ms, so why is one false? lol
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
Are those the only two timers running? Maybe it's returning $false for another timer that's not a ms timer.
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
OP
Fjord artisan
Joined: Mar 2007
Posts: 218 |
You're right, it is.
[#1 ] [500 ] [online ] [$true ] [1 ] [time::setup ] [#2 ] [500 ] [online ] [$true ] [test ] [time::setup ]
[#1 ] [1 ] [online ] [$false ] [_sbar ] [sbar::update ] [#2 ] [500 ] [online ] [$false ] [1 ] [time::setup ] [#3 ] [500 ] [online ] [$true ] [test ] [time::setup ]
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
but when a number is specified, it is always treated as an index, not as a timer name.
Well it seems that's not always true if you look at my last post, if it were then it should have returned $true, but in my example, the 2nd timer is named 1 and is not a ms timer and your identifier returned $false. If the number 1 were treated as an index in my case, then it should have returned $true becuse the first timer IS a ms timer. This is happening because it seems mirc doesn't order timers according to their creation time (from the scripter's point of view). I'm not sure how it does it exactly but one this is for sure: that order changes as timers fire (maybe timers with reps > 1 are treated as separate 1-rep timers, in the sense that they are re-inserted in mirc's timer list each time). Try this for example: //.timertest -m 0 500 noop | .timer 0 1 noop | .timerecho -m 0 100 echo -a $!timer(1) Small excerpt of the results here:
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
Yeah that's what I was thinking too. Instead of a timer started with 0 reps being one continuous timer executing every N seconds, it actually restarts everytime it executes?
|
|
|
|
|