From WikiChip
Editing mirc/on events/on parseline

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
 
{{mirc title|On Parseline - Events}}
 
{{mirc title|On Parseline - Events}}
The '''on parseline''' event triggers before incoming/outgoing IRC server lines are received/sent and allows a script to modify them.
+
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. {{mIRC|/ctcp}} also uses PRIVMSG with a special encoding to indicate it is CTCP. {{mIRC|/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.
 
  
 
== Synopsis ==
 
== Synopsis ==
<source lang="mIRC">on <level>:parseline:in|out|*:<matchtext>:<commands></source>
+
<source lang="mIRC">
 +
on <level>:parseline:in|out:<matchtext>:<commands>
 +
</source>
  
 +
== Level ==
 
* '''<level>''' - The appropriate {{mIRC|access levels}} for the event.
 
* '''<level>''' - The appropriate {{mIRC|access levels}} for the event.
* '''<matchtext>''' - See the {{mIRC|on text}} event page for a definition of the <matchtext> parameter and related prefixes.
 
  
== Notes ==
+
== Matchtext ==
'''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.
 
<source lang="mIRC">on *:parseline:out:PRIVMSG *Hello:echo -a $parseline</source>
 
will '''not''' be triggered when you type "Hello" in a channel or query window. Instead you will need something like:
 
<source lang="mIRC">
 
on *:parseline:out:PRIVMSG *Hello?:echo -a $parseline
 
on *:parseline:out:PRIVMSG *Hello*:echo -a $parseline</source>
 
  
'''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.
+
See the {{mIRC|on text}} event page for a definition of the <matchtext> parameter
<source lang="mIRC">
 
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
 
</source>
 
  
 
== {{mIRC|/parseline}} ==
 
== {{mIRC|/parseline}} ==
Line 34: Line 20:
 
== Local identifiers ==
 
== Local identifiers ==
  
The on parseline event exposes 3 local identifiers:
+
The on parseline event expose 3 local identifiers
  
 
=== {{mIRC|$parsetype}} ===
 
=== {{mIRC|$parsetype}} ===
Line 53: Line 39:
  
 
== See also==
 
== See also==
* {{mIRC|/parseline}}
 
* {{mIRC|$parseline}}
 
* {{mIRC|$parseutf}}
 
 
* [[List of on events - mIRC|List of on events]]
 
* [[List of on events - mIRC|List of on events]]
 
* [[List of identifiers - mIRC|List of identifiers]]
 
* [[List of identifiers - mIRC|List of identifiers]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)