mIRC Homepage
Posted By: para11 Unknown Commands - 14/11/06 12:52 PM
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.
Posted By: Sais Re: Unknown Commands - 14/11/06 01:54 PM
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
Posted By: DaveC Re: Unknown Commands - 14/11/06 09:50 PM
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.
© mIRC Discussion Forums