ischan is an operator, not a command, /msg is a command.
%chan is a variable, I think you typoed and you meant $chan, the identifier referring to the channel the event triggered on (you have correctly $chan inside the else statement).
The ischan operator is meant to be used to check if you have a channel window opened with that name.
Note that it doesn't mean that you are on the channel, it's possible to get a channel window opened without being on that channel, if you want to check that you are on a channel, use the ison operator.


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