The on parseline event triggers before incoming/outgoing IRC server lines are received/sent and allows a script to modify them.
The incoming / outgoing lines are in IRC protocol which is very different to the terminology used in the mIRC front end. For example all messages to channels and individual users are sent / received using PRIVMSG. /ctcp also uses PRIVMSG with a special encoding to indicate it is CTCP. /me action messages are a specific type of CTCP message etc. Use of PARSELINE should therefore be considered advanced scripting and is not for the faint-of-heart.
Because PARSELINE will be called for every matching line, care should be taken to provide the best possible matchtext in order to minimise the number of times it is called, and to keep the processing undertaken to a reasonable level.
- <level> - The appropriate access levels for the event.
- <matchtext> - See the on text event page for a definition of the <matchtext> parameter and related prefixes.
Note 1: For out lines, the text you are matching against has a $LF as the last character that you need to account for in your match text. e.g.
on *:parseline:out:PRIVMSG *Hello:echo -a $parseline
will not be triggered when you type "Hello" in a channel or query window. Instead you will need something like:
on *:parseline:out:PRIVMSG *Hello?:echo -a $parseline on *:parseline:out:PRIVMSG *Hello*:echo -a $parseline
Note 2: The ":" character is used quite frequently as a separator in IRC raw messages, but it is also used as a separator in mSL's ON statements. You can either use a placeholder for a single character (?) or multiple characters (*) or you can use a calculated match text or a regular expression for the ":" e.g.
on *:parseline:out:PRIVMSG *Hello?:echo -a $parseline on *:parseline:out:PRIVMSG & ?Hello?:echo -a $parseline on *:parseline:out:$(PRIVMSG & :Hello?):echo -a $parseline on $*:parseline:out:/^PRIVMSG [^ ]+ :Hello./:echo -a $parseline
Inside this event, you can use /parseline without the -q switch to change the line.
The on parseline event exposes 3 local identifiers:
Return the type of line, "in" or "out"
Return the line being sent/received.
Note: For out lines, $parseline is terminated with a $LF character that is not visible when viewed in mIRC. You may wish to remove this with:
var %pl $parseline if ($asc($right(%pl,1)) == 10) %pl = $right(%pl,-1)
Return $true if mIRC is going to decode/encode utf8 the message after the on parseline event