mIRC Home    About    Download    Register    News    Help

Print Thread
#164611 14/11/06 12:52 PM
Joined: Nov 2006
Posts: 1
P
para11 Offline OP
Mostly harmless
OP Offline
Mostly harmless
P
Joined: Nov 2006
Posts: 1
Hello, I'm trying to send auto msg to my colleagues in v+ and op+ in my channel. So when i add this line to my alias.

on *:JOIN:#myteam: { .timer 1 4 msg.check $nick # } alias msg.check { if !$1 { halt } if { $2 isreg $1 } { msg $2 Please login to the admin http://www.mysite.com/admin/ } else { halt } }

It says: MSG.CHECK Unknown command

Thanks for the help.

#164612 14/11/06 01:54 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
You would appear to need a newline.

The alias definition and the event handler (on ...) should each start on their own line.

e.g.

Code:
on *:JOIN:#myteam: { 
    .timer 1 4 msg.check $nick # 
} 
alias msg.check {
    if { $$1 isreg $$2 } { 
        msg $1 Please login to the admin ttp://www.mysite.com/admin/ 
    } 
    else {
        halt 
    }
}


The $$ in front of the $1 obviates the need for the halt you had in your code. If $$1 is not set, the command will halt.

You had $1 and $2 in the reverse order; calling as msg.check <nick> <chan>, but processing them as if you had called msg.check <chan> <nick>. One good reason I often assign named variables from passed-in parameters at the start of my aliases (even if it isn't 'efficient' to do so, it's often more readable).

Also note that the 'else' needs to start on its own line (or be separated with a command separator "|", which amounts to the same thing)

I tend to try to define aliases ahead of the places I use them, but that's just a hangover from other programming languages. Defining it after the event handler will work as well smile


Sais
#164613 14/11/06 09:50 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
using Sais's code, you coudl even just do.

on *:JOIN:#myteam: { $+(.timer.on.join.web.ad.to.,$nick) 1 4 if ( $nick isreg $chan ) $({,) .msg $nick Please login to the admin http://www.mysite.com/admin/ $(},) }

this well avoid a join part flood mass pm as well.


Link Copied to Clipboard