mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2013
Posts: 2
T
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Sep 2013
Posts: 2
I'm having trouble getting timers to call an alias to print to the correct channel. For example, the following acts as an echo. It does not print to the channel I am currently in, instead it prints to the console.

Code:
alias test { msg $chan test called }
on *:TEXT:test:#: { /timerStartTest 1 2 /test  }


However, if I make the following change

Code:
;alias test { msg $chan test called }
on *:TEXT:test:#: { /timerStartTest 1 2 msg $chan hi}


I get the message 'hi' printed to the correct channel. Is there some sort of interaction I'm missing here? I appreciate any help!

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
$chan only resolves from an event, the timer is in a different scope. You need to pass the channel name to the alias.

Joined: Sep 2013
Posts: 2
T
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Sep 2013
Posts: 2
Thanks! That does work! For future searchers, the following code should look like this:

Code:
alias test { msg $1 test called }
on *:TEXT:test:#: { /timerStartTest 1 2 /test $chan }

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Unfortunately, that code is open to exploit, you can read more about it there http://www.zigwap.com/mirc/eval_injection and I recommend you use the $safe alias around $chan.

Last edited by Wims; 22/09/13 09:10 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard