Project

General

Profile

Matchtext » History » Revision 6

Revision 5 (Per Amundsen, 11/14/2015 01:50 AM) → Revision 6/11 (Per Amundsen, 11/14/2015 02:11 AM)

{{>toc}} 

 h1. Matchtext 

 A <matchtext> is a text pattern that AdiIRC will use to compare with something during a [[Scripting_Events|scripting event]]. 

 h1. Wild characters 

 The matchtext can contain wild characters: 

 <notextile>* - matches any text</notextile> 
 <notextile>? - matches any single letter</notextile> 
 <notextile>& - matches any single word</notextile> 

 *Example* 

 <pre> 
 ; The matchtext will only match if the ONLY word is "!test" 
 on *:TEXT:!test:*:echo -ag Match 

 ; The matchtext will match if the text starts with "!test" 
 on *:TEXT:!test*:*:echo -ag Match 

 ; The matchtext will match if the text ends with the word "!test" 
 on *:TEXT:*!test:*:echo -ag Match 

 ; The matchtext will match any text that has "!test" in it (anywhere) 
 on *:TEXT:*!test*:*:echo -ag Match 

 ; The matchtext will match any text that start with the word test !test and his only followed by a second word 
 on *:TEXT:!test &:*:echo -ag Match 
 </pre> 

 h1. Regex text pattern 

 The matchtext parameter can also be a [[[Scripting Regex|Regular Expression]] Pattern by using the '$' event prefix. 

 *Example* 

 <pre> 
 on $*:text:/^!test$/i:#:{ 
   msg $chan Test Worked! 
 } 
 </pre> 

 h1. Matchtext Evaluation 

 Matchtext can be evaluated using [[$]](code) or contain a single [[Scripting_Variables|%variable]]. 

 *Example* 
 <pre> 
 ; Set a target variable. 
 set %target #channel 

 ; Subscribe to the TEXT event, try evaluate my nick, and if it matches, print a text. 
 on *:TEXT:$(* $+ $me $+ *)):*:echo *)):%target:echo -ag My nick was highlighted on $chan %target 
 </pre>