mIRC Home    About    Download    Register    News    Help

Print Thread
#125843 22/07/05 12:03 PM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
$ltimer
Returns the number of the last timer that was started by the /timer command.

EX:
alias zzz { echo -a zzz }
timer1 1 5 zzz
timer2 1 1 zzz

after 2 secs:
$ltimer returns 2 .... right ?

after 6 secs:
$ltimer returns 2 again... right ?

if this is true .. how can i get the name of the timer that was last executed in the alias and print its name/number ?


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#125844 22/07/05 04:45 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I'm not too sure what you mean...

But try something like this:

Usage: /ltimer

Code:
alias ltimer {
  $+(timer,$replace($($str($!rand(a,z) $+ $chr(32),3),3),$chr(32),$chr(3)),$rand(500,1)) 1 1 echo -a $ltimer
}


-Andy

#125845 22/07/05 05:31 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
as far as $ltimer it shows the last one Started, rather than the last one that did something or is active

sample
Code:
alias zzz { echo -a zzz $ltimer | timers }
alias yyy timer1 1 5 zzz | timer2 2 1 zzz


Output:

* Timer 1 activated
* Timer 2 activated
zzz 2
-
* Active timers:
* Timer 1 1 time(s) 5s delay zzz (SandNet)
* Timer 2 1 time(s) 1s delay zzz (SandNet)
-
zzz 2
-
* Active timers:
* Timer 1 1 time(s) 5s delay zzz (SandNet)
* Timer 2 1s delay zzz (SandNet)
-
* Timer 2 halted
zzz 2
-
* Active timers:
* Timer 1 5s delay zzz (SandNet)
-
* Timer 1 halted

#125846 22/07/05 06:44 PM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
so ... is there any way to get the name of tha last timer that did something ...


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#125847 23/07/05 08:40 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I dont beleive so

If there isnt then
You would have to insert a command into every timer that simply stored the active timername something like

alias LATimer {
if ($isid) { return %LATimer }
if ($ctimer) { set %STLATimer -u1000000000 %LATimer | set -u1000000000 %LATimer $ctimer }
}
alias STLATimer { return %STLATimer }

in each timer you make u have to put the line
/LATIMER

and u can access it using $LATIMER

* I just added a $STLAtimer (second to last active) incase u need to go one back, i can see someone putting /LATIMER at the start of each timer alias, then needing to acces the timer before it!

* if the timers are commands not aliases, then you could add it like this
timer 1 1 echo blah blah blah
becomes
timer 1 1 latimer $(|,) echo blah blah blah


***
this is definitly a patchup since i would have said write a custom /TIMER command to deal with adding the command, but you cant since when u name timers u attache the name to /TIMER as /TIMERname and thus the alias doesnt get called frown

I guess you could do something with a timer of its own to add them, but thats pretty task intensive, also yoyu cant pull all the needed info about a timer i dont think to alter it.
be a fun exercise to try tho.

Are these your own timers u want the name off or any that go off ?


Link Copied to Clipboard