mIRC Home    About    Download    Register    News    Help

Print Thread
need dynamic /timer name example #270004 06/03/22 02:23 PM
Joined: Mar 2022
Posts: 2
T
thamirios Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Mar 2022
Posts: 2
Hello community, I'm looking for an example for the dynamic assignment of timer names, if this is supported at all.
I've tried the following ways but so far I'm not getting the results I'm hoping for.

Code
/timer$nick 4 2 /doWhatever
; the timer should have the content of $nick as name
; but results in a timer named "$nick"

var %nickvar = $nick
/timer%nickvar 4 2 /doWhatever
; the timer should have the content of %nickvar as name
; but results in a timer named "%nickvar"

/timer $+ $nick 4 2 /doWhatever
; the timer should have the content of $nick as name
; but results in a timer named "1"


I've also tried the -N switch, but the result is the same.
Am I using the syntax incorrectly or does /timer not have the function I'm hoping for?
Is there another way to assign a timer to a $nick without a translation table (timer1 = %nick1, timer2 = %nick2, ...)?
I guess I just don't see the easy way. wink

Re: need dynamic /timer name example [Re: thamirios] #270008 06/03/22 09:52 PM
Joined: Jan 2004
Posts: 1,745
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,745
Your 3rd example does what you want, assuming you're doing it in an event where $nick is defined.

If you're doing this in the editbox it fails because you're using only a single slash so identifier wouldn't evaluate, and because $nick isn't defined there either.

If you're doing this inside a script and getting timer1 from it, that's because $nick is not defined, so you're doing the same as timer $+ $null

Re: need dynamic /timer name example [Re: maroon] #270013 07/03/22 07:09 PM
Joined: Mar 2022
Posts: 2
T
thamirios Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Mar 2022
Posts: 2
Thank you for your prompt reply.
I triggered it like this because I find this possibility easy to test.

Code
menu channel {
  timertest2:/timer $+ $nick 4 2 /echo $chan $nick
}


and the result looks like this.

Quote

* Timer 1 activated
* /echo: insufficient parameters
* /echo: insufficient parameters
* /echo: insufficient parameters
* /echo: insufficient parameters
* Timer 1 halted


so it's true that $nick is undefined.
I tried it now with the on:join event.

Code
on *:join:*:{
  timer $+ $nick 4 2 /echo $chan $nick
}


Quote

*** user1 has joined #Lobby
* Timer user1 activated
user1
user1
user1
user1
* Timer user1 halted


it works fine here. a useful information that $nick is not filled by menu.
I can live with that, I only need the function in the on:join and on:part events.
many thanks for the help. smile

Re: need dynamic /timer name example [Re: thamirios] #270015 07/03/22 08:18 PM
Joined: Jul 2006
Posts: 3,880
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,880
The selected nickname(s) inside a nicklist can be access with $1 $2 etc.