<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://script.quakenet.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ollie</id>
	<title>Scriptwiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://script.quakenet.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ollie"/>
	<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/Special:Contributions/Ollie"/>
	<updated>2026-05-15T00:52:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$isfile&amp;diff=1912</id>
		<title>$isfile</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$isfile&amp;diff=1912"/>
		<updated>2007-05-16T10:37:55Z</updated>

		<summary type="html">&lt;p&gt;Ollie: page created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns informations on whether or not a file exists.&lt;br /&gt;
&lt;br /&gt;
$isfile(file)&lt;br /&gt;
&lt;br /&gt;
Returns $true if the file exists, otherwise it will return $false&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
 alias exists? {&lt;br /&gt;
  if ($isfile($1)) { return file exists! } | else { return file doesn&#039;t exist }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
$isdir(C:\program files\mirc\mirc.ini)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
[[$isdir]] to check if a directory exists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:File and Directory Identifiers]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$isdir&amp;diff=1915</id>
		<title>$isdir</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$isdir&amp;diff=1915"/>
		<updated>2007-05-16T10:36:52Z</updated>

		<summary type="html">&lt;p&gt;Ollie: page spacing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns informations on whether or not a directory exists.&lt;br /&gt;
&lt;br /&gt;
$isdir(directory)&lt;br /&gt;
&lt;br /&gt;
Returns $true if the directory exists, otherwise it will return $false&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
 alias exists? {&lt;br /&gt;
  if ($isdir($1)) { return directory exists! } | else { return directory doesn&#039;t exist }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
$isdir(C:\program files\mirc)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
[[$isfile]] to check if a file exists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:File and Directory Identifiers]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$isdir&amp;diff=1908</id>
		<title>$isdir</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$isdir&amp;diff=1908"/>
		<updated>2007-05-16T10:34:41Z</updated>

		<summary type="html">&lt;p&gt;Ollie: page spacing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns informations on whether or not a directory exists.&lt;br /&gt;
&lt;br /&gt;
$isdir(directory)&lt;br /&gt;
&lt;br /&gt;
Returns $true if the directory exists, otherwise it will return $false&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
$isdir(C:\Windows)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$isdir(C:\zebra\lala\moocow)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
[[$isfile]] to check if a file exists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:File and Directory Identifiers]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$isdir&amp;diff=1907</id>
		<title>$isdir</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$isdir&amp;diff=1907"/>
		<updated>2007-05-16T10:34:09Z</updated>

		<summary type="html">&lt;p&gt;Ollie: Page added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns informations on whether or not a directory exists.&lt;br /&gt;
&lt;br /&gt;
$isdir(directory)&lt;br /&gt;
&lt;br /&gt;
Returns $true if the directory exists, otherwise it will return $false&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
$isdir(C:\Windows)&lt;br /&gt;
$isdir(C:\zebra\lala\moocow)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
[[$isfile]] to check if a file exists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:File and Directory Identifiers]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=4566</id>
		<title>!seen</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=4566"/>
		<updated>2007-03-19T16:49:21Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pretty simple !seen script.&lt;br /&gt;
&lt;br /&gt;
 ;Seen script, pretty much self-explanatory.&lt;br /&gt;
 ;Syntax:&lt;br /&gt;
 ;/seen on/off&lt;br /&gt;
 ;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] &lt;br /&gt;
 ;Just add any words you don&#039;t want to be used.&lt;br /&gt;
 ;/msg #channel/bot !seen name&lt;br /&gt;
 ;* &lt;br /&gt;
 ; Ollie&lt;br /&gt;
 &lt;br /&gt;
 alias seen {&lt;br /&gt;
   if ($1 == del) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
     if (!$read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is not in the database. | return }&lt;br /&gt;
     write -dw $+ $2 funny.txt&lt;br /&gt;
     echo -a Removed: $+(&amp;quot;,$2,&amp;quot;,.) From the &#039;funny&#039; words list.&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   if ($1 == add) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
     if ($read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is already in the database. | return }&lt;br /&gt;
     write funny.txt $2&lt;br /&gt;
     echo -a Added: $+(&amp;quot;,$2,&amp;quot;,.) To the &#039;funny&#039; words list.&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   if ($1 == on) {&lt;br /&gt;
     echo -a Seen Status: On&lt;br /&gt;
     set %seen on&lt;br /&gt;
     return&lt;br /&gt;
    }&lt;br /&gt;
   if ($1 == off) {&lt;br /&gt;
     echo -a Seen Status: Off&lt;br /&gt;
     set %seen off&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   echo -a Unknown parameter.&lt;br /&gt;
 }&lt;br /&gt;
 on *:text:!seen*:*:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   var %target = $iif($chan,$chan,$nick)&lt;br /&gt;
   if (!$2) { notice $nick seen whom? | return }&lt;br /&gt;
   if ($2 == $nick) { &lt;br /&gt;
     describe %target hands $nick a mirror. &lt;br /&gt;
     return &lt;br /&gt;
   }&lt;br /&gt;
   if ($chan) &amp;amp;&amp;amp; ($2 ison $chan) { &lt;br /&gt;
     msg %target $2 Is in the channel! $iif(%last.spoke. [ $+ [ $2 ] ],His/her last words were: %last.spoke. [ $+ [ $2 ] ],They haven&#039;t spoken anything yet!) &lt;br /&gt;
     return &lt;br /&gt;
   }&lt;br /&gt;
   if (!%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
     if ($read(funny.txt, w, $2)) { &lt;br /&gt;
       msg %target hoho. aren&#039;t you a funny one &lt;br /&gt;
       halt &lt;br /&gt;
     } &lt;br /&gt;
     if (!%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
       msg %target i have never seen $2 | return &lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   if (%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
     msg %target I last saw $2 %seen. [ $+ [ $2 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $2 ] ] )) ago. $iif(%last.spoke. [ $+ [ $2 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $2 ] ],He left without saying anything!)&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:NICK:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick&lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:kick:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick &lt;br /&gt;
   set %seen.last. [ $+ [ $knick ] ] $ctime&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:JOIN:#:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:text:*:#:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %last.spoke. [ $+ [ $nick ] ] $1-&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:quit:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:part:#:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] $address($nick,2) Parting at $fulldate &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
[[Category:Script Archive]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1810</id>
		<title>If-Then-Else</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1810"/>
		<updated>2007-03-15T12:30:51Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The If-then-else statement allows you to compare values and execute different parts of a script based on that comparison.&lt;br /&gt;
&lt;br /&gt;
 if (v1 operator v2) { commands1 }&lt;br /&gt;
 elseif (v1 operator v2) { commands2 }&lt;br /&gt;
 else { commands3 }&lt;br /&gt;
&lt;br /&gt;
If the first statement (line) is [[$true]], commands inside the first brackets are executed. If the first if-statement returns [[$false]], script starts looking for an elseif-statement. An elseif-statement is only triggered if the group&#039;s if-statement returned $false before. And at last, if none of the if or elseif statements were triggered, commands in else-statement are executed.&lt;br /&gt;
&lt;br /&gt;
One if structure/group can consist of one main if-statement, after it there can be 0 .. N elseif-statements. There can be only one else, which can be understood as the default statement, if none one before were triggered. There doesn&#039;t need to be else-statement though.&lt;br /&gt;
&lt;br /&gt;
Every if statement is handled separatly and none of others affect in another.&lt;br /&gt;
&lt;br /&gt;
 if (A) { ... }&lt;br /&gt;
 elseif (B) {&lt;br /&gt;
   if (C) { ... }&lt;br /&gt;
   elseif (D) { ... }&lt;br /&gt;
   elseif (E) { ... }&lt;br /&gt;
   else { F }&lt;br /&gt;
 }&lt;br /&gt;
 elseif (G) { ... }&lt;br /&gt;
 else { H }&lt;br /&gt;
&lt;br /&gt;
If structure would be hierarchical represented it would look something like this&lt;br /&gt;
&lt;br /&gt;
 A               If A is true, execute its commands and return&lt;br /&gt;
 B               If B is true, &lt;br /&gt;
  \&lt;br /&gt;
   C                 check if C, D or E returns true&lt;br /&gt;
   D&lt;br /&gt;
   E&lt;br /&gt;
   F             If none of these got triggered, return F&lt;br /&gt;
 G               G is checked only if A or B were not triggered&lt;br /&gt;
 H               If none of previous matches, H is returned&lt;br /&gt;
&lt;br /&gt;
== The Operators ==&lt;br /&gt;
&lt;br /&gt;
 [[#==|==]]        equal to&lt;br /&gt;
 [[#==|===]]       equal to (case-sensitive)&lt;br /&gt;
 [[#!=|!=]]        not equal to&lt;br /&gt;
 [[#&amp;lt;|&amp;lt;]]         less than&lt;br /&gt;
 [[#&amp;gt;|&amp;gt;]]         larger than&lt;br /&gt;
 [[#&amp;lt;=|&amp;lt;=]]        less than or equal to&lt;br /&gt;
 [[#&amp;gt;=|&amp;gt;=]]        larger than or equal to&lt;br /&gt;
 [[#//|//]]        v2 is a multiple of v1&lt;br /&gt;
 [[#\\|\\]]        v2 is not a multiple of v1&lt;br /&gt;
 [[#&amp;amp;|&amp;amp;]]         bitwise comparison&lt;br /&gt;
 &lt;br /&gt;
 [[#isin|isin]]      string v1 is in string v2&lt;br /&gt;
 [[#isin|isincs]]    string v1 is in string v2 (case sensitive)&lt;br /&gt;
 [[#iswm|iswm]]      wildcard string v1 matches string v2&lt;br /&gt;
 [[#iswm|iswmcs]]    wildcard string v1 matches string v2 (case sensitive)&lt;br /&gt;
 [[#isnum|isnum]]     number v1 is a number in the range v2 which is in the form n1-n2 (v2 optional)&lt;br /&gt;
 [[#isletter|isletter]]  letter v1 is a letter in the list of letters in v2 (v2 optional)&lt;br /&gt;
 &lt;br /&gt;
 [[#isalnum|isalnum]]   text contains only letters and numbers&lt;br /&gt;
 [[#isalpha|isalpha]]   text contains only letters&lt;br /&gt;
 [[#islower|islower]]   text contains only lower case letters&lt;br /&gt;
 [[#isupper|isupper]]   text contains only upper case letters&lt;br /&gt;
 &lt;br /&gt;
 [[#ison|ison]]      if v1 is on channel v2&lt;br /&gt;
 [[#isop|isop]]      if v1 is an op on channel v2&lt;br /&gt;
 [[#ishop|ishop]]     if v1 is a halfop on channel v2&lt;br /&gt;
 [[#isvoice|isvoice]]   if v1 has a voice on channel v2&lt;br /&gt;
 [[#isreg|isreg]]     if v1 is a normal nick on channel v2&lt;br /&gt;
 [[#ischan|ischan]]    if v1 is a channel which you are on.&lt;br /&gt;
 [[#isban|isban]]     if v1 is a banned address in the internal ban list for channel v2&lt;br /&gt;
 &lt;br /&gt;
 [[#isaop|isaop]]     if v1 is a user in your auto-op list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isavoice|isavoice]]  if v1 is a user in your auto-voice list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isignore|isignore]]  if v1 is a user in your ignore list with the ignore switch v2 (v2 optional)&lt;br /&gt;
 [[#isprotect|isprotect]] if v1 is a user in your protect list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isnotify|isnotify]]  if v1 is a user in your notify list.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; To negate an operator you can prefix it with an exclamation mark (!).&lt;br /&gt;
&lt;br /&gt;
=== == ===&lt;br /&gt;
 if (cat == cAt)  ;Returns true since == is case-insensitive.&lt;br /&gt;
 if (cat === cAt) ;Returns false since === is case-sensitive.&lt;br /&gt;
The above checks that v1 (cat) matches v2 (cAt).&lt;br /&gt;
&lt;br /&gt;
=== != ===&lt;br /&gt;
 if (cat != cAt)  ;Returns false since != is case-insensitive and both values v1 and v2 are equal.&lt;br /&gt;
 if (cat !=== cAt) ;Returns true since !=== is case-sensitive and both values v1 and v2 are not equal when case is taken in to consideration.&lt;br /&gt;
The != and !=== operators are the negates of the == and === operators.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt; ===&lt;br /&gt;
 if (6 &amp;lt; 9) ;Returns true because the numerical value 6 is less than 9.&lt;br /&gt;
Checks that v1 (6) has a lower numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt; ===&lt;br /&gt;
 if (6 &amp;gt; 9) ;Returns false because the numerical value 6 is not greater than 9.&lt;br /&gt;
Checks that v1 (6) has a higher numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;= ===&lt;br /&gt;
 if (6 &amp;lt;= 9) ;Returns true because the numerical value 6 is less than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a lower or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt;= ===&lt;br /&gt;
 if (6 &amp;gt;= 9) ;Returns false because the numerical value 6 is not greater than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a greater or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== // ===&lt;br /&gt;
 if (3 // 9) ;Returns true because 3 is a multipul of 9.&lt;br /&gt;
Multipuls of 9 are numbers that when devided in to 9 result in an integer.&lt;br /&gt;
You are not limited to positive numbers.&lt;br /&gt;
&lt;br /&gt;
=== \\ ===&lt;br /&gt;
 if (3 \\ 9) ;Returns false because 3 is a multipul of 9.&lt;br /&gt;
\\ is the negate of //&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp; ===&lt;br /&gt;
 if (13 &amp;amp; 4) ;Returns true because the 4th bit of 13 is [[$biton|turned on]].&lt;br /&gt;
&amp;amp; Is a bitwise comparison and checks thats bit v2 (4) is &#039;turned on&#039; in v1.&lt;br /&gt;
Using &amp;amp; operator is the same as using [[$isbit]].&lt;br /&gt;
&lt;br /&gt;
=== isin ===&lt;br /&gt;
 if (cat isin [[$1-]])&lt;br /&gt;
Matches for &amp;quot;a &#039;&#039;cat&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;cat&#039;&#039;alog&amp;quot;, &amp;quot;impli&#039;&#039;cat&#039;&#039;e &amp;quot; and any string where &amp;quot;cat&amp;quot; &#039;&#039;&#039;is in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== iswm ===&lt;br /&gt;
iswm stands for &#039;&#039;is wildcard match&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Operators:&lt;br /&gt;
 *  0 or more characters&lt;br /&gt;
 ?  1 character&lt;br /&gt;
 &amp;amp;  1 word (atleast 1 or more non-space characters)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (home*away*lost iswm $1-)&lt;br /&gt;
This would match anything starting with home and ending in lost, with away being between home and lost.&lt;br /&gt;
It would match, &amp;quot;homeawaylost&amp;quot;, &amp;quot;home away lost&amp;quot;, &amp;quot;home is missed when you are away or lost&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (ca?* iswm $1-)&lt;br /&gt;
Requires one character after &amp;quot;ca&amp;quot; and allows 0 or more character after it. So it would match for cat, cab, cabin etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (I &amp;amp; you iswm $1-)&lt;br /&gt;
Matches any string that consists of &amp;quot;I + one word + you&amp;quot;.&lt;br /&gt;
Examples would be, &amp;quot;I love you&amp;quot;, &amp;quot;I hate you&amp;quot;, &amp;quot;I moo you&amp;quot;, it would not however match, &amp;quot;I don&#039;t love you&amp;quot; since &amp;quot;don&#039;t love&amp;quot; contains a space.&lt;br /&gt;
&lt;br /&gt;
=== isnum ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isnum)  ;Returns true if $1 is of numeric value&lt;br /&gt;
 if ($1 isnum 10-)  ;Returns true if $1 is number higher than 10&lt;br /&gt;
 if ($1 isnum 20-30)  ;Returns true if $1 is a number between 20 and 30&lt;br /&gt;
&lt;br /&gt;
The examples above checks $1, to see;&lt;br /&gt;
&lt;br /&gt;
Is it a number?&amp;lt;br /&amp;gt;&lt;br /&gt;
Is it a number above 10?&amp;lt;br /&amp;gt;&lt;br /&gt;
Is it a number between 20 and 30?&lt;br /&gt;
&lt;br /&gt;
=== isletter ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isletter)  ;Returns true if &#039;&#039;$1&#039;&#039; is a letter, any letter&lt;br /&gt;
 if ($1 isletter abcdefg)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;abcdefg&#039;&#039;&lt;br /&gt;
 if ($1 isletter HelloWorld)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;HeloWrd&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Note that the checking is case-sensitive, the letter &#039;&#039;h&#039;&#039; will not return true if checked against the string &#039;&#039;HelloWorld&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== isalnum ===&lt;br /&gt;
 if (Dana34 isalnum) ;returns true as &#039;&#039;Dana34&#039;&#039; contains letters and numbers only&lt;br /&gt;
 if (Dana_ isalnum) ;returns false as &#039;&#039;_&#039;&#039; is neither letter nor number&lt;br /&gt;
&lt;br /&gt;
Matches whether the string consists of letters and numbers only.&lt;br /&gt;
&lt;br /&gt;
=== isalpha ===&lt;br /&gt;
 if (Dana isalpha) ; returns true as &#039;&#039;Dana&#039;&#039; consists of letters only&lt;br /&gt;
 if (foo42 isalpha) ; returns false as &#039;&#039;42&#039;&#039; is no letter&lt;br /&gt;
&lt;br /&gt;
Isalpha checks whether the word consists of letters only. It doesn&#039;t matter whether there are upper or lower case.&lt;br /&gt;
&lt;br /&gt;
=== islower ===&lt;br /&gt;
 if (moo islower) ; returns true as all letters in &#039;&#039;moo&#039;&#039; are lower case.&lt;br /&gt;
 if (m0o islower) ; returns true as well as all letters in &#039;&#039;m0o&#039;&#039; are lower case. &lt;br /&gt;
 if (mooO islower) ; retursn false as there is an upper &#039;&#039;O&#039;&#039; in &#039;&#039;mooO&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that islower checks whether all letters in the string are lower case. There can still be numbers or other characters in the string $1.&lt;br /&gt;
&lt;br /&gt;
=== isupper ===&lt;br /&gt;
 if (MOO isupper) ; returns true as &#039;&#039;MOO&#039;&#039; consists of upper case letters only&lt;br /&gt;
 if (1234 isupper) ; returns true as all letters in &#039;&#039;1234&#039;&#039; are upper case, as there are none.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it checks whether all letters in $1 are upper case. There can still be numbers or other characters in $1.&lt;br /&gt;
&lt;br /&gt;
=== ison ===&lt;br /&gt;
 if (Dana ison #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is in the channel #help.script&lt;br /&gt;
 if (foo !ison #help.script) ; returns true as &#039;&#039;foo&#039;&#039; is not in #help.script&lt;br /&gt;
&lt;br /&gt;
This checks whether $1 is in the channel $2.&lt;br /&gt;
&lt;br /&gt;
=== isop ===&lt;br /&gt;
 if (Dana isop #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is an operator in #help.script&lt;br /&gt;
 if (foo isop #help.script) ; returns false as &#039;&#039;foo&#039;&#039; is no operator in #help.script&lt;br /&gt;
&lt;br /&gt;
Checks whether $1 is an operator in $2.&lt;br /&gt;
&lt;br /&gt;
=== ishop ===&lt;br /&gt;
 if (moo ishop #mIRC) ; returns true if &#039;&#039;moo&#039;&#039; is an half operator in #mIRC&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that QuakeNet does not support halfops.&lt;br /&gt;
&lt;br /&gt;
=== isvoice ===&lt;br /&gt;
 if (Dana isvoice #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; has voice in #help.script.&lt;br /&gt;
 if (foobar isvoice #help.script) ; returns false as &#039;&#039;foobar&#039;&#039; has no voice in #help.script.&lt;br /&gt;
This checks if $1 has voice in $2 or not.&lt;br /&gt;
&lt;br /&gt;
=== isreg ===&lt;br /&gt;
 if (Dana isreg #help.script) ; returns false as Dana is no regular user in #help.script.&lt;br /&gt;
 if (foobar isreg #help.script) ; returns true as foobar is a regular user in #help.script.&lt;br /&gt;
This checks whether $1 is a regular user (no voice, no half operator, no operator) in $2.&lt;br /&gt;
&lt;br /&gt;
=== ischan ===&lt;br /&gt;
 if (#help.script ischan) ; returns true as you are in #help.script.&lt;br /&gt;
 if (#foobar ischan) ; returns false as you are no in #foobar.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it returns true only if you are in this channel.&lt;br /&gt;
&lt;br /&gt;
=== isban ===&lt;br /&gt;
 if (idiot!*@* isban #mychan) ; returns $true if &#039;&#039;idiot!*@*&#039;&#039; is in your [[:Category:IBL|Internal Ban List]] for the channel #mychan.&lt;br /&gt;
 if ($ial($me) isban $chan) ; returns $true if you are banned on the current channel.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that isban performs two different checks, depending on whether v1 contains wildcards or not:&lt;br /&gt;
* if v1 contains wildcards, isban will return $true if v1 is an exact ban in the IBL;&lt;br /&gt;
* if v1 does not contain wildcards, isban will return $true if one or more bans match that address.&lt;br /&gt;
&lt;br /&gt;
=== isaop ===&lt;br /&gt;
 if (foobar isaop) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for any channel.&lt;br /&gt;
 if (foobar isaop #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for #help.script.&lt;br /&gt;
To put someone in your autoop-list, take a look at [[Aop|/aop]].&lt;br /&gt;
&lt;br /&gt;
=== isavoice ===&lt;br /&gt;
 if (foobar isavoice) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autovoicelist for any channel.&lt;br /&gt;
 if (foobar isavoice #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is your autovoicelist for #help.script.&lt;br /&gt;
To put someone in your autovoicelist, take a look at [[Avoice|/avoice]].&lt;br /&gt;
&lt;br /&gt;
=== isignore ===&lt;br /&gt;
 if (foobar isignore) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list.&lt;br /&gt;
 if (foobar isignore c) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list with switch -c.&lt;br /&gt;
To get a more in detail explanation of these switches, take a look at [[Ignore|/ignore]].&lt;br /&gt;
&lt;br /&gt;
=== isprotect ===&lt;br /&gt;
 if (foobar isprotect) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list.&lt;br /&gt;
 if (foobar isprotect #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list for #help.script.&lt;br /&gt;
To get more information about protection, see [[Protect|/protect]].&lt;br /&gt;
&lt;br /&gt;
=== isnotify ===&lt;br /&gt;
 if (Dana isnotify) ; returns true if Dana is in your notify list.&lt;br /&gt;
Take a look at [[Notify|/notify]] to add someone to your notifylist. If someone in your notifylist connects (disconnects), the [[On_notify|On notify event]] ([[On_unotify|On Unotify event]]) is triggered.&lt;br /&gt;
&lt;br /&gt;
== Combining comparisons ==&lt;br /&gt;
&lt;br /&gt;
You can combine comparisons by using the &amp;amp;&amp;amp; for AND and || for OR characters.&lt;br /&gt;
&lt;br /&gt;
 [[var]] %c = 5&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c &amp;gt; 0)      ; returns true because %c is both, smaller than 6 and greater than 0&lt;br /&gt;
 if (%c &amp;lt; 6) || (%c isalpha)  ; returns true because %c is lower than 6.&lt;br /&gt;
                              ; note that %c is not alphapetical and returns false, but || matches for 1 .. N true values.&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c isalpha)  ; returns false&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c !isalpha) ; ! negates the operator, this this returns true&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
====&#039;&#039;Not all comparations need two parameters&#039;&#039;====&lt;br /&gt;
 if ($1- isupper)&lt;br /&gt;
returns true, if $1- only contain uppercase letters. So ABCD returns true, but even one lowercase letter makes it return false.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;This article covers only if-then-else &#039;&#039;&#039;string&#039;&#039;&#039; operators&#039;&#039;====&lt;br /&gt;
You &#039;&#039;&#039;can&#039;t&#039;&#039;&#039; use&lt;br /&gt;
 if (foo isin test.txt)&lt;br /&gt;
To check content of text-files. You can use [[$read]] instead to read the content of a text file and then use the return value returned by that $read.&lt;br /&gt;
&lt;br /&gt;
== Also see ==&lt;br /&gt;
* [[$v1] &amp;amp; [[$v1|$v2]] These identifiers allow you to retrieve the values of the last if condition.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1787</id>
		<title>If-Then-Else</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1787"/>
		<updated>2007-03-15T12:29:52Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The If-then-else statement allows you to compare values and execute different parts of a script based on that comparison.&lt;br /&gt;
&lt;br /&gt;
 if (v1 operator v2) { commands1 }&lt;br /&gt;
 elseif (v1 operator v2) { commands2 }&lt;br /&gt;
 else { commands3 }&lt;br /&gt;
&lt;br /&gt;
If the first statement (line) is [[$true]], commands inside the first brackets are executed. If the first if-statement returns [[$false]], script starts looking for an elseif-statement. An elseif-statement is only triggered if the group&#039;s if-statement returned $false before. And at last, if none of the if or elseif statements were triggered, commands in else-statement are executed.&lt;br /&gt;
&lt;br /&gt;
One if structure/group can consist of one main if-statement, after it there can be 0 .. N elseif-statements. There can be only one else, which can be understood as the default statement, if none one before were triggered. There doesn&#039;t need to be else-statement though.&lt;br /&gt;
&lt;br /&gt;
Every if statement is handled separatly and none of others affect in another.&lt;br /&gt;
&lt;br /&gt;
 if (A) { ... }&lt;br /&gt;
 elseif (B) {&lt;br /&gt;
   if (C) { ... }&lt;br /&gt;
   elseif (D) { ... }&lt;br /&gt;
   elseif (E) { ... }&lt;br /&gt;
   else { F }&lt;br /&gt;
 }&lt;br /&gt;
 elseif (G) { ... }&lt;br /&gt;
 else { H }&lt;br /&gt;
&lt;br /&gt;
If structure would be hierarchical represented it would look something like this&lt;br /&gt;
&lt;br /&gt;
 A               If A is true, execute its commands and return&lt;br /&gt;
 B               If B is true, &lt;br /&gt;
  \&lt;br /&gt;
   C                 check if C, D or E returns true&lt;br /&gt;
   D&lt;br /&gt;
   E&lt;br /&gt;
   F             If none of these got triggered, return F&lt;br /&gt;
 G               G is checked only if A or B were not triggered&lt;br /&gt;
 H               If none of previous matches, H is returned&lt;br /&gt;
&lt;br /&gt;
== The Operators ==&lt;br /&gt;
&lt;br /&gt;
 [[#==|==]]        equal to&lt;br /&gt;
 [[#==|===]]       equal to (case-sensitive)&lt;br /&gt;
 [[#!=|!=]]        not equal to&lt;br /&gt;
 [[#&amp;lt;|&amp;lt;]]         less than&lt;br /&gt;
 [[#&amp;gt;|&amp;gt;]]         larger than&lt;br /&gt;
 [[#&amp;lt;=|&amp;lt;=]]        less than or equal to&lt;br /&gt;
 [[#&amp;gt;=|&amp;gt;=]]        larger than or equal to&lt;br /&gt;
 [[#//|//]]        v2 is a multiple of v1&lt;br /&gt;
 [[#\\|\\]]        v2 is not a multiple of v1&lt;br /&gt;
 [[#&amp;amp;|&amp;amp;]]         bitwise comparison&lt;br /&gt;
 &lt;br /&gt;
 [[#isin|isin]]      string v1 is in string v2&lt;br /&gt;
 [[#isin|isincs]]    string v1 is in string v2 (case sensitive)&lt;br /&gt;
 [[#iswm|iswm]]      wildcard string v1 matches string v2&lt;br /&gt;
 [[#iswm|iswmcs]]    wildcard string v1 matches string v2 (case sensitive)&lt;br /&gt;
 [[#isnum|isnum]]     number v1 is a number in the range v2 which is in the form n1-n2 (v2 optional)&lt;br /&gt;
 [[#isletter|isletter]]  letter v1 is a letter in the list of letters in v2 (v2 optional)&lt;br /&gt;
 &lt;br /&gt;
 [[#isalnum|isalnum]]   text contains only letters and numbers&lt;br /&gt;
 [[#isalpha|isalpha]]   text contains only letters&lt;br /&gt;
 [[#islower|islower]]   text contains only lower case letters&lt;br /&gt;
 [[#isupper|isupper]]   text contains only upper case letters&lt;br /&gt;
 &lt;br /&gt;
 [[#ison|ison]]      if v1 is on channel v2&lt;br /&gt;
 [[#isop|isop]]      if v1 is an op on channel v2&lt;br /&gt;
 [[#ishop|ishop]]     if v1 is a halfop on channel v2&lt;br /&gt;
 [[#isvoice|isvoice]]   if v1 has a voice on channel v2&lt;br /&gt;
 [[#isreg|isreg]]     if v1 is a normal nick on channel v2&lt;br /&gt;
 [[#ischan|ischan]]    if v1 is a channel which you are on.&lt;br /&gt;
 [[#isban|isban]]     if v1 is a banned address in the internal ban list for channel v2&lt;br /&gt;
 &lt;br /&gt;
 [[#isaop|isaop]]     if v1 is a user in your auto-op list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isavoice|isavoice]]  if v1 is a user in your auto-voice list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isignore|isignore]]  if v1 is a user in your ignore list with the ignore switch v2 (v2 optional)&lt;br /&gt;
 [[#isprotect|isprotect]] if v1 is a user in your protect list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isnotify|isnotify]]  if v1 is a user in your notify list.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; To negate an operator you can prefix it with an exclamation mark (!).&lt;br /&gt;
&lt;br /&gt;
=== == ===&lt;br /&gt;
 if (cat == cAt)  ;Returns true since == is case-insensitive.&lt;br /&gt;
 if (cat === cAt) ;Returns false since === is case-sensitive.&lt;br /&gt;
The above checks that v1 (cat) matches v2 (cAt).&lt;br /&gt;
&lt;br /&gt;
=== != ===&lt;br /&gt;
 if (cat != cAt)  ;Returns false since != is case-insensitive and both values v1 and v2 are equal.&lt;br /&gt;
 if (cat !=== cAt) ;Returns true since !=== is case-sensitive and both values v1 and v2 are not equal when case is taken in to consideration.&lt;br /&gt;
The != and !=== operators are the negates of the == and === operators.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt; ===&lt;br /&gt;
 if (6 &amp;lt; 9) ;Returns true because the numerical value 6 is less than 9.&lt;br /&gt;
Checks that v1 (6) has a lower numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt; ===&lt;br /&gt;
 if (6 &amp;gt; 9) ;Returns false because the numerical value 6 is not greater than 9.&lt;br /&gt;
Checks that v1 (6) has a higher numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;= ===&lt;br /&gt;
 if (6 &amp;lt;= 9) ;Returns true because the numerical value 6 is less than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a lower or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt;= ===&lt;br /&gt;
 if (6 &amp;gt;= 9) ;Returns false because the numerical value 6 is not greater than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a greater or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== // ===&lt;br /&gt;
 if (3 // 9) ;Returns true because 3 is a multipul of 9.&lt;br /&gt;
Multipuls of 9 are numbers that when devided in to 9 result in an integer.&lt;br /&gt;
You are not limited to positive numbers.&lt;br /&gt;
&lt;br /&gt;
=== \\ ===&lt;br /&gt;
 if (3 \\ 9) ;Returns false because 3 is a multipul of 9.&lt;br /&gt;
\\ is the negate of //&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp; ===&lt;br /&gt;
 if (13 &amp;amp; 4) ;Returns true because the 4th bit of 13 is [[$biton|turned on]].&lt;br /&gt;
&amp;amp; Is a bitwise comparison and checks thats bit v2 (4) is &#039;turned on&#039; in v1.&lt;br /&gt;
Using &amp;amp; operator is the same as using [[$isbit]].&lt;br /&gt;
&lt;br /&gt;
=== isin ===&lt;br /&gt;
 if (cat isin [[$1-]])&lt;br /&gt;
Matches for &amp;quot;a &#039;&#039;cat&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;cat&#039;&#039;alog&amp;quot;, &amp;quot;impli&#039;&#039;cat&#039;&#039;e &amp;quot; and any string where &amp;quot;cat&amp;quot; &#039;&#039;&#039;is in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== iswm ===&lt;br /&gt;
iswm stands for &#039;&#039;is wildcard match&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Operators:&lt;br /&gt;
 *  0 or more characters&lt;br /&gt;
 ?  1 character&lt;br /&gt;
 &amp;amp;  1 word (atleast 1 or more non-space characters)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (home*away*lost iswm $1-)&lt;br /&gt;
This would match anything starting with home and ending in lost, with away being between home and lost.&lt;br /&gt;
It would match, &amp;quot;homeawaylost&amp;quot;, &amp;quot;home away lost&amp;quot;, &amp;quot;home is missed when you are away or lost&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (ca?* iswm $1-)&lt;br /&gt;
Requires one character after &amp;quot;ca&amp;quot; and allows 0 or more character after it. So it would match for cat, cab, cabin etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (I &amp;amp; you iswm $1-)&lt;br /&gt;
Matches any string that consists of &amp;quot;I + one word + you&amp;quot;.&lt;br /&gt;
Examples would be, &amp;quot;I love you&amp;quot;, &amp;quot;I hate you&amp;quot;, &amp;quot;I moo you&amp;quot;, it would not however match, &amp;quot;I don&#039;t love you&amp;quot; since &amp;quot;don&#039;t love&amp;quot; contains a space.&lt;br /&gt;
&lt;br /&gt;
=== isnum ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isnum)  ;Returns true if $1 is of numeric value&lt;br /&gt;
 if ($1 isnum 10-)  ;Returns true if $1 is number higher than 10&lt;br /&gt;
 if ($1 isnum 20-30)  ;Returns true if $1 is a number between 20 and 30&lt;br /&gt;
&lt;br /&gt;
The examples above checks $1, to see;&lt;br /&gt;
&lt;br /&gt;
Is it a number?&lt;br /&gt;
&lt;br /&gt;
Is it a number above 10?&lt;br /&gt;
&lt;br /&gt;
Is it a number between 20 and 30?&lt;br /&gt;
&lt;br /&gt;
=== isletter ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isletter)  ;Returns true if &#039;&#039;$1&#039;&#039; is a letter, any letter&lt;br /&gt;
 if ($1 isletter abcdefg)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;abcdefg&#039;&#039;&lt;br /&gt;
 if ($1 isletter HelloWorld)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;HeloWrd&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Note that the checking is case-sensitive, the letter &#039;&#039;h&#039;&#039; will not return true if checked against the string &#039;&#039;HelloWorld&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== isalnum ===&lt;br /&gt;
 if (Dana34 isalnum) ;returns true as &#039;&#039;Dana34&#039;&#039; contains letters and numbers only&lt;br /&gt;
 if (Dana_ isalnum) ;returns false as &#039;&#039;_&#039;&#039; is neither letter nor number&lt;br /&gt;
&lt;br /&gt;
Matches whether the string consists of letters and numbers only.&lt;br /&gt;
&lt;br /&gt;
=== isalpha ===&lt;br /&gt;
 if (Dana isalpha) ; returns true as &#039;&#039;Dana&#039;&#039; consists of letters only&lt;br /&gt;
 if (foo42 isalpha) ; returns false as &#039;&#039;42&#039;&#039; is no letter&lt;br /&gt;
&lt;br /&gt;
Isalpha checks whether the word consists of letters only. It doesn&#039;t matter whether there are upper or lower case.&lt;br /&gt;
&lt;br /&gt;
=== islower ===&lt;br /&gt;
 if (moo islower) ; returns true as all letters in &#039;&#039;moo&#039;&#039; are lower case.&lt;br /&gt;
 if (m0o islower) ; returns true as well as all letters in &#039;&#039;m0o&#039;&#039; are lower case. &lt;br /&gt;
 if (mooO islower) ; retursn false as there is an upper &#039;&#039;O&#039;&#039; in &#039;&#039;mooO&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that islower checks whether all letters in the string are lower case. There can still be numbers or other characters in the string $1.&lt;br /&gt;
&lt;br /&gt;
=== isupper ===&lt;br /&gt;
 if (MOO isupper) ; returns true as &#039;&#039;MOO&#039;&#039; consists of upper case letters only&lt;br /&gt;
 if (1234 isupper) ; returns true as all letters in &#039;&#039;1234&#039;&#039; are upper case, as there are none.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it checks whether all letters in $1 are upper case. There can still be numbers or other characters in $1.&lt;br /&gt;
&lt;br /&gt;
=== ison ===&lt;br /&gt;
 if (Dana ison #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is in the channel #help.script&lt;br /&gt;
 if (foo !ison #help.script) ; returns true as &#039;&#039;foo&#039;&#039; is not in #help.script&lt;br /&gt;
&lt;br /&gt;
This checks whether $1 is in the channel $2.&lt;br /&gt;
&lt;br /&gt;
=== isop ===&lt;br /&gt;
 if (Dana isop #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is an operator in #help.script&lt;br /&gt;
 if (foo isop #help.script) ; returns false as &#039;&#039;foo&#039;&#039; is no operator in #help.script&lt;br /&gt;
&lt;br /&gt;
Checks whether $1 is an operator in $2.&lt;br /&gt;
&lt;br /&gt;
=== ishop ===&lt;br /&gt;
 if (moo ishop #mIRC) ; returns true if &#039;&#039;moo&#039;&#039; is an half operator in #mIRC&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that QuakeNet does not support halfops.&lt;br /&gt;
&lt;br /&gt;
=== isvoice ===&lt;br /&gt;
 if (Dana isvoice #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; has voice in #help.script.&lt;br /&gt;
 if (foobar isvoice #help.script) ; returns false as &#039;&#039;foobar&#039;&#039; has no voice in #help.script.&lt;br /&gt;
This checks if $1 has voice in $2 or not.&lt;br /&gt;
&lt;br /&gt;
=== isreg ===&lt;br /&gt;
 if (Dana isreg #help.script) ; returns false as Dana is no regular user in #help.script.&lt;br /&gt;
 if (foobar isreg #help.script) ; returns true as foobar is a regular user in #help.script.&lt;br /&gt;
This checks whether $1 is a regular user (no voice, no half operator, no operator) in $2.&lt;br /&gt;
&lt;br /&gt;
=== ischan ===&lt;br /&gt;
 if (#help.script ischan) ; returns true as you are in #help.script.&lt;br /&gt;
 if (#foobar ischan) ; returns false as you are no in #foobar.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it returns true only if you are in this channel.&lt;br /&gt;
&lt;br /&gt;
=== isban ===&lt;br /&gt;
 if (idiot!*@* isban #mychan) ; returns $true if &#039;&#039;idiot!*@*&#039;&#039; is in your [[:Category:IBL|Internal Ban List]] for the channel #mychan.&lt;br /&gt;
 if ($ial($me) isban $chan) ; returns $true if you are banned on the current channel.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that isban performs two different checks, depending on whether v1 contains wildcards or not:&lt;br /&gt;
* if v1 contains wildcards, isban will return $true if v1 is an exact ban in the IBL;&lt;br /&gt;
* if v1 does not contain wildcards, isban will return $true if one or more bans match that address.&lt;br /&gt;
&lt;br /&gt;
=== isaop ===&lt;br /&gt;
 if (foobar isaop) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for any channel.&lt;br /&gt;
 if (foobar isaop #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for #help.script.&lt;br /&gt;
To put someone in your autoop-list, take a look at [[Aop|/aop]].&lt;br /&gt;
&lt;br /&gt;
=== isavoice ===&lt;br /&gt;
 if (foobar isavoice) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autovoicelist for any channel.&lt;br /&gt;
 if (foobar isavoice #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is your autovoicelist for #help.script.&lt;br /&gt;
To put someone in your autovoicelist, take a look at [[Avoice|/avoice]].&lt;br /&gt;
&lt;br /&gt;
=== isignore ===&lt;br /&gt;
 if (foobar isignore) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list.&lt;br /&gt;
 if (foobar isignore c) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list with switch -c.&lt;br /&gt;
To get a more in detail explanation of these switches, take a look at [[Ignore|/ignore]].&lt;br /&gt;
&lt;br /&gt;
=== isprotect ===&lt;br /&gt;
 if (foobar isprotect) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list.&lt;br /&gt;
 if (foobar isprotect #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list for #help.script.&lt;br /&gt;
To get more information about protection, see [[Protect|/protect]].&lt;br /&gt;
&lt;br /&gt;
=== isnotify ===&lt;br /&gt;
 if (Dana isnotify) ; returns true if Dana is in your notify list.&lt;br /&gt;
Take a look at [[Notify|/notify]] to add someone to your notifylist. If someone in your notifylist connects (disconnects), the [[On_notify|On notify event]] ([[On_unotify|On Unotify event]]) is triggered.&lt;br /&gt;
&lt;br /&gt;
== Combining comparisons ==&lt;br /&gt;
&lt;br /&gt;
You can combine comparisons by using the &amp;amp;&amp;amp; for AND and || for OR characters.&lt;br /&gt;
&lt;br /&gt;
 [[var]] %c = 5&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c &amp;gt; 0)      ; returns true because %c is both, smaller than 6 and greater than 0&lt;br /&gt;
 if (%c &amp;lt; 6) || (%c isalpha)  ; returns true because %c is lower than 6.&lt;br /&gt;
                              ; note that %c is not alphapetical and returns false, but || matches for 1 .. N true values.&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c isalpha)  ; returns false&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c !isalpha) ; ! negates the operator, this this returns true&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
====&#039;&#039;Not all comparations need two parameters&#039;&#039;====&lt;br /&gt;
 if ($1- isupper)&lt;br /&gt;
returns true, if $1- only contain uppercase letters. So ABCD returns true, but even one lowercase letter makes it return false.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;This article covers only if-then-else &#039;&#039;&#039;string&#039;&#039;&#039; operators&#039;&#039;====&lt;br /&gt;
You &#039;&#039;&#039;can&#039;t&#039;&#039;&#039; use&lt;br /&gt;
 if (foo isin test.txt)&lt;br /&gt;
To check content of text-files. You can use [[$read]] instead to read the content of a text file and then use the return value returned by that $read.&lt;br /&gt;
&lt;br /&gt;
== Also see ==&lt;br /&gt;
* [[$v1] &amp;amp; [[$v1|$v2]] These identifiers allow you to retrieve the values of the last if condition.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1786</id>
		<title>If-Then-Else</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1786"/>
		<updated>2007-03-15T12:26:45Z</updated>

		<summary type="html">&lt;p&gt;Ollie: see below.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The If-then-else statement allows you to compare values and execute different parts of a script based on that comparison.&lt;br /&gt;
&lt;br /&gt;
 if (v1 operator v2) { commands1 }&lt;br /&gt;
 elseif (v1 operator v2) { commands2 }&lt;br /&gt;
 else { commands3 }&lt;br /&gt;
&lt;br /&gt;
If the first statement (line) is [[$true]], commands inside the first brackets are executed. If the first if-statement returns [[$false]], script starts looking for an elseif-statement. An elseif-statement is only triggered if the group&#039;s if-statement returned $false before. And at last, if none of the if or elseif statements were triggered, commands in else-statement are executed.&lt;br /&gt;
&lt;br /&gt;
One if structure/group can consist of one main if-statement, after it there can be 0 .. N elseif-statements. There can be only one else, which can be understood as the default statement, if none one before were triggered. There doesn&#039;t need to be else-statement though.&lt;br /&gt;
&lt;br /&gt;
Every if statement is handled separatly and none of others affect in another.&lt;br /&gt;
&lt;br /&gt;
 if (A) { ... }&lt;br /&gt;
 elseif (B) {&lt;br /&gt;
   if (C) { ... }&lt;br /&gt;
   elseif (D) { ... }&lt;br /&gt;
   elseif (E) { ... }&lt;br /&gt;
   else { F }&lt;br /&gt;
 }&lt;br /&gt;
 elseif (G) { ... }&lt;br /&gt;
 else { H }&lt;br /&gt;
&lt;br /&gt;
If structure would be hierarchical represented it would look something like this&lt;br /&gt;
&lt;br /&gt;
 A               If A is true, execute its commands and return&lt;br /&gt;
 B               If B is true, &lt;br /&gt;
  \&lt;br /&gt;
   C                 check if C, D or E returns true&lt;br /&gt;
   D&lt;br /&gt;
   E&lt;br /&gt;
   F             If none of these got triggered, return F&lt;br /&gt;
 G               G is checked only if A or B were not triggered&lt;br /&gt;
 H               If none of previous matches, H is returned&lt;br /&gt;
&lt;br /&gt;
== The Operators ==&lt;br /&gt;
&lt;br /&gt;
 [[#==|==]]        equal to&lt;br /&gt;
 [[#==|===]]       equal to (case-sensitive)&lt;br /&gt;
 [[#!=|!=]]        not equal to&lt;br /&gt;
 [[#&amp;lt;|&amp;lt;]]         less than&lt;br /&gt;
 [[#&amp;gt;|&amp;gt;]]         larger than&lt;br /&gt;
 [[#&amp;lt;=|&amp;lt;=]]        less than or equal to&lt;br /&gt;
 [[#&amp;gt;=|&amp;gt;=]]        larger than or equal to&lt;br /&gt;
 [[#//|//]]        v2 is a multiple of v1&lt;br /&gt;
 [[#\\|\\]]        v2 is not a multiple of v1&lt;br /&gt;
 [[#&amp;amp;|&amp;amp;]]         bitwise comparison&lt;br /&gt;
 &lt;br /&gt;
 [[#isin|isin]]      string v1 is in string v2&lt;br /&gt;
 [[#isin|isincs]]    string v1 is in string v2 (case sensitive)&lt;br /&gt;
 [[#iswm|iswm]]      wildcard string v1 matches string v2&lt;br /&gt;
 [[#iswm|iswmcs]]    wildcard string v1 matches string v2 (case sensitive)&lt;br /&gt;
 [[#isnum|isnum]]     number v1 is a number in the range v2 which is in the form n1-n2 (v2 optional)&lt;br /&gt;
 [[#isletter|isletter]]  letter v1 is a letter in the list of letters in v2 (v2 optional)&lt;br /&gt;
 &lt;br /&gt;
 [[#isalnum|isalnum]]   text contains only letters and numbers&lt;br /&gt;
 [[#isalpha|isalpha]]   text contains only letters&lt;br /&gt;
 [[#islower|islower]]   text contains only lower case letters&lt;br /&gt;
 [[#isupper|isupper]]   text contains only upper case letters&lt;br /&gt;
 &lt;br /&gt;
 [[#ison|ison]]      if v1 is on channel v2&lt;br /&gt;
 [[#isop|isop]]      if v1 is an op on channel v2&lt;br /&gt;
 [[#ishop|ishop]]     if v1 is a halfop on channel v2&lt;br /&gt;
 [[#isvoice|isvoice]]   if v1 has a voice on channel v2&lt;br /&gt;
 [[#isreg|isreg]]     if v1 is a normal nick on channel v2&lt;br /&gt;
 [[#ischan|ischan]]    if v1 is a channel which you are on.&lt;br /&gt;
 [[#isban|isban]]     if v1 is a banned address in the internal ban list for channel v2&lt;br /&gt;
 &lt;br /&gt;
 [[#isaop|isaop]]     if v1 is a user in your auto-op list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isavoice|isavoice]]  if v1 is a user in your auto-voice list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isignore|isignore]]  if v1 is a user in your ignore list with the ignore switch v2 (v2 optional)&lt;br /&gt;
 [[#isprotect|isprotect]] if v1 is a user in your protect list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isnotify|isnotify]]  if v1 is a user in your notify list.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; To negate an operator you can prefix it with an exclamation mark (!).&lt;br /&gt;
&lt;br /&gt;
=== == ===&lt;br /&gt;
 if (cat == cAt)  ;Returns true since == is case-insensitive.&lt;br /&gt;
 if (cat === cAt) ;Returns false since === is case-sensitive.&lt;br /&gt;
The above checks that v1 (cat) matches v2 (cAt).&lt;br /&gt;
&lt;br /&gt;
=== != ===&lt;br /&gt;
 if (cat != cAt)  ;Returns false since != is case-insensitive and both values v1 and v2 are equal.&lt;br /&gt;
 if (cat !=== cAt) ;Returns true since !=== is case-sensitive and both values v1 and v2 are not equal when case is taken in to consideration.&lt;br /&gt;
The != and !=== operators are the negates of the == and === operators.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt; ===&lt;br /&gt;
 if (6 &amp;lt; 9) ;Returns true because the numerical value 6 is less than 9.&lt;br /&gt;
Checks that v1 (6) has a lower numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt; ===&lt;br /&gt;
 if (6 &amp;gt; 9) ;Returns false because the numerical value 6 is not greater than 9.&lt;br /&gt;
Checks that v1 (6) has a higher numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;= ===&lt;br /&gt;
 if (6 &amp;lt;= 9) ;Returns true because the numerical value 6 is less than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a lower or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt;= ===&lt;br /&gt;
 if (6 &amp;gt;= 9) ;Returns false because the numerical value 6 is not greater than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a greater or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== // ===&lt;br /&gt;
 if (3 // 9) ;Returns true because 3 is a multipul of 9.&lt;br /&gt;
Multipuls of 9 are numbers that when devided in to 9 result in an integer.&lt;br /&gt;
You are not limited to positive numbers.&lt;br /&gt;
&lt;br /&gt;
=== \\ ===&lt;br /&gt;
 if (3 \\ 9) ;Returns false because 3 is a multipul of 9.&lt;br /&gt;
\\ is the negate of //&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp; ===&lt;br /&gt;
 if (13 &amp;amp; 4) ;Returns true because the 4th bit of 13 is [[$biton|turned on]].&lt;br /&gt;
&amp;amp; Is a bitwise comparison and checks thats bit v2 (4) is &#039;turned on&#039; in v1.&lt;br /&gt;
Using &amp;amp; operator is the same as using [[$isbit]].&lt;br /&gt;
&lt;br /&gt;
=== isin ===&lt;br /&gt;
 if (cat isin [[$1-]])&lt;br /&gt;
Matches for &amp;quot;a &#039;&#039;cat&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;cat&#039;&#039;alog&amp;quot;, &amp;quot;impli&#039;&#039;cat&#039;&#039;e &amp;quot; and any string where &amp;quot;cat&amp;quot; &#039;&#039;&#039;is in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== iswm ===&lt;br /&gt;
iswm stands for &#039;&#039;is wildcard match&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Operators:&lt;br /&gt;
 *  0 or more characters&lt;br /&gt;
 ?  1 character&lt;br /&gt;
 &amp;amp;  1 word (atleast 1 or more non-space characters)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (home*away*lost iswm $1-)&lt;br /&gt;
This would match anything starting with home and ending in lost, with away being between home and lost.&lt;br /&gt;
It would match, &amp;quot;homeawaylost&amp;quot;, &amp;quot;home away lost&amp;quot;, &amp;quot;home is missed when you are away or lost&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (ca?* iswm $1-)&lt;br /&gt;
Requires one character after &amp;quot;ca&amp;quot; and allows 0 or more character after it. So it would match for cat, cab, cabin etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (I &amp;amp; you iswm $1-)&lt;br /&gt;
Matches any string that consists of &amp;quot;I + one word + you&amp;quot;.&lt;br /&gt;
Examples would be, &amp;quot;I love you&amp;quot;, &amp;quot;I hate you&amp;quot;, &amp;quot;I moo you&amp;quot;, it would not however match, &amp;quot;I don&#039;t love you&amp;quot; since &amp;quot;don&#039;t love&amp;quot; contains a space.&lt;br /&gt;
&lt;br /&gt;
=== isnum ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isnum)  ;Returns true if $1 is of numeric value&lt;br /&gt;
 if ($1 isnum 10-)  ;Returns true if $1 is number higher than 10&lt;br /&gt;
 if ($1 isnum 20-30)  ;Returns true if $1 is a number between 20 and 30&lt;br /&gt;
&lt;br /&gt;
The examples above checks $1, to see;&lt;br /&gt;
&lt;br /&gt;
Is it a number?&lt;br /&gt;
Is it a number above 10?&lt;br /&gt;
Is it a number between 20 and 30?&lt;br /&gt;
&lt;br /&gt;
=== isletter ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isletter)  ;Returns true if &#039;&#039;$1&#039;&#039; is a letter, any letter&lt;br /&gt;
 if ($1 isletter abcdefg)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;abcdefg&#039;&#039;&lt;br /&gt;
 if ($1 isletter HelloWorld)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;HeloWrd&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Note that the checking is case-sensitive, the letter &#039;&#039;h&#039;&#039; will not return true if checked against the string &#039;&#039;HelloWorld&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== isalnum ===&lt;br /&gt;
 if (Dana34 isalnum) ;returns true as &#039;&#039;Dana34&#039;&#039; contains letters and numbers only&lt;br /&gt;
 if (Dana_ isalnum) ;returns false as &#039;&#039;_&#039;&#039; is neither letter nor number&lt;br /&gt;
&lt;br /&gt;
Matches whether the string consists of letters and numbers only.&lt;br /&gt;
&lt;br /&gt;
=== isalpha ===&lt;br /&gt;
 if (Dana isalpha) ; returns true as &#039;&#039;Dana&#039;&#039; consists of letters only&lt;br /&gt;
 if (foo42 isalpha) ; returns false as &#039;&#039;42&#039;&#039; is no letter&lt;br /&gt;
&lt;br /&gt;
Isalpha checks whether the word consists of letters only. It doesn&#039;t matter whether there are upper or lower case.&lt;br /&gt;
&lt;br /&gt;
=== islower ===&lt;br /&gt;
 if (moo islower) ; returns true as all letters in &#039;&#039;moo&#039;&#039; are lower case.&lt;br /&gt;
 if (m0o islower) ; returns true as well as all letters in &#039;&#039;m0o&#039;&#039; are lower case. &lt;br /&gt;
 if (mooO islower) ; retursn false as there is an upper &#039;&#039;O&#039;&#039; in &#039;&#039;mooO&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that islower checks whether all letters in the string are lower case. There can still be numbers or other characters in the string $1.&lt;br /&gt;
&lt;br /&gt;
=== isupper ===&lt;br /&gt;
 if (MOO isupper) ; returns true as &#039;&#039;MOO&#039;&#039; consists of upper case letters only&lt;br /&gt;
 if (1234 isupper) ; returns true as all letters in &#039;&#039;1234&#039;&#039; are upper case, as there are none.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it checks whether all letters in $1 are upper case. There can still be numbers or other characters in $1.&lt;br /&gt;
&lt;br /&gt;
=== ison ===&lt;br /&gt;
 if (Dana ison #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is in the channel #help.script&lt;br /&gt;
 if (foo !ison #help.script) ; returns true as &#039;&#039;foo&#039;&#039; is not in #help.script&lt;br /&gt;
&lt;br /&gt;
This checks whether $1 is in the channel $2.&lt;br /&gt;
&lt;br /&gt;
=== isop ===&lt;br /&gt;
 if (Dana isop #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is an operator in #help.script&lt;br /&gt;
 if (foo isop #help.script) ; returns false as &#039;&#039;foo&#039;&#039; is no operator in #help.script&lt;br /&gt;
&lt;br /&gt;
Checks whether $1 is an operator in $2.&lt;br /&gt;
&lt;br /&gt;
=== ishop ===&lt;br /&gt;
 if (moo ishop #mIRC) ; returns true if &#039;&#039;moo&#039;&#039; is an half operator in #mIRC&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that QuakeNet does not support halfops.&lt;br /&gt;
&lt;br /&gt;
=== isvoice ===&lt;br /&gt;
 if (Dana isvoice #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; has voice in #help.script.&lt;br /&gt;
 if (foobar isvoice #help.script) ; returns false as &#039;&#039;foobar&#039;&#039; has no voice in #help.script.&lt;br /&gt;
This checks if $1 has voice in $2 or not.&lt;br /&gt;
&lt;br /&gt;
=== isreg ===&lt;br /&gt;
 if (Dana isreg #help.script) ; returns false as Dana is no regular user in #help.script.&lt;br /&gt;
 if (foobar isreg #help.script) ; returns true as foobar is a regular user in #help.script.&lt;br /&gt;
This checks whether $1 is a regular user (no voice, no half operator, no operator) in $2.&lt;br /&gt;
&lt;br /&gt;
=== ischan ===&lt;br /&gt;
 if (#help.script ischan) ; returns true as you are in #help.script.&lt;br /&gt;
 if (#foobar ischan) ; returns false as you are no in #foobar.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it returns true only if you are in this channel.&lt;br /&gt;
&lt;br /&gt;
=== isban ===&lt;br /&gt;
 if (idiot!*@* isban #mychan) ; returns $true if &#039;&#039;idiot!*@*&#039;&#039; is in your [[:Category:IBL|Internal Ban List]] for the channel #mychan.&lt;br /&gt;
 if ($ial($me) isban $chan) ; returns $true if you are banned on the current channel.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that isban performs two different checks, depending on whether v1 contains wildcards or not:&lt;br /&gt;
* if v1 contains wildcards, isban will return $true if v1 is an exact ban in the IBL;&lt;br /&gt;
* if v1 does not contain wildcards, isban will return $true if one or more bans match that address.&lt;br /&gt;
&lt;br /&gt;
=== isaop ===&lt;br /&gt;
 if (foobar isaop) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for any channel.&lt;br /&gt;
 if (foobar isaop #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for #help.script.&lt;br /&gt;
To put someone in your autoop-list, take a look at [[Aop|/aop]].&lt;br /&gt;
&lt;br /&gt;
=== isavoice ===&lt;br /&gt;
 if (foobar isavoice) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autovoicelist for any channel.&lt;br /&gt;
 if (foobar isavoice #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is your autovoicelist for #help.script.&lt;br /&gt;
To put someone in your autovoicelist, take a look at [[Avoice|/avoice]].&lt;br /&gt;
&lt;br /&gt;
=== isignore ===&lt;br /&gt;
 if (foobar isignore) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list.&lt;br /&gt;
 if (foobar isignore c) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list with switch -c.&lt;br /&gt;
To get a more in detail explanation of these switches, take a look at [[Ignore|/ignore]].&lt;br /&gt;
&lt;br /&gt;
=== isprotect ===&lt;br /&gt;
 if (foobar isprotect) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list.&lt;br /&gt;
 if (foobar isprotect #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list for #help.script.&lt;br /&gt;
To get more information about protection, see [[Protect|/protect]].&lt;br /&gt;
&lt;br /&gt;
=== isnotify ===&lt;br /&gt;
 if (Dana isnotify) ; returns true if Dana is in your notify list.&lt;br /&gt;
Take a look at [[Notify|/notify]] to add someone to your notifylist. If someone in your notifylist connects (disconnects), the [[On_notify|On notify event]] ([[On_unotify|On Unotify event]]) is triggered.&lt;br /&gt;
&lt;br /&gt;
== Combining comparisons ==&lt;br /&gt;
&lt;br /&gt;
You can combine comparisons by using the &amp;amp;&amp;amp; for AND and || for OR characters.&lt;br /&gt;
&lt;br /&gt;
 [[var]] %c = 5&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c &amp;gt; 0)      ; returns true because %c is both, smaller than 6 and greater than 0&lt;br /&gt;
 if (%c &amp;lt; 6) || (%c isalpha)  ; returns true because %c is lower than 6.&lt;br /&gt;
                              ; note that %c is not alphapetical and returns false, but || matches for 1 .. N true values.&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c isalpha)  ; returns false&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c !isalpha) ; ! negates the operator, this this returns true&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
====&#039;&#039;Not all comparations need two parameters&#039;&#039;====&lt;br /&gt;
 if ($1- isupper)&lt;br /&gt;
returns true, if $1- only contain uppercase letters. So ABCD returns true, but even one lowercase letter makes it return false.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;This article covers only if-then-else &#039;&#039;&#039;string&#039;&#039;&#039; operators&#039;&#039;====&lt;br /&gt;
You &#039;&#039;&#039;can&#039;t&#039;&#039;&#039; use&lt;br /&gt;
 if (foo isin test.txt)&lt;br /&gt;
To check content of text-files. You can use [[$read]] instead to read the content of a text file and then use the return value returned by that $read.&lt;br /&gt;
&lt;br /&gt;
== Also see ==&lt;br /&gt;
* [[$v1] &amp;amp; [[$v1|$v2]] These identifiers allow you to retrieve the values of the last if condition.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1785</id>
		<title>If-Then-Else</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1785"/>
		<updated>2007-03-14T16:51:20Z</updated>

		<summary type="html">&lt;p&gt;Ollie: grammatical changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The If-then-else statement allows you to compare values and execute different parts of a script based on that comparison.&lt;br /&gt;
&lt;br /&gt;
 if (v1 operator v2) { commands1 }&lt;br /&gt;
 elseif (v1 operator v2) { commands2 }&lt;br /&gt;
 else { commands3 }&lt;br /&gt;
&lt;br /&gt;
If the first statement (line) is [[$true]], commands inside the first brackets are executed. If the first if-statement returns [[$false]], script starts looking for an elseif-statement. An elseif-statement is only triggered if the group&#039;s if-statement returned $false before. And at last, if none of the if or elseif statements were triggered, commands in else-statement are executed.&lt;br /&gt;
&lt;br /&gt;
One if structure/group can consist of one main if-statement, after it there can be 0 .. N elseif-statements. There can be only one else, which can be understood as the default statement, if none one before were triggered. There doesn&#039;t need to be else-statement though.&lt;br /&gt;
&lt;br /&gt;
Every if statement is handled separatly and none of others affect in another.&lt;br /&gt;
&lt;br /&gt;
 if (A) { ... }&lt;br /&gt;
 elseif (B) {&lt;br /&gt;
   if (C) { ... }&lt;br /&gt;
   elseif (D) { ... }&lt;br /&gt;
   elseif (E) { ... }&lt;br /&gt;
   else { F }&lt;br /&gt;
 }&lt;br /&gt;
 elseif (G) { ... }&lt;br /&gt;
 else { H }&lt;br /&gt;
&lt;br /&gt;
If structure would be hierarchical represented it would look something like this&lt;br /&gt;
&lt;br /&gt;
 A               If A is true, execute its commands and return&lt;br /&gt;
 B               If B is true, &lt;br /&gt;
  \&lt;br /&gt;
   C                 check if C, D or E returns true&lt;br /&gt;
   D&lt;br /&gt;
   E&lt;br /&gt;
   F             If none of these got triggered, return F&lt;br /&gt;
 G               G is checked only if A or B were not triggered&lt;br /&gt;
 H               If none of previous matches, H is returned&lt;br /&gt;
&lt;br /&gt;
== The Operators ==&lt;br /&gt;
&lt;br /&gt;
 [[#==|==]]        equal to&lt;br /&gt;
 [[#==|===]]       equal to (case-sensitive)&lt;br /&gt;
 [[#!=|!=]]        not equal to&lt;br /&gt;
 [[#&amp;lt;|&amp;lt;]]         less than&lt;br /&gt;
 [[#&amp;gt;|&amp;gt;]]         larger than&lt;br /&gt;
 [[#&amp;lt;=|&amp;lt;=]]        less than or equal to&lt;br /&gt;
 [[#&amp;gt;=|&amp;gt;=]]        larger than or equal to&lt;br /&gt;
 [[#//|//]]        v2 is a multiple of v1&lt;br /&gt;
 [[#\\|\\]]        v2 is not a multiple of v1&lt;br /&gt;
 [[#&amp;amp;|&amp;amp;]]         bitwise comparison&lt;br /&gt;
 &lt;br /&gt;
 [[#isin|isin]]      string v1 is in string v2&lt;br /&gt;
 [[#isin|isincs]]    string v1 is in string v2 (case sensitive)&lt;br /&gt;
 [[#iswm|iswm]]      wildcard string v1 matches string v2&lt;br /&gt;
 [[#iswm|iswmcs]]    wildcard string v1 matches string v2 (case sensitive)&lt;br /&gt;
 [[#isnum|isnum]]     number v1 is a number in the range v2 which is in the form n1-n2 (v2 optional)&lt;br /&gt;
 [[#isletter|isletter]]  letter v1 is a letter in the list of letters in v2 (v2 optional)&lt;br /&gt;
 &lt;br /&gt;
 [[#isalnum|isalnum]]   text contains only letters and numbers&lt;br /&gt;
 [[#isalpha|isalpha]]   text contains only letters&lt;br /&gt;
 [[#islower|islower]]   text contains only lower case letters&lt;br /&gt;
 [[#isupper|isupper]]   text contains only upper case letters&lt;br /&gt;
 &lt;br /&gt;
 [[#ison|ison]]      if v1 is on channel v2&lt;br /&gt;
 [[#isop|isop]]      if v1 is an op on channel v2&lt;br /&gt;
 [[#ishop|ishop]]     if v1 is a halfop on channel v2&lt;br /&gt;
 [[#isvoice|isvoice]]   if v1 has a voice on channel v2&lt;br /&gt;
 [[#isreg|isreg]]     if v1 is a normal nick on channel v2&lt;br /&gt;
 [[#ischan|ischan]]    if v1 is a channel which you are on.&lt;br /&gt;
 [[#isban|isban]]     if v1 is a banned address in the internal ban list for channel v2&lt;br /&gt;
 &lt;br /&gt;
 [[#isaop|isaop]]     if v1 is a user in your auto-op list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isavoice|isavoice]]  if v1 is a user in your auto-voice list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isignore|isignore]]  if v1 is a user in your ignore list with the ignore switch v2 (v2 optional)&lt;br /&gt;
 [[#isprotect|isprotect]] if v1 is a user in your protect list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isnotify|isnotify]]  if v1 is a user in your notify list.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; To negate an operator you can prefix it with an exclamation mark (!).&lt;br /&gt;
&lt;br /&gt;
=== == ===&lt;br /&gt;
 if (cat == cAt)  ;Returns true since == is case-insensitive.&lt;br /&gt;
 if (cat === cAt) ;Returns false since === is case-sensitive.&lt;br /&gt;
The above checks that v1 (cat) matches v2 (cAt).&lt;br /&gt;
&lt;br /&gt;
=== != ===&lt;br /&gt;
 if (cat != cAt)  ;Returns false since != is case-insensitive and both values v1 and v2 are equal.&lt;br /&gt;
 if (cat !=== cAt) ;Returns true since !=== is case-sensitive and both values v1 and v2 are not equal when case is taken in to consideration.&lt;br /&gt;
The != and !=== operators are the negates of the == and === operators.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt; ===&lt;br /&gt;
 if (6 &amp;lt; 9) ;Returns true because the numerical value 6 is less than 9.&lt;br /&gt;
Checks that v1 (6) has a lower numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt; ===&lt;br /&gt;
 if (6 &amp;gt; 9) ;Returns false because the numerical value 6 is not greater than 9.&lt;br /&gt;
Checks that v1 (6) has a higher numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;= ===&lt;br /&gt;
 if (6 &amp;lt;= 9) ;Returns true because the numerical value 6 is less than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a lower or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt;= ===&lt;br /&gt;
 if (6 &amp;gt;= 9) ;Returns false because the numerical value 6 is not greater than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a greater or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== // ===&lt;br /&gt;
 if (3 // 9) ;Returns true because 3 is a multipul of 9.&lt;br /&gt;
Multipuls of 9 are numbers that when devided in to 9 result in an integer.&lt;br /&gt;
You are not limited to positive numbers.&lt;br /&gt;
&lt;br /&gt;
=== \\ ===&lt;br /&gt;
 if (3 \\ 9) ;Returns false because 3 is a multipul of 9.&lt;br /&gt;
\\ is the negate of //&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp; ===&lt;br /&gt;
 if (13 &amp;amp; 4) ;Returns true because the 4th bit of 13 is [[$biton|turned on]].&lt;br /&gt;
&amp;amp; Is a bitwise comparison and checks thats bit v2 (4) is &#039;turned on&#039; in v1.&lt;br /&gt;
Using &amp;amp; operator is the same as using [[$isbit]].&lt;br /&gt;
&lt;br /&gt;
=== isin ===&lt;br /&gt;
 if (cat isin [[$1-]])&lt;br /&gt;
Matches for &amp;quot;a &#039;&#039;cat&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;cat&#039;&#039;alog&amp;quot;, &amp;quot;impli&#039;&#039;cat&#039;&#039;e &amp;quot; and any string where &amp;quot;cat&amp;quot; &#039;&#039;&#039;is in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== iswm ===&lt;br /&gt;
iswm stands for &#039;&#039;is wildcard match&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Operators:&lt;br /&gt;
 *  0 or more characters&lt;br /&gt;
 ?  1 character&lt;br /&gt;
 &amp;amp;  1 word (atleast 1 or more non-space characters)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (home*away*lost iswm $1-)&lt;br /&gt;
This would match anything starting with home and ending in lost, with away being between home and lost.&lt;br /&gt;
It would match, &amp;quot;homeawaylost&amp;quot;, &amp;quot;home away lost&amp;quot;, &amp;quot;home is missed when you are away or lost&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (ca?* iswm $1-)&lt;br /&gt;
Requires one character after &amp;quot;ca&amp;quot; and allows 0 or more character after it. So it would match for cat, cab, cabin etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (I &amp;amp; you iswm $1-)&lt;br /&gt;
Matches any string that consists of &amp;quot;I + one word + you&amp;quot;.&lt;br /&gt;
Examples would be, &amp;quot;I love you&amp;quot;, &amp;quot;I hate you&amp;quot;, &amp;quot;I moo you&amp;quot;, it would not however match, &amp;quot;I don&#039;t love you&amp;quot; since &amp;quot;don&#039;t love&amp;quot; contains a space.&lt;br /&gt;
&lt;br /&gt;
=== isnum ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isnum)  ;Returns true if $1 is of numeric value&lt;br /&gt;
 if ($1 isnum 10-)  ;Returns true if $1 is number higher than 10&lt;br /&gt;
 if ($1 isnum 20-30)  ;Returns true if $1 is a number between 20 and 30&lt;br /&gt;
&lt;br /&gt;
The examples above checks $1 if, is it a number?, is it a number above 10?, is it a number between 20 and 30?&lt;br /&gt;
&lt;br /&gt;
=== isletter ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isletter)  ;Returns true if &#039;&#039;$1&#039;&#039; is a letter, any letter&lt;br /&gt;
 if ($1 isletter abcdefg)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;abcdefg&#039;&#039;&lt;br /&gt;
 if ($1 isletter HelloWorld)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;HeloWrd&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Note that the checking is case-sensitive, the letter &#039;&#039;h&#039;&#039; will not return true if checked against the string &#039;&#039;HelloWorld&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== isalnum ===&lt;br /&gt;
 if (Dana34 isalnum) ;returns true as &#039;&#039;Dana34&#039;&#039; contains letters and numbers only&lt;br /&gt;
 if (Dana_ isalnum) ;returns false as &#039;&#039;_&#039;&#039; is neither letter nor number&lt;br /&gt;
&lt;br /&gt;
Matches whether the string consists of letters and numbers only.&lt;br /&gt;
&lt;br /&gt;
=== isalpha ===&lt;br /&gt;
 if (Dana isalpha) ; returns true as &#039;&#039;Dana&#039;&#039; consists of letters only&lt;br /&gt;
 if (foo42 isalpha) ; returns false as &#039;&#039;42&#039;&#039; is no letter&lt;br /&gt;
&lt;br /&gt;
Isalpha checks whether the word consists of letters only. It doesn&#039;t matter whether there are upper or lower case.&lt;br /&gt;
&lt;br /&gt;
=== islower ===&lt;br /&gt;
 if (moo islower) ; returns true as all letters in &#039;&#039;moo&#039;&#039; are lower case.&lt;br /&gt;
 if (m0o islower) ; returns true as well as all letters in &#039;&#039;m0o&#039;&#039; are lower case. &lt;br /&gt;
 if (mooO islower) ; retursn false as there is an upper &#039;&#039;O&#039;&#039; in &#039;&#039;mooO&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that islower checks whether all letters in the string are lower case. There can still be numbers or other characters in the string $1.&lt;br /&gt;
&lt;br /&gt;
=== isupper ===&lt;br /&gt;
 if (MOO isupper) ; returns true as &#039;&#039;MOO&#039;&#039; consists of upper case letters only&lt;br /&gt;
 if (1234 isupper) ; returns true as all letters in &#039;&#039;1234&#039;&#039; are upper case, as there are none.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it checks whether all letters in $1 are upper case. There can still be numbers or other characters in $1.&lt;br /&gt;
&lt;br /&gt;
=== ison ===&lt;br /&gt;
 if (Dana ison #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is in the channel #help.script&lt;br /&gt;
 if (foo !ison #help.script) ; returns true as &#039;&#039;foo&#039;&#039; is not in #help.script&lt;br /&gt;
&lt;br /&gt;
This checks whether $1 is in the channel $2.&lt;br /&gt;
&lt;br /&gt;
=== isop ===&lt;br /&gt;
 if (Dana isop #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is an operator in #help.script&lt;br /&gt;
 if (foo isop #help.script) ; returns false as &#039;&#039;foo&#039;&#039; is no operator in #help.script&lt;br /&gt;
&lt;br /&gt;
Checks whether $1 is an operator in $2.&lt;br /&gt;
&lt;br /&gt;
=== ishop ===&lt;br /&gt;
 if (moo ishop #mIRC) ; returns true if &#039;&#039;moo&#039;&#039; is an half operator in #mIRC&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that QuakeNet does not support halfops.&lt;br /&gt;
&lt;br /&gt;
=== isvoice ===&lt;br /&gt;
 if (Dana isvoice #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; has voice in #help.script.&lt;br /&gt;
 if (foobar isvoice #help.script) ; returns false as &#039;&#039;foobar&#039;&#039; has no voice in #help.script.&lt;br /&gt;
This checks if $1 has voice in $2 or not.&lt;br /&gt;
&lt;br /&gt;
=== isreg ===&lt;br /&gt;
 if (Dana isreg #help.script) ; returns false as Dana is no regular user in #help.script.&lt;br /&gt;
 if (foobar isreg #help.script) ; returns true as foobar is a regular user in #help.script.&lt;br /&gt;
This checks whether $1 is a regular user (no voice, no half operator, no operator) in $2.&lt;br /&gt;
&lt;br /&gt;
=== ischan ===&lt;br /&gt;
 if (#help.script ischan) ; returns true as you are in #help.script.&lt;br /&gt;
 if (#foobar ischan) ; returns false as you are no in #foobar.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it returns true only if you are in this channel.&lt;br /&gt;
&lt;br /&gt;
=== isban ===&lt;br /&gt;
 if (idiot!*@* isban #mychan) ; returns $true if &#039;&#039;idiot!*@*&#039;&#039; is in your [[:Category:IBL|Internal Ban List]] for the channel #mychan.&lt;br /&gt;
 if ($ial($me) isban $chan) ; returns $true if you are banned on the current channel.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that isban performs two different checks, depending on whether v1 contains wildcards or not:&lt;br /&gt;
* if v1 contains wildcards, isban will return $true if v1 is an exact ban in the IBL;&lt;br /&gt;
* if v1 does not contain wildcards, isban will return $true if one or more bans match that address.&lt;br /&gt;
&lt;br /&gt;
=== isaop ===&lt;br /&gt;
 if (foobar isaop) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for any channel.&lt;br /&gt;
 if (foobar isaop #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for #help.script.&lt;br /&gt;
To put someone in your autoop-list, take a look at [[Aop|/aop]].&lt;br /&gt;
&lt;br /&gt;
=== isavoice ===&lt;br /&gt;
 if (foobar isavoice) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autovoicelist for any channel.&lt;br /&gt;
 if (foobar isavoice #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is your autovoicelist for #help.script.&lt;br /&gt;
To put someone in your autovoicelist, take a look at [[Avoice|/avoice]].&lt;br /&gt;
&lt;br /&gt;
=== isignore ===&lt;br /&gt;
 if (foobar isignore) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list.&lt;br /&gt;
 if (foobar isignore c) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list with switch -c.&lt;br /&gt;
To get a more in detail explanation of these switches, take a look at [[Ignore|/ignore]].&lt;br /&gt;
&lt;br /&gt;
=== isprotect ===&lt;br /&gt;
 if (foobar isprotect) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list.&lt;br /&gt;
 if (foobar isprotect #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list for #help.script.&lt;br /&gt;
To get more information about protection, see [[Protect|/protect]].&lt;br /&gt;
&lt;br /&gt;
=== isnotify ===&lt;br /&gt;
 if (Dana isnotify) ; returns true if Dana is in your notify list.&lt;br /&gt;
Take a look at [[Notify|/notify]] to add someone to your notifylist. If someone in your notifylist connects (disconnects), the [[On_notify|On notify event]] ([[On_unotify|On Unotify event]]) is triggered.&lt;br /&gt;
&lt;br /&gt;
== Combining comparisons ==&lt;br /&gt;
&lt;br /&gt;
You can combine comparisons by using the &amp;amp;&amp;amp; for AND and || for OR characters.&lt;br /&gt;
&lt;br /&gt;
 [[var]] %c = 5&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c &amp;gt; 0)      ; returns true because %c is both, smaller than 6 and greater than 0&lt;br /&gt;
 if (%c &amp;lt; 6) || (%c isalpha)  ; returns true because %c is lower than 6.&lt;br /&gt;
                              ; note that %c is not alphapetical and returns false, but || matches for 1 .. N true values.&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c isalpha)  ; returns false&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c !isalpha) ; ! negates the operator, this this returns true&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
====&#039;&#039;Not all comparations need two parameters&#039;&#039;====&lt;br /&gt;
 if ($1- isupper)&lt;br /&gt;
returns true, if $1- only contain uppercase letters. So ABCD returns true, but even one lowercase letter makes it return false.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;This article covers only if-then-else &#039;&#039;&#039;string&#039;&#039;&#039; operators&#039;&#039;====&lt;br /&gt;
You &#039;&#039;&#039;can&#039;t&#039;&#039;&#039; use&lt;br /&gt;
 if (foo isin test.txt)&lt;br /&gt;
To check content of text-files. You can use [[$read]] instead to read the content of a text file and then use the return value returned by that $read.&lt;br /&gt;
&lt;br /&gt;
== Also see ==&lt;br /&gt;
* [[$v1] &amp;amp; [[$v1|$v2]] These identifiers allow you to retrieve the values of the last if condition.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1784</id>
		<title>If-Then-Else</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=1784"/>
		<updated>2007-03-14T16:46:18Z</updated>

		<summary type="html">&lt;p&gt;Ollie: Minor grammatical and consistency corrections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
The If-then-else statement allows you to compare values and execute different parts of a script based on that comparison.&lt;br /&gt;
&lt;br /&gt;
 if (v1 operator v2) { commands1 }&lt;br /&gt;
 elseif (v1 operator v2) { commands2 }&lt;br /&gt;
 else { commands3 }&lt;br /&gt;
&lt;br /&gt;
If the first statement (line) is [[$true]], commands inside the first brackets are executed. If the first if-statement returns [[$false]], script starts looking for an elseif-statement. An elseif-statement is only triggered if the group&#039;s if-statement returned $false before. And at last, if none of the if or elseif statements were triggered, commands in else-statement are executed.&lt;br /&gt;
&lt;br /&gt;
One if structure/group can consist of one main if-statement, after it there can be 0 .. N elseif-statements. There can be only one else, which can be understood as the default statement, if none one before were triggered. There doesn&#039;t need to be else-statement though.&lt;br /&gt;
&lt;br /&gt;
Every if statement is handled separatly and none of others affect in another.&lt;br /&gt;
&lt;br /&gt;
 if (A) { ... }&lt;br /&gt;
 elseif (B) {&lt;br /&gt;
   if (C) { ... }&lt;br /&gt;
   elseif (D) { ... }&lt;br /&gt;
   elseif (E) { ... }&lt;br /&gt;
   else { F }&lt;br /&gt;
 }&lt;br /&gt;
 elseif (G) { ... }&lt;br /&gt;
 else { H }&lt;br /&gt;
&lt;br /&gt;
If structure would be hierarchical represented it would look something like this&lt;br /&gt;
&lt;br /&gt;
 A               If A is true, execute its commands and return&lt;br /&gt;
 B               If B is true, &lt;br /&gt;
  \&lt;br /&gt;
   C                 check if C, D or E returns true&lt;br /&gt;
   D&lt;br /&gt;
   E&lt;br /&gt;
   F             If none of these got triggered, return F&lt;br /&gt;
 G               G is checked only if A or B were not triggered&lt;br /&gt;
 H               If none of previous matches, H is returned&lt;br /&gt;
&lt;br /&gt;
== The Operators ==&lt;br /&gt;
&lt;br /&gt;
 [[#==|==]]        equal to&lt;br /&gt;
 [[#==|===]]       equal to (case-sensitive)&lt;br /&gt;
 [[#!=|!=]]        not equal to&lt;br /&gt;
 [[#&amp;lt;|&amp;lt;]]         less than&lt;br /&gt;
 [[#&amp;gt;|&amp;gt;]]         larger than&lt;br /&gt;
 [[#&amp;lt;=|&amp;lt;=]]        less than or equal to&lt;br /&gt;
 [[#&amp;gt;=|&amp;gt;=]]        larger than or equal to&lt;br /&gt;
 [[#//|//]]        v2 is a multiple of v1&lt;br /&gt;
 [[#\\|\\]]        v2 is not a multiple of v1&lt;br /&gt;
 [[#&amp;amp;|&amp;amp;]]         bitwise comparison&lt;br /&gt;
 &lt;br /&gt;
 [[#isin|isin]]      string v1 is in string v2&lt;br /&gt;
 [[#isin|isincs]]    string v1 is in string v2 (case sensitive)&lt;br /&gt;
 [[#iswm|iswm]]      wildcard string v1 matches string v2&lt;br /&gt;
 [[#iswm|iswmcs]]    wildcard string v1 matches string v2 (case sensitive)&lt;br /&gt;
 [[#isnum|isnum]]     number v1 is a number in the range v2 which is in the form n1-n2 (v2 optional)&lt;br /&gt;
 [[#isletter|isletter]]  letter v1 is a letter in the list of letters in v2 (v2 optional)&lt;br /&gt;
 &lt;br /&gt;
 [[#isalnum|isalnum]]   text contains only letters and numbers&lt;br /&gt;
 [[#isalpha|isalpha]]   text contains only letters&lt;br /&gt;
 [[#islower|islower]]   text contains only lower case letters&lt;br /&gt;
 [[#isupper|isupper]]   text contains only upper case letters&lt;br /&gt;
 &lt;br /&gt;
 [[#ison|ison]]      if v1 is on channel v2&lt;br /&gt;
 [[#isop|isop]]      if v1 is an op on channel v2&lt;br /&gt;
 [[#ishop|ishop]]     if v1 is a halfop on channel v2&lt;br /&gt;
 [[#isvoice|isvoice]]   if v1 has a voice on channel v2&lt;br /&gt;
 [[#isreg|isreg]]     if v1 is a normal nick on channel v2&lt;br /&gt;
 [[#ischan|ischan]]    if v1 is a channel which you are on.&lt;br /&gt;
 [[#isban|isban]]     if v1 is a banned address in the internal ban list for channel v2&lt;br /&gt;
 &lt;br /&gt;
 [[#isaop|isaop]]     if v1 is a user in your auto-op list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isavoice|isavoice]]  if v1 is a user in your auto-voice list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isignore|isignore]]  if v1 is a user in your ignore list with the ignore switch v2 (v2 optional)&lt;br /&gt;
 [[#isprotect|isprotect]] if v1 is a user in your protect list for channel v2 (v2 optional)&lt;br /&gt;
 [[#isnotify|isnotify]]  if v1 is a user in your notify list.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; To negate an operator you can prefix it with an exclamation mark (!).&lt;br /&gt;
&lt;br /&gt;
=== == ===&lt;br /&gt;
 if (cat == cAt)  ;Returns true since == is case-insensitive.&lt;br /&gt;
 if (cat === cAt) ;Returns false since === is case-sensitive.&lt;br /&gt;
The above checks that v1 (cat) matches v2 (cAt).&lt;br /&gt;
&lt;br /&gt;
=== != ===&lt;br /&gt;
 if (cat != cAt)  ;Returns false since != is case-insensitive and both values v1 and v2 are equal.&lt;br /&gt;
 if (cat !=== cAt) ;Returns true since !=== is case-sensitive and both values v1 and v2 are not equal when case is taken in to consideration.&lt;br /&gt;
The != and !=== operators are the negates of the == and === operators.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt; ===&lt;br /&gt;
 if (6 &amp;lt; 9) ;Returns true because the numerical value 6 is less than 9.&lt;br /&gt;
Checks that v1 (6) has a lower numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt; ===&lt;br /&gt;
 if (6 &amp;gt; 9) ;Returns false because the numerical value 6 is not greater than 9.&lt;br /&gt;
Checks that v1 (6) has a higher numerical value than v2 (9)&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;= ===&lt;br /&gt;
 if (6 &amp;lt;= 9) ;Returns true because the numerical value 6 is less than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a lower or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== &amp;gt;= ===&lt;br /&gt;
 if (6 &amp;gt;= 9) ;Returns false because the numerical value 6 is not greater than or equal to 9.&lt;br /&gt;
Checks that v1 (6) has a greater or equal numerical value than v2 (9).&lt;br /&gt;
&lt;br /&gt;
=== // ===&lt;br /&gt;
 if (3 // 9) ;Returns true because 3 is a multipul of 9.&lt;br /&gt;
Multipuls of 9 are numbers that when devided in to 9 result in an integer.&lt;br /&gt;
You are not limited to positive numbers.&lt;br /&gt;
&lt;br /&gt;
=== \\ ===&lt;br /&gt;
 if (3 \\ 9) ;Returns false because 3 is a multipul of 9.&lt;br /&gt;
\\ is the negate of //&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp; ===&lt;br /&gt;
 if (13 &amp;amp; 4) ;Returns true because the 4th bit of 13 is [[$biton|turned on]].&lt;br /&gt;
&amp;amp; Is a bitwise comparison and checks thats bit v2 (4) is &#039;turned on&#039; in v1.&lt;br /&gt;
Using &amp;amp; operator is the same as using [[$isbit]].&lt;br /&gt;
&lt;br /&gt;
=== isin ===&lt;br /&gt;
 if (cat isin [[$1-]])&lt;br /&gt;
Matches for &amp;quot;a &#039;&#039;cat&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;cat&#039;&#039;alog&amp;quot;, &amp;quot;impli&#039;&#039;cat&#039;&#039;e &amp;quot; and any string where &amp;quot;cat&amp;quot; &#039;&#039;&#039;is in&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== iswm ===&lt;br /&gt;
iswm stands for &#039;&#039;is wildcard match&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Operators:&lt;br /&gt;
 *  0 or more characters&lt;br /&gt;
 ?  1 character&lt;br /&gt;
 &amp;amp;  1 word (atleast 1 or more non-space characters)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (home*away*lost iswm $1-)&lt;br /&gt;
This would match anything starting with home and ending in lost, with away being between home and lost.&lt;br /&gt;
It would match, &amp;quot;homeawaylost&amp;quot;, &amp;quot;home away lost&amp;quot;, &amp;quot;home is missed when you are away or lost&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (ca?* iswm $1-)&lt;br /&gt;
Requires one character after &amp;quot;ca&amp;quot; and allows 0 or more character after it. So it would match for cat, cab, cabin etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 if (I &amp;amp; you iswm $1-)&lt;br /&gt;
Matches any string that consists of &amp;quot;I + one word + you&amp;quot;.&lt;br /&gt;
Examples would be, &amp;quot;I love you&amp;quot;, &amp;quot;I hate you&amp;quot;, &amp;quot;I moo you&amp;quot;, it would not however match, &amp;quot;I don&#039;t love you&amp;quot; since &amp;quot;don&#039;t love&amp;quot; contains a space.&lt;br /&gt;
&lt;br /&gt;
=== isnum ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isnum)  ;Returns true if $1 is of numeric value&lt;br /&gt;
 if ($1 isnum 10-)  ;Returns true if $1 is number higher than 10&lt;br /&gt;
 if ($1 isnum 20-30)  ;Returns true if $1 is a number between 20 and 30&lt;br /&gt;
&lt;br /&gt;
The Examples above checks $1 if, is it a number?, is it a number above 10?, is it a number between 20 and 30?&lt;br /&gt;
&lt;br /&gt;
=== isletter ===&lt;br /&gt;
&lt;br /&gt;
 if ($1 isletter)  ;Returns true if &#039;&#039;$1&#039;&#039; is a letter, any letter&lt;br /&gt;
 if ($1 isletter abcdefg)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;abcdefg&#039;&#039;&lt;br /&gt;
 if ($1 isletter HelloWorld)  ;Returns true if &#039;&#039;$1&#039;&#039; is in the string of letters &#039;&#039;HeloWrd&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Note that the checking is case-sensitive, the letter &#039;&#039;h&#039;&#039; will not return true if checked against the string &#039;&#039;HelloWorld&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== isalnum ===&lt;br /&gt;
 if (Dana34 isalnum) ;returns true as &#039;&#039;Dana34&#039;&#039; contains letters and numbers only&lt;br /&gt;
 if (Dana_ isalnum) ;returns false as &#039;&#039;_&#039;&#039; is neither letter nor number&lt;br /&gt;
&lt;br /&gt;
Matches whether the string consists of letters and numbers only.&lt;br /&gt;
&lt;br /&gt;
=== isalpha ===&lt;br /&gt;
 if (Dana isalpha) ; returns true as &#039;&#039;Dana&#039;&#039; consists of letters only&lt;br /&gt;
 if (foo42 isalpha) ; returns false as &#039;&#039;42&#039;&#039; is no letter&lt;br /&gt;
&lt;br /&gt;
Isalpha checks whether the word consists of letters only. It doesn&#039;t matter whether there are upper or lower case.&lt;br /&gt;
&lt;br /&gt;
=== islower ===&lt;br /&gt;
 if (moo islower) ; returns true as all letters in &#039;&#039;moo&#039;&#039; are lower case.&lt;br /&gt;
 if (m0o islower) ; returns true as well as all letters in &#039;&#039;m0o&#039;&#039; are lower case. &lt;br /&gt;
 if (mooO islower) ; retursn false as there is an upper &#039;&#039;O&#039;&#039; in &#039;&#039;mooO&#039;&#039;.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that islower checks whether all letters in the string are lower case. There can still be numbers or other characters in the string $1.&lt;br /&gt;
&lt;br /&gt;
=== isupper ===&lt;br /&gt;
 if (MOO isupper) ; returns true as &#039;&#039;MOO&#039;&#039; consists of upper case letters only&lt;br /&gt;
 if (1234 isupper) ; returns true as all letters in &#039;&#039;1234&#039;&#039; are upper case, as there are none.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it checks whether all letters in $1 are upper case. There can still be numbers or other characters in $1.&lt;br /&gt;
&lt;br /&gt;
=== ison ===&lt;br /&gt;
 if (Dana ison #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is in the channel #help.script&lt;br /&gt;
 if (foo !ison #help.script) ; returns true as &#039;&#039;foo&#039;&#039; is not in #help.script&lt;br /&gt;
&lt;br /&gt;
This checks whether $1 is in the channel $2.&lt;br /&gt;
&lt;br /&gt;
=== isop ===&lt;br /&gt;
 if (Dana isop #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; is an operator in #help.script&lt;br /&gt;
 if (foo isop #help.script) ; returns false as &#039;&#039;foo&#039;&#039; is no operator in #help.script&lt;br /&gt;
&lt;br /&gt;
Checks whether $1 is an operator in $2.&lt;br /&gt;
&lt;br /&gt;
=== ishop ===&lt;br /&gt;
 if (moo ishop #mIRC) ; returns true if &#039;&#039;moo&#039;&#039; is an half operator in #mIRC&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that QuakeNet does not support halfops.&lt;br /&gt;
&lt;br /&gt;
=== isvoice ===&lt;br /&gt;
 if (Dana isvoice #help.script) ; returns true as &#039;&#039;Dana&#039;&#039; has voice in #help.script.&lt;br /&gt;
 if (foobar isvoice #help.script) ; returns false as &#039;&#039;foobar&#039;&#039; has no voice in #help.script.&lt;br /&gt;
This checks if $1 has voice in $2 or not.&lt;br /&gt;
&lt;br /&gt;
=== isreg ===&lt;br /&gt;
 if (Dana isreg #help.script) ; returns false as Dana is no regular user in #help.script.&lt;br /&gt;
 if (foobar isreg #help.script) ; returns true as foobar is a regular user in #help.script.&lt;br /&gt;
This checks whether $1 is a regular user (no voice, no half operator, no operator) in $2.&lt;br /&gt;
&lt;br /&gt;
=== ischan ===&lt;br /&gt;
 if (#help.script ischan) ; returns true as you are in #help.script.&lt;br /&gt;
 if (#foobar ischan) ; returns false as you are no in #foobar.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that it returns true only if you are in this channel.&lt;br /&gt;
&lt;br /&gt;
=== isban ===&lt;br /&gt;
 if (idiot!*@* isban #mychan) ; returns $true if &#039;&#039;idiot!*@*&#039;&#039; is in your [[:Category:IBL|Internal Ban List]] for the channel #mychan.&lt;br /&gt;
 if ($ial($me) isban $chan) ; returns $true if you are banned on the current channel.&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that isban performs two different checks, depending on whether v1 contains wildcards or not:&lt;br /&gt;
* if v1 contains wildcards, isban will return $true if v1 is an exact ban in the IBL;&lt;br /&gt;
* if v1 does not contain wildcards, isban will return $true if one or more bans match that address.&lt;br /&gt;
&lt;br /&gt;
=== isaop ===&lt;br /&gt;
 if (foobar isaop) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for any channel.&lt;br /&gt;
 if (foobar isaop #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autoop list for #help.script.&lt;br /&gt;
To put someone in your autoop-list, take a look at [[Aop|/aop]].&lt;br /&gt;
&lt;br /&gt;
=== isavoice ===&lt;br /&gt;
 if (foobar isavoice) ; returns true if &#039;&#039;foobar&#039;&#039; is in your autovoicelist for any channel.&lt;br /&gt;
 if (foobar isavoice #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is your autovoicelist for #help.script.&lt;br /&gt;
To put someone in your autovoicelist, take a look at [[Avoice|/avoice]].&lt;br /&gt;
&lt;br /&gt;
=== isignore ===&lt;br /&gt;
 if (foobar isignore) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list.&lt;br /&gt;
 if (foobar isignore c) ; returns true if &#039;&#039;foobar&#039;&#039; is in your ignore list with switch -c.&lt;br /&gt;
To get a more in detail explanation of these switches, take a look at [[Ignore|/ignore]].&lt;br /&gt;
&lt;br /&gt;
=== isprotect ===&lt;br /&gt;
 if (foobar isprotect) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list.&lt;br /&gt;
 if (foobar isprotect #help.script) ; returns true if &#039;&#039;foobar&#039;&#039; is in your protect list for #help.script.&lt;br /&gt;
To get more information about protection, see [[Protect|/protect]].&lt;br /&gt;
&lt;br /&gt;
=== isnotify ===&lt;br /&gt;
 if (Dana isnotify) ; returns true if Dana is in your notify list.&lt;br /&gt;
Take a look at [[Notify|/notify]] to add someone to your notifylist. If someone in your notifylist connects (disconnects), the [[On_notify|On notify event]] ([[On_unotify|On Unotify event]]) is triggered.&lt;br /&gt;
&lt;br /&gt;
== Combining comparisons ==&lt;br /&gt;
&lt;br /&gt;
You can combine comparisons by using the &amp;amp;&amp;amp; for AND and || for OR characters.&lt;br /&gt;
&lt;br /&gt;
 [[var]] %c = 5&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c &amp;gt; 0)      ; returns true because %c is both, smaller than 6 and greater than 0&lt;br /&gt;
 if (%c &amp;lt; 6) || (%c isalpha)  ; returns true because %c is lower than 6.&lt;br /&gt;
                              ; note that %c is not alphapetical and returns false, but || matches for 1 .. N true values.&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c isalpha)  ; returns false&lt;br /&gt;
 if (%c &amp;lt; 6) &amp;amp;&amp;amp; (%c !isalpha) ; ! negates the operator, this this returns true&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
====&#039;&#039;Not all comparations need two parameters&#039;&#039;====&lt;br /&gt;
 if ($1- isupper)&lt;br /&gt;
returns true, if $1- only contain uppercase letters. So ABCD returns true, but even one lowercase letter makes it return false.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;This article covers only if-then-else &#039;&#039;&#039;string&#039;&#039;&#039; operators&#039;&#039;====&lt;br /&gt;
You &#039;&#039;&#039;can&#039;t&#039;&#039;&#039; use&lt;br /&gt;
 if (foo isin test.txt)&lt;br /&gt;
To check content of text-files. You can use [[$read]] instead to read the content of a text file and then use the return value returned by that $read.&lt;br /&gt;
&lt;br /&gt;
== Also see ==&lt;br /&gt;
* [[$v1] &amp;amp; [[$v1|$v2]] These identifiers allow you to retrieve the values of the last if condition.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Debugging_(Find_The_Bug)&amp;diff=1626</id>
		<title>Debugging (Find The Bug)</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Debugging_(Find_The_Bug)&amp;diff=1626"/>
		<updated>2006-10-12T22:43:48Z</updated>

		<summary type="html">&lt;p&gt;Ollie: Spacing changed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
&lt;br /&gt;
Find the Bug v1.1.1.34 argv[0]&#039;s Guide to mIRC Debugging This project is now OpenText. Please contribute! Last edit by: argv[0] at 2006-06-03 12:53:46&lt;br /&gt;
Contents&lt;br /&gt;
&lt;br /&gt;
1. Why am I Here?&lt;br /&gt;
2. The Basics of Debugging&lt;br /&gt;
3. The Steps of Debugging&lt;br /&gt;
3.1 Narrow it Down!&lt;br /&gt;
3.2 Look for Error Messages&lt;br /&gt;
3.3 Be Verbose&lt;br /&gt;
3.4 Check Brackets and Syntax&lt;br /&gt;
3.5 Simplify Complicated and Suspicious Code&lt;br /&gt;
4. Final Notes&lt;br /&gt;
5. Common Scripting Pitfalls&lt;br /&gt;
6. Contributions&lt;br /&gt;
1. Why am I Here?&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve come wandering upon this document it is likely that you are having trouble with a script that you wrote. It is probably fully written, but doesn&#039;t seem to work as it should, for one reason or another. The purpose of this document is therefore to teach you how to debug your own scripts, making the coding process easier and more efficient. Don&#039;t get discouraged, debugging is not hard. Debugging is a logical process that can be easily learned and applied if you follow the steps involved.&lt;br /&gt;
&lt;br /&gt;
If you happen to already know enough about debugging, but just can&#039;t seem to figure out what is going wrong with a script you wrote, you should take a look at section 5, in which some Common Scripting Pitfalls are discussed.&lt;br /&gt;
&lt;br /&gt;
2. The Basics of Debugging&lt;br /&gt;
&lt;br /&gt;
If a script does not work, the logical process is to find out why, so that it may be fixed. DO NOT take for granted the first step I mentioned, in which you must find out why your script does not work. When first dealing with any bugged script, your frame of mind should never be, &amp;quot;this needs to be fixed&amp;quot;. Instead you should first be asking the question &amp;quot;why does this not work?&amp;quot; Once you answer that question you can move on to fixing it and the fix is usually much simpler than the debugging process itself. Think of debugging similar to a medical situation. Before you treat a patient, you must always diagnose him or her first. This concept applies the same way in debugging.&lt;br /&gt;
&lt;br /&gt;
A lot of people asking for help on IRC or in forums are basically just asking for other people to debug their scripts, instead of helping them with something the person asking doesn&#039;t understand. Don&#039;t expect much respect if you ask people to bugfix for you.&lt;br /&gt;
&lt;br /&gt;
3. The Steps of Debugging&lt;br /&gt;
&lt;br /&gt;
Practically speaking, to diagnose a bugged script you should follow the set of steps which I will now begin explaining.&lt;br /&gt;
&lt;br /&gt;
3.1 Narrow it Down!&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Narrow it down&amp;quot; is probably one of the best phrases to keep in mind when debugging a script. Often a scripter will ask for help with a script that doesn&#039;t seem to trigger, but he will paste his entire script, which happens to be 100 or so lines of code. The truth is that it is rarely necessary to look at more than 5-10 lines of code at a time. While debugging you should constantly be narrowing down which lines of code the bug is affecting, or which lines of code simply do not work.&lt;br /&gt;
&lt;br /&gt;
But don&#039;t stop there; a line of code can easily become too general still. Continue to narrow down your search as much as possible. Sometimes it will be necessary to narrow things down to the smallest character (this has definitely been the source of many bugs I&#039;ve seen in the past). Remember that sometimes a bug can be as simple as a typo or spelling mistake.&lt;br /&gt;
&lt;br /&gt;
The question you are probably asking is how exactly you &amp;quot;narrow down&amp;quot; a search for a bug? &amp;quot;What should I be looking for?&amp;quot; There are many things to look for; here are some methods you can use to find out which part of your script is not functioning properly:&lt;br /&gt;
&lt;br /&gt;
3.2 Look for Error Messages&lt;br /&gt;
&lt;br /&gt;
Sometimes if mIRC breaks a script errantly it will echo the error information locally. This is usually found in the status window of your active connection id (unless your command explicitly used another connection id). If you get such an error it might inform you of the line it halted execution on. This is very useful to narrow your bug search to a certain line. If no line is mentioned you will most likely get the command, which is also very helpful. You can then go look up each time you used that command in your script.&lt;br /&gt;
&lt;br /&gt;
3.3 Be Verbose&lt;br /&gt;
&lt;br /&gt;
Verbose means to be audible. In the context of mIRC scripting it means to /echo data to the screen. Usually a debugger should try to echo as much information as often as possible.&lt;br /&gt;
&lt;br /&gt;
If you have a variable that does not have the right value, it is best to echo that variable right after you set it to find out what value it took on. This can easily narrow your code down to a line in one simple step.&lt;br /&gt;
&lt;br /&gt;
Another possibility is that a line of code isn&#039;t being executed at all (how do I know this, you ask? Well if it&#039;s a command such as /kick it is very easy to tell if it executes or not, however if it is a silent command, try tacking on a /echo inside the command itself to see if it executes). In such a case it is a good idea to drop in /echo commands along your code flow, regardless of what it actually echoes.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
 alias function_name {&lt;br /&gt;
     echo -a Started execution&lt;br /&gt;
     if (a == a) {&lt;br /&gt;
         echo -a Got to first level if&lt;br /&gt;
         if (b == b) {&lt;br /&gt;
             ; mIRC should get here, &lt;br /&gt;
             ; but lets find out&lt;br /&gt;
             echo -a Got to second level&lt;br /&gt;
             ; Imagine this next if is a typo&lt;br /&gt;
             if (defcon == defdcon) {&lt;br /&gt;
                 echo -a Got to third level&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
     echo -a Ending function&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 Output:&lt;br /&gt;
 Started execution&lt;br /&gt;
 Got to first level if&lt;br /&gt;
 Got to second level&lt;br /&gt;
 Ending function&lt;br /&gt;
&lt;br /&gt;
From this it should be clear that mIRC did not reach the last nested if-statement. You can now do further tests to find out why your if statement failed. In our case it was a typo, we really meant to say &#039;defcon&#039; instead of &#039;defdcon&#039;.&lt;br /&gt;
&lt;br /&gt;
Another way to use echo is echo&#039;ing big or complicated identifiers, or even entire commands, to see if they actually parse into what you want them to be.&lt;br /&gt;
&lt;br /&gt;
3.4 Check Brackets and Syntax&lt;br /&gt;
&lt;br /&gt;
This may seem trivial, but it is always important to make sure your script has as many open brackets as close brackets and also follow mIRC&#039;s basic syntax rules. I will outline some basic syntax rules that mIRC uses:&lt;br /&gt;
&lt;br /&gt;
Basic Syntax Rules&lt;br /&gt;
&lt;br /&gt;
* Braces {} must always be spaced out and never touch any other character. There is one  exception to this rule, but if you always space your braces out you should not have a problem. This also applies to the pipe | character used for dealing with multiple commands.&lt;br /&gt;
&lt;br /&gt;
* Multiple commands should generally be surrounded by braces. It is not necessary to use a new line for each command, but keep in mind the multiple command structure:&lt;br /&gt;
&lt;br /&gt;
On one line:&lt;br /&gt;
&lt;br /&gt;
 ALIAS/EVENT { command 1 | command 2 | command 3 }&lt;br /&gt;
 &lt;br /&gt;
On multiple lines:&lt;br /&gt;
 &lt;br /&gt;
 ALIAS/EVENT {&lt;br /&gt;
     command 1&lt;br /&gt;
     command 2&lt;br /&gt;
     command 3&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
On both multiple and single lines:&lt;br /&gt;
&lt;br /&gt;
 ALIAS/EVENT {&lt;br /&gt;
     command 1 | command 2&lt;br /&gt;
     command 3&lt;br /&gt;
     command 4&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Note that the opening brace can never be on its own on a line. Consider the following:&lt;br /&gt;
&lt;br /&gt;
 ALIAS/EVENT&lt;br /&gt;
 {&lt;br /&gt;
     command&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Some languages allow this syntax. This is not valid in mIRC. The opening brace can never begin a line.&lt;br /&gt;
&lt;br /&gt;
* The If control structure is command based in mIRC. As such, it must be properly spaced just like all commands. Some languages allow the use of:&lt;br /&gt;
&lt;br /&gt;
if(condition)&lt;br /&gt;
&lt;br /&gt;
This is also not valid in mIRC. In such a case, you would actually be performing the command of /if(condition), which most likely does not exist. The condition (including the brackets) in mIRC if statements is a parameter, and must follow the if statement with a space.&lt;br /&gt;
&lt;br /&gt;
As far as braces go (the { } characters), mIRC can check this automatically in the script editor by clicking the &amp;quot;{ }&amp;quot; button. If mIRC says you have a mismatch, fix it before going further; it is likely that this is the cause of your bug.&lt;br /&gt;
&lt;br /&gt;
When dealing with if statements it is always important to make sure you have the same amount of opening brackets as closing brackets. Sometimes mIRC will not report this error and will automatically fail the if statement and continue execution. If you read section 3.3 you may have used the echo method to find out which if statement is not being triggers. In such a case, the first thing you should do is count the brackets and look at general syntax as described above.&lt;br /&gt;
&lt;br /&gt;
3.5 Simplify Complicated and Suspicious Code&lt;br /&gt;
&lt;br /&gt;
If you were unsuccessful in tracking down your bug using any of the other methods mentioned above, try looking for suspicious code. If you wrote a line of code that you just aren&#039;t sure about, try looking closer at that line. Similarly, if you have a very complex line of code in your script, try looking at that one first. A good way to handle a situation like this is to change the line to something very simple, and see if it works. If it does then you know that your problem lies in the code that you changed. If not then you can be certain that the bug you&#039;re looking for does not lie in your complex code. (Although be aware that you shouldn&#039;t now automatically trust it completely, as there may still be issues with it which won&#039;t be apparent until the current bug is fixed, for example.)&lt;br /&gt;
&lt;br /&gt;
4. Final Notes&lt;br /&gt;
&lt;br /&gt;
Remember that when you&#039;re debugging a script it is more important to find out why your script is failing than to fix it. An mIRC support channel can easily aid a scripter solve his problem when it is clear what the problem is. In essence, if you cannot solve a problem it is important that you at least understand what problem it is that you&#039;re having, that way you can get the help you need from an outside source. That is the purpose of debugging a script; not to directly fix, but to set yourself on a course to implement such a fix.&lt;br /&gt;
&lt;br /&gt;
5. Common Scripting Pitfalls&lt;br /&gt;
&lt;br /&gt;
Conflicting Event Matching&lt;br /&gt;
&lt;br /&gt;
A Scripter will often put the following line of code in his Remotes and it will not trigger:&lt;br /&gt;
&lt;br /&gt;
 on 1:TEXT:!trigger *:#: { commands }&lt;br /&gt;
&lt;br /&gt;
There is nothing wrong with this code. It should trigger fine. However in his script (higher up in the file) he also has the following line:&lt;br /&gt;
&lt;br /&gt;
 on 1:TEXT:*:#: { commands }&lt;br /&gt;
&lt;br /&gt;
The reason his !trigger is not working is that mIRC goes downwards through a script file finding the first event that matches. Since &#039;*&#039; is more global than &#039;!trigger *&#039;, mIRC will not reach his !trigger event. To fix this the scripter must either reverse the order which they appear in the file, or put the !trigger in a new script file, so that mIRC will execute both.&lt;br /&gt;
&lt;br /&gt;
* Note: this also occurs for any other events that match for the same input&lt;br /&gt;
&lt;br /&gt;
Using &amp;quot; &amp;quot; In Filenames&lt;br /&gt;
&lt;br /&gt;
Always use &amp;quot; &amp;quot; when dealing with files and directories, to make sure mIRC understands directories with spaces in the name. It&#039;s a good habit to always use them, even when you aren&#039;t expecting any spaces.&lt;br /&gt;
&lt;br /&gt;
 /rename c:\Program Files\Half-life\hl.exe c:\Program Files\Half-Life\hl2.exe&lt;br /&gt;
&lt;br /&gt;
This won&#039;t work.&lt;br /&gt;
&lt;br /&gt;
 /rename &amp;quot;c:\Program Files\Half-life\hl.exe&amp;quot; &amp;quot;c:\Program Files\Half-Life\hl2.exe&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This will.&lt;br /&gt;
&lt;br /&gt;
&#039;=&#039; Is Not &#039;==&#039;&lt;br /&gt;
&lt;br /&gt;
Remember to always use == when you are comparing objects in if&#039;s or while loops. This counts for every programming language. == is for comparing, = is for assigning.&lt;br /&gt;
&lt;br /&gt;
 alias istest {&lt;br /&gt;
     if (100 == 100) {&lt;br /&gt;
         var %pie = 8&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Remember That Some Commands Have Delays&lt;br /&gt;
&lt;br /&gt;
Not all commands are completed the moment you start them. Some command require you to wait. this pretty much counts for every command that requires a reply from the server or from other clients or connections. For example, this won&#039;t work:&lt;br /&gt;
&lt;br /&gt;
 on *:DEOP:#:{&lt;br /&gt;
     if ($opnick == $me) {&lt;br /&gt;
         ;check if we are being deopped&lt;br /&gt;
         msg BOTNICK op $chan&lt;br /&gt;
         ;requesting op&lt;br /&gt;
         kick $chan $nick Don&#039;t deop me!&lt;br /&gt;
         ;kick the person that deopped you&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It won&#039;t work because when you ask for op status, there is a delay between the time that you ask it and the time that you actually get it. Even if it&#039;s just a few milliseconds, the script goes too fast for it. There are two ways to solve it; either put the kick command in a timer or use a separate on op event for the kick.&lt;br /&gt;
&lt;br /&gt;
Using $read With The s Flag&lt;br /&gt;
&lt;br /&gt;
When you use $read with the s flag to scan for a line starting with a certain word, keep in mind that the result will NOT include the word you were searching for itself! It returns everything after the word you scanned with.&lt;br /&gt;
&lt;br /&gt;
So if you had a textfile with a line that said &amp;quot;ParaSite` is the greatest&amp;quot; and you used $read(textfile.txt,s,ParaSite`), it would return &amp;quot;is the greatest&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
6. Contributions&lt;br /&gt;
&lt;br /&gt;
This document has been converted into an OpenText project, allowing users of the mIRC community to revise this text.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.holycraplions.com/findthebug/ Find the bug]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Debugging_(Find_The_Bug)&amp;diff=1622</id>
		<title>Debugging (Find The Bug)</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Debugging_(Find_The_Bug)&amp;diff=1622"/>
		<updated>2006-10-12T22:41:47Z</updated>

		<summary type="html">&lt;p&gt;Ollie: Imported.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Stub}}&lt;br /&gt;
&lt;br /&gt;
Find the Bug v1.1.1.34 argv[0]&#039;s Guide to mIRC Debugging This project is now OpenText. Please contribute! Last edit by: argv[0] at 2006-06-03 12:53:46&lt;br /&gt;
Contents&lt;br /&gt;
&lt;br /&gt;
1. Why am I Here?&lt;br /&gt;
2. The Basics of Debugging&lt;br /&gt;
3. The Steps of Debugging&lt;br /&gt;
3.1 Narrow it Down!&lt;br /&gt;
3.2 Look for Error Messages&lt;br /&gt;
3.3 Be Verbose&lt;br /&gt;
3.4 Check Brackets and Syntax&lt;br /&gt;
3.5 Simplify Complicated and Suspicious Code&lt;br /&gt;
4. Final Notes&lt;br /&gt;
5. Common Scripting Pitfalls&lt;br /&gt;
6. Contributions&lt;br /&gt;
1. Why am I Here?&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve come wandering upon this document it is likely that you are having trouble with a script that you wrote. It is probably fully written, but doesn&#039;t seem to work as it should, for one reason or another. The purpose of this document is therefore to teach you how to debug your own scripts, making the coding process easier and more efficient. Don&#039;t get discouraged, debugging is not hard. Debugging is a logical process that can be easily learned and applied if you follow the steps involved.&lt;br /&gt;
&lt;br /&gt;
If you happen to already know enough about debugging, but just can&#039;t seem to figure out what is going wrong with a script you wrote, you should take a look at section 5, in which some Common Scripting Pitfalls are discussed.&lt;br /&gt;
&lt;br /&gt;
2. The Basics of Debugging&lt;br /&gt;
&lt;br /&gt;
If a script does not work, the logical process is to find out why, so that it may be fixed. DO NOT take for granted the first step I mentioned, in which you must find out why your script does not work. When first dealing with any bugged script, your frame of mind should never be, &amp;quot;this needs to be fixed&amp;quot;. Instead you should first be asking the question &amp;quot;why does this not work?&amp;quot; Once you answer that question you can move on to fixing it and the fix is usually much simpler than the debugging process itself. Think of debugging similar to a medical situation. Before you treat a patient, you must always diagnose him or her first. This concept applies the same way in debugging.&lt;br /&gt;
&lt;br /&gt;
A lot of people asking for help on IRC or in forums are basically just asking for other people to debug their scripts, instead of helping them with something the person asking doesn&#039;t understand. Don&#039;t expect much respect if you ask people to bugfix for you.&lt;br /&gt;
&lt;br /&gt;
3. The Steps of Debugging&lt;br /&gt;
&lt;br /&gt;
Practically speaking, to diagnose a bugged script you should follow the set of steps which I will now begin explaining.&lt;br /&gt;
&lt;br /&gt;
3.1 Narrow it Down!&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Narrow it down&amp;quot; is probably one of the best phrases to keep in mind when debugging a script. Often a scripter will ask for help with a script that doesn&#039;t seem to trigger, but he will paste his entire script, which happens to be 100 or so lines of code. The truth is that it is rarely necessary to look at more than 5-10 lines of code at a time. While debugging you should constantly be narrowing down which lines of code the bug is affecting, or which lines of code simply do not work.&lt;br /&gt;
&lt;br /&gt;
But don&#039;t stop there; a line of code can easily become too general still. Continue to narrow down your search as much as possible. Sometimes it will be necessary to narrow things down to the smallest character (this has definitely been the source of many bugs I&#039;ve seen in the past). Remember that sometimes a bug can be as simple as a typo or spelling mistake.&lt;br /&gt;
&lt;br /&gt;
The question you are probably asking is how exactly you &amp;quot;narrow down&amp;quot; a search for a bug? &amp;quot;What should I be looking for?&amp;quot; There are many things to look for; here are some methods you can use to find out which part of your script is not functioning properly:&lt;br /&gt;
&lt;br /&gt;
3.2 Look for Error Messages&lt;br /&gt;
&lt;br /&gt;
Sometimes if mIRC breaks a script errantly it will echo the error information locally. This is usually found in the status window of your active connection id (unless your command explicitly used another connection id). If you get such an error it might inform you of the line it halted execution on. This is very useful to narrow your bug search to a certain line. If no line is mentioned you will most likely get the command, which is also very helpful. You can then go look up each time you used that command in your script.&lt;br /&gt;
&lt;br /&gt;
3.3 Be Verbose&lt;br /&gt;
&lt;br /&gt;
Verbose means to be audible. In the context of mIRC scripting it means to /echo data to the screen. Usually a debugger should try to echo as much information as often as possible.&lt;br /&gt;
&lt;br /&gt;
If you have a variable that does not have the right value, it is best to echo that variable right after you set it to find out what value it took on. This can easily narrow your code down to a line in one simple step.&lt;br /&gt;
&lt;br /&gt;
Another possibility is that a line of code isn&#039;t being executed at all (how do I know this, you ask? Well if it&#039;s a command such as /kick it is very easy to tell if it executes or not, however if it is a silent command, try tacking on a /echo inside the command itself to see if it executes). In such a case it is a good idea to drop in /echo commands along your code flow, regardless of what it actually echoes.&lt;br /&gt;
&lt;br /&gt;
Consider the following example:&lt;br /&gt;
&lt;br /&gt;
 alias function_name {&lt;br /&gt;
     echo -a Started execution&lt;br /&gt;
     if (a == a) {&lt;br /&gt;
         echo -a Got to first level if&lt;br /&gt;
         if (b == b) {&lt;br /&gt;
             ; mIRC should get here, &lt;br /&gt;
             ; but lets find out&lt;br /&gt;
             echo -a Got to second level&lt;br /&gt;
             ; Imagine this next if is a typo&lt;br /&gt;
             if (defcon == defdcon) {&lt;br /&gt;
                 echo -a Got to third level&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
     echo -a Ending function&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 Output:&lt;br /&gt;
 Started execution&lt;br /&gt;
 Got to first level if&lt;br /&gt;
 Got to second level&lt;br /&gt;
 Ending function&lt;br /&gt;
&lt;br /&gt;
From this it should be clear that mIRC did not reach the last nested if-statement. You can now do further tests to find out why your if statement failed. In our case it was a typo, we really meant to say &#039;defcon&#039; instead of &#039;defdcon&#039;.&lt;br /&gt;
&lt;br /&gt;
Another way to use echo is echo&#039;ing big or complicated identifiers, or even entire commands, to see if they actually parse into what you want them to be.&lt;br /&gt;
&lt;br /&gt;
3.4 Check Brackets and Syntax&lt;br /&gt;
&lt;br /&gt;
This may seem trivial, but it is always important to make sure your script has as many open brackets as close brackets and also follow mIRC&#039;s basic syntax rules. I will outline some basic syntax rules that mIRC uses:&lt;br /&gt;
&lt;br /&gt;
 Basic Syntax Rules&lt;br /&gt;
&lt;br /&gt;
    * Braces {} must always be spaced out and never touch any other character. There is one  exception to this rule, but if you always space your braces out you should not have a problem. This also applies to the pipe | character used for dealing with multiple commands.&lt;br /&gt;
&lt;br /&gt;
    * Multiple commands should generally be surrounded by braces. It is not necessary to use a new line for each command, but keep in mind the multiple command structure:&lt;br /&gt;
&lt;br /&gt;
On one line:&lt;br /&gt;
&lt;br /&gt;
 ALIAS/EVENT { command 1 | command 2 | command 3 }&lt;br /&gt;
 &lt;br /&gt;
On multiple lines:&lt;br /&gt;
 &lt;br /&gt;
 ALIAS/EVENT {&lt;br /&gt;
     command 1&lt;br /&gt;
     command 2&lt;br /&gt;
     command 3&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
On both multiple and single lines:&lt;br /&gt;
&lt;br /&gt;
 ALIAS/EVENT {&lt;br /&gt;
     command 1 | command 2&lt;br /&gt;
     command 3&lt;br /&gt;
     command 4&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Note that the opening brace can never be on its own on a line. Consider the following:&lt;br /&gt;
&lt;br /&gt;
 ALIAS/EVENT&lt;br /&gt;
 {&lt;br /&gt;
     command&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Some languages allow this syntax. This is not valid in mIRC. The opening brace can never begin a line.&lt;br /&gt;
&lt;br /&gt;
* The If control structure is command based in mIRC. As such, it must be properly spaced just like all commands. Some languages allow the use of:&lt;br /&gt;
&lt;br /&gt;
if(condition)&lt;br /&gt;
&lt;br /&gt;
This is also not valid in mIRC. In such a case, you would actually be performing the command of /if(condition), which most likely does not exist. The condition (including the brackets) in mIRC if statements is a parameter, and must follow the if statement with a space.&lt;br /&gt;
&lt;br /&gt;
As far as braces go (the { } characters), mIRC can check this automatically in the script editor by clicking the &amp;quot;{ }&amp;quot; button. If mIRC says you have a mismatch, fix it before going further; it is likely that this is the cause of your bug.&lt;br /&gt;
&lt;br /&gt;
When dealing with if statements it is always important to make sure you have the same amount of opening brackets as closing brackets. Sometimes mIRC will not report this error and will automatically fail the if statement and continue execution. If you read section 3.3 you may have used the echo method to find out which if statement is not being triggers. In such a case, the first thing you should do is count the brackets and look at general syntax as described above.&lt;br /&gt;
&lt;br /&gt;
3.5 Simplify Complicated and Suspicious Code&lt;br /&gt;
&lt;br /&gt;
If you were unsuccessful in tracking down your bug using any of the other methods mentioned above, try looking for suspicious code. If you wrote a line of code that you just aren&#039;t sure about, try looking closer at that line. Similarly, if you have a very complex line of code in your script, try looking at that one first. A good way to handle a situation like this is to change the line to something very simple, and see if it works. If it does then you know that your problem lies in the code that you changed. If not then you can be certain that the bug you&#039;re looking for does not lie in your complex code. (Although be aware that you shouldn&#039;t now automatically trust it completely, as there may still be issues with it which won&#039;t be apparent until the current bug is fixed, for example.)&lt;br /&gt;
&lt;br /&gt;
4. Final Notes&lt;br /&gt;
&lt;br /&gt;
Remember that when you&#039;re debugging a script it is more important to find out why your script is failing than to fix it. An mIRC support channel can easily aid a scripter solve his problem when it is clear what the problem is. In essence, if you cannot solve a problem it is important that you at least understand what problem it is that you&#039;re having, that way you can get the help you need from an outside source. That is the purpose of debugging a script; not to directly fix, but to set yourself on a course to implement such a fix.&lt;br /&gt;
&lt;br /&gt;
5. Common Scripting Pitfalls&lt;br /&gt;
&lt;br /&gt;
Conflicting Event Matching&lt;br /&gt;
&lt;br /&gt;
A Scripter will often put the following line of code in his Remotes and it will not trigger:&lt;br /&gt;
&lt;br /&gt;
 on 1:TEXT:!trigger *:#: { commands }&lt;br /&gt;
&lt;br /&gt;
There is nothing wrong with this code. It should trigger fine. However in his script (higher up in the file) he also has the following line:&lt;br /&gt;
&lt;br /&gt;
 on 1:TEXT:*:#: { commands }&lt;br /&gt;
&lt;br /&gt;
The reason his !trigger is not working is that mIRC goes downwards through a script file finding the first event that matches. Since &#039;*&#039; is more global than &#039;!trigger *&#039;, mIRC will not reach his !trigger event. To fix this the scripter must either reverse the order which they appear in the file, or put the !trigger in a new script file, so that mIRC will execute both.&lt;br /&gt;
&lt;br /&gt;
* Note: this also occurs for any other events that match for the same input&lt;br /&gt;
&lt;br /&gt;
Using &amp;quot; &amp;quot; In Filenames&lt;br /&gt;
&lt;br /&gt;
Always use &amp;quot; &amp;quot; when dealing with files and directories, to make sure mIRC understands directories with spaces in the name. It&#039;s a good habit to always use them, even when you aren&#039;t expecting any spaces.&lt;br /&gt;
&lt;br /&gt;
 /rename c:\Program Files\Half-life\hl.exe c:\Program Files\Half-Life\hl2.exe&lt;br /&gt;
&lt;br /&gt;
This won&#039;t work.&lt;br /&gt;
&lt;br /&gt;
 /rename &amp;quot;c:\Program Files\Half-life\hl.exe&amp;quot; &amp;quot;c:\Program Files\Half-Life\hl2.exe&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This will.&lt;br /&gt;
&lt;br /&gt;
&#039;=&#039; Is Not &#039;==&#039;&lt;br /&gt;
&lt;br /&gt;
Remember to always use == when you are comparing objects in if&#039;s or while loops. This counts for every programming language. == is for comparing, = is for assigning.&lt;br /&gt;
&lt;br /&gt;
 alias istest {&lt;br /&gt;
     if (100 == 100) {&lt;br /&gt;
         var %pie = 8&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Remember That Some Commands Have Delays&lt;br /&gt;
&lt;br /&gt;
Not all commands are completed the moment you start them. Some command require you to wait. this pretty much counts for every command that requires a reply from the server or from other clients or connections. For example, this won&#039;t work:&lt;br /&gt;
&lt;br /&gt;
 on *:DEOP:#:{&lt;br /&gt;
     if ($opnick == $me) {&lt;br /&gt;
         ;check if we are being deopped&lt;br /&gt;
         msg BOTNICK op $chan&lt;br /&gt;
         ;requesting op&lt;br /&gt;
         kick $chan $nick Don&#039;t deop me!&lt;br /&gt;
         ;kick the person that deopped you&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It won&#039;t work because when you ask for op status, there is a delay between the time that you ask it and the time that you actually get it. Even if it&#039;s just a few milliseconds, the script goes too fast for it. There are two ways to solve it; either put the kick command in a timer or use a separate on op event for the kick.&lt;br /&gt;
&lt;br /&gt;
Using $read With The s Flag&lt;br /&gt;
&lt;br /&gt;
When you use $read with the s flag to scan for a line starting with a certain word, keep in mind that the result will NOT include the word you were searching for itself! It returns everything after the word you scanned with.&lt;br /&gt;
&lt;br /&gt;
So if you had a textfile with a line that said &amp;quot;ParaSite` is the greatest&amp;quot; and you used $read(textfile.txt,s,ParaSite`), it would return &amp;quot;is the greatest&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
6. Contributions&lt;br /&gt;
&lt;br /&gt;
This document has been converted into an OpenText project, allowing users of the mIRC community to revise this text.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
*[http://www.holycraplions.com/findthebug/ Find the bug]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1647</id>
		<title>!seen</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1647"/>
		<updated>2006-10-10T15:06:30Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pretty simple !seen script.&lt;br /&gt;
&lt;br /&gt;
 ;Seen script, pretty much self-explanatory.&lt;br /&gt;
 ;Syntax:&lt;br /&gt;
 ;/seen on/off&lt;br /&gt;
 ;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] &lt;br /&gt;
 ;Just add any words you don&#039;t want to be used.&lt;br /&gt;
 ;/msg #channel/bot !seen name&lt;br /&gt;
 ;* &lt;br /&gt;
 ; Ollie&lt;br /&gt;
 &lt;br /&gt;
 alias seen {&lt;br /&gt;
   if ($1 == del) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
     if (!$read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is not in the database. | return }&lt;br /&gt;
     write -dw $+ $2 funny.txt&lt;br /&gt;
     echo -a Removed: $+(&amp;quot;,$2,&amp;quot;,.) From the &#039;funny&#039; words list.&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   if ($1 == add) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
     if ($read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is already in the database. | return }&lt;br /&gt;
     write funny.txt $2&lt;br /&gt;
     echo -a Added: $+(&amp;quot;,$2,&amp;quot;,.) To the &#039;funny&#039; words list.&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   if ($1 == on) {&lt;br /&gt;
     echo -a Seen Status: On&lt;br /&gt;
     set %seen on&lt;br /&gt;
     return&lt;br /&gt;
    }&lt;br /&gt;
   if ($1 == off) {&lt;br /&gt;
     echo -a Seen Status: Off&lt;br /&gt;
     set %seen off&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   echo -a Unknown parameter.&lt;br /&gt;
 }&lt;br /&gt;
 on *:text:!seen*:*:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   var %target = $iif($chan,$chan,$nick)&lt;br /&gt;
   if (!$2) { notice $nick seen whom? | return }&lt;br /&gt;
   if ($2 == $nick) { &lt;br /&gt;
     describe %target hands $nick a mirror. &lt;br /&gt;
     return &lt;br /&gt;
   }&lt;br /&gt;
   if ($chan) &amp;amp;&amp;amp; ($2 ison $chan) { &lt;br /&gt;
     msg %target $2 Is in the channel! $iif(%last.spoke. [ $+ [ $2 ] ],His/her last words were: %last.spoke. [ $+ [ $2 ] ],They haven&#039;t spoken anything yet!) &lt;br /&gt;
     return &lt;br /&gt;
   }&lt;br /&gt;
   if (!%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
     if ($read(funny.txt, w, $2)) { &lt;br /&gt;
       msg %target hoho. aren&#039;t you a funny one &lt;br /&gt;
       halt &lt;br /&gt;
     } &lt;br /&gt;
     if (!%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
       msg %target i have never seen $2 | return &lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   if (%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
     msg %target I last saw $2 %seen. [ $+ [ $2 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $2 ] ] )) ago. $iif(%last.spoke. [ $+ [ $2 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $2 ] ],He left without saying anything!)&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:NICK:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:kick:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:JOIN:#:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:text:*:#:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %last.spoke. [ $+ [ $nick ] ] $1-&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:quit:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Script Archive]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1615</id>
		<title>!seen</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1615"/>
		<updated>2006-10-10T15:02:05Z</updated>

		<summary type="html">&lt;p&gt;Ollie: Actually works now ;p&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pretty simple !seen script.&lt;br /&gt;
&lt;br /&gt;
 ;Seen script, pretty much self-explanatory.&lt;br /&gt;
 ;Syntax:&lt;br /&gt;
 ;/seen on/off&lt;br /&gt;
 ;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] &lt;br /&gt;
 ;Just add any words you don&#039;t want to be used.&lt;br /&gt;
 ;/msg #channel/bot !seen name&lt;br /&gt;
 ;* &lt;br /&gt;
 ; Ollie&lt;br /&gt;
 &lt;br /&gt;
 alias seen {&lt;br /&gt;
   if ($1 == del) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
     if (!$read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is not in the database. | return }&lt;br /&gt;
     write -dw $+ $2 funny.txt&lt;br /&gt;
     echo -a Removed: $+(&amp;quot;,$2,&amp;quot;,.) From the &#039;funny&#039; words list.&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   if ($1 == add) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
     if ($read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is already in the database. | return }&lt;br /&gt;
     write funny.txt $2&lt;br /&gt;
     echo -a Added: $+(&amp;quot;,$2,&amp;quot;,.) To the &#039;funny&#039; words list.&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   if ($1 == on) {&lt;br /&gt;
     echo -a Seen Status: On&lt;br /&gt;
     set %seen on&lt;br /&gt;
     return&lt;br /&gt;
    }&lt;br /&gt;
   if ($1 == off) {&lt;br /&gt;
     echo -a Seen Status: Off&lt;br /&gt;
     set %seen off&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   echo -a Unknown parameter.&lt;br /&gt;
 }&lt;br /&gt;
 on *:text:!seen(:*:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   var %target = $iif($chan,$chan,$nick)&lt;br /&gt;
   if (!$2) { notice $nick seen whom? | return }&lt;br /&gt;
   if ($2 == $nick) { &lt;br /&gt;
     describe %target hands $nick a mirror. &lt;br /&gt;
     return &lt;br /&gt;
   }&lt;br /&gt;
   if ($chan) &amp;amp;&amp;amp; ($2 ison $chan) { &lt;br /&gt;
     msg %target $2 Is in the channel! $iif(%last.spoke. [ $+ [ $2 ] ],His/her last words were: %last.spoke. [ $+ [ $2 ] ],They haven&#039;t spoken anything yet!) &lt;br /&gt;
     return &lt;br /&gt;
   }&lt;br /&gt;
   if (!%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
     if ($read(funny.txt, w, $2)) { &lt;br /&gt;
       msg %target hoho. aren&#039;t you a funny one &lt;br /&gt;
       halt &lt;br /&gt;
     } &lt;br /&gt;
     if (!%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
       msg %target i have never seen $2 | return &lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   if (%seen. [ $+ [ $2 ] ] ) { &lt;br /&gt;
     msg %target I last saw $2 %seen. [ $+ [ $2 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $2 ] ] )) ago. $iif(%last.spoke. [ $+ [ $2 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $2 ] ],He left without saying anything!)&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:NICK:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:kick:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:JOIN:#:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:text:*:#:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %last.spoke. [ $+ [ $nick ] ] $1-&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:quit:{&lt;br /&gt;
   if (%seen == off) { return }&lt;br /&gt;
   set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate &lt;br /&gt;
   set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Script Archive]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1613</id>
		<title>!seen</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1613"/>
		<updated>2006-10-09T22:08:01Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pretty simple !seen script.&lt;br /&gt;
&lt;br /&gt;
 ;Seen script, pretty much self-explanatory.&lt;br /&gt;
 ;Syntax:&lt;br /&gt;
 ;/seen on/off&lt;br /&gt;
 ;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] &lt;br /&gt;
 ;Just add any words you don&#039;t want to be used.&lt;br /&gt;
 ;/msg #channel/bot !seen name&lt;br /&gt;
 ;* &lt;br /&gt;
 ; Ollie&lt;br /&gt;
 &lt;br /&gt;
 alias seen {&lt;br /&gt;
 if ($1 == del) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
 if (!$read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is not in the database. | return }&lt;br /&gt;
 write -dw $+ $2 funny.txt&lt;br /&gt;
 echo -a Removed: $+(&amp;quot;,$2,&amp;quot;,.) From the &#039;funny&#039; words list.&lt;br /&gt;
 return&lt;br /&gt;
 }&lt;br /&gt;
 if ($1 == add) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
 if ($read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is already in the database. | return }&lt;br /&gt;
 write funny.txt $2&lt;br /&gt;
 echo -a Added: $+(&amp;quot;,$2,&amp;quot;,.) To the &#039;funny&#039; words list.&lt;br /&gt;
 return&lt;br /&gt;
 }&lt;br /&gt;
 if ($1 == on) {&lt;br /&gt;
 echo -a Seen Status: On&lt;br /&gt;
 set %seen on&lt;br /&gt;
 return&lt;br /&gt;
 }&lt;br /&gt;
 if ($1 == off) {&lt;br /&gt;
 echo -a Seen Status: Off&lt;br /&gt;
 set %seen off&lt;br /&gt;
 return&lt;br /&gt;
 }&lt;br /&gt;
 echo -a Unknown parameter.&lt;br /&gt;
 }&lt;br /&gt;
 on *:text:!seen:*:{&lt;br /&gt;
 if (%seen == off) { return }&lt;br /&gt;
 var %target = $iif($chan,$chan,$nick)&lt;br /&gt;
 if ($3 == $nick) { &lt;br /&gt;
 describe %target hands $nick a mirror. &lt;br /&gt;
 return &lt;br /&gt;
 }&lt;br /&gt;
 if ($chan) &amp;amp;&amp;amp; ($3 ison $chan) { &lt;br /&gt;
 msg %target $3 Is in the channel! $iif(%last.spoke. [ $+ [ $3 ] ],His/her last words were: %last.spoke. [ $+ [ $3 ] ],They haven&#039;t spoken anything yet!) &lt;br /&gt;
 return &lt;br /&gt;
 }&lt;br /&gt;
 if (!%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
 if ($read(funny.txt, w, $3)) { &lt;br /&gt;
 msg %target hoho. aren&#039;t you a funny one &lt;br /&gt;
 halt &lt;br /&gt;
 } &lt;br /&gt;
 if (!%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
 msg %target i have never seen $3 | return &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 if (%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
 msg %target I last saw $3 %seen. [ $+ [ $3 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $3 ] ] )) ago. $iif(%last.spoke. [ $+ [ $3 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $3 ] ],He left without saying anything!)&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:NICK:{&lt;br /&gt;
 if (%seen == off) { return }&lt;br /&gt;
 set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:kick:{&lt;br /&gt;
 if (%seen == off) { return }&lt;br /&gt;
 set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick &lt;br /&gt;
 set %seen.last. [ $+ [ $nick ] ] $ctime&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:JOIN:#:{&lt;br /&gt;
 if (%seen == off) { return }&lt;br /&gt;
 set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate &lt;br /&gt;
 set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:text:*:#:{&lt;br /&gt;
 if (%seen == off) { return }&lt;br /&gt;
 set %last.spoke. [ $+ [ $nick ] ] $1-&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:quit:{&lt;br /&gt;
 if (%seen == off) { return }&lt;br /&gt;
 set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate &lt;br /&gt;
 set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Script Archive]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1612</id>
		<title>!seen</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1612"/>
		<updated>2006-10-09T22:01:59Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pretty simple !seen script.&lt;br /&gt;
&lt;br /&gt;
 ;Seen script, pretty much self-explanatory.&lt;br /&gt;
 ;Syntax:&lt;br /&gt;
 ;/seen on/off&lt;br /&gt;
 ;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] &lt;br /&gt;
 ;Just add any words you don&#039;t want to be used.&lt;br /&gt;
 ;/msg #channel/bot !seen name&lt;br /&gt;
 ;* &lt;br /&gt;
 ; Ollie&lt;br /&gt;
 &lt;br /&gt;
 alias seen {&lt;br /&gt;
  if ($1 == del) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
   if (!$read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is not in the database. | return }&lt;br /&gt;
    write -dw $+ $2 funny.txt&lt;br /&gt;
    echo -a Removed: $+(&amp;quot;,$2,&amp;quot;,.) From the &#039;funny&#039; words list.&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  if ($1 == add) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
    if ($read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is already in the database. | return }&lt;br /&gt;
    write funny.txt $2&lt;br /&gt;
    echo -a Added: $+(&amp;quot;,$2,&amp;quot;,.) To the &#039;funny&#039; words list.&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  if ($1 == on) {&lt;br /&gt;
    echo -a Seen Status: On&lt;br /&gt;
    set %seen on&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  if ($1 == off) {&lt;br /&gt;
    echo -a Seen Status: Off&lt;br /&gt;
    set %seen off&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  echo -a Unknown parameter.&lt;br /&gt;
 }&lt;br /&gt;
 on *:text:!seen:*:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  var %target = $iif($chan,$chan,$nick)&lt;br /&gt;
  if ($3 == $nick) { &lt;br /&gt;
    describe %target hands $nick a mirror. &lt;br /&gt;
    return &lt;br /&gt;
  }&lt;br /&gt;
  if ($chan) &amp;amp;&amp;amp; ($3 ison $chan) { &lt;br /&gt;
    msg %target $3 Is in the channel! $iif(%last.spoke. [ $+ [ $3 ] ],His/her last words were: %last.spoke. [ $+ [ $3 ] ],They haven&#039;t spoken anything yet!&lt;br /&gt;
    ) &lt;br /&gt;
    return &lt;br /&gt;
  }&lt;br /&gt;
  if (!%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
    if ($read(funny.txt, w, $3)) { &lt;br /&gt;
      msg %target hoho. aren&#039;t you a funny one &lt;br /&gt;
      halt &lt;br /&gt;
    } &lt;br /&gt;
    if (!%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
      msg %target i have never seen $3 | return &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  if (%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
    msg %target I last saw $3 %seen. [ $+ [ $3 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $3 ] ] )) ago. $iif(%last.spoke. [ $+ [ $3 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $3 ] ],He left without saying anything!&lt;br /&gt;
    )&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:NICK:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:kick:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick &lt;br /&gt;
  set %seen.last. [ $+ [ $nick ] ] $ctime&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:JOIN:#:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate &lt;br /&gt;
  set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:text:*:#:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %last.spoke. [ $+ [ $nick ] ] $1-&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:quit:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate &lt;br /&gt;
  set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Script Archive]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Opmode&amp;diff=2083</id>
		<title>Opmode</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Opmode&amp;diff=2083"/>
		<updated>2006-10-09T21:59:54Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Forces the server to perform a /mode&lt;br /&gt;
&lt;br /&gt;
opmode #channel +/-&amp;lt;modes&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 opmode #moo +o Ollie&lt;br /&gt;
 &lt;br /&gt;
 * irc.server.org sets mode: +o Ollie&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you can use this command only if you are [[Oper|opered up]].&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
Take a look at {{Relatedraws|opmode}} to get more information about them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Oper commands]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Check&amp;diff=2082</id>
		<title>Check</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Check&amp;diff=2082"/>
		<updated>2006-10-09T21:55:59Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Displays detailed information about a user.&lt;br /&gt;
&lt;br /&gt;
check &amp;lt;nick&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 check Ollie&lt;br /&gt;
 &lt;br /&gt;
 Information for user Ollie&lt;br /&gt;
 &lt;br /&gt;
           Nick:: Ollie (ABACZ)&lt;br /&gt;
      Signed on:: Wed Sep 27 16:58:50 2006&lt;br /&gt;
      Timestamp:: Wed Sep 27 16:28:05 2006 (1159370885)&lt;br /&gt;
  User/Hostmask:: f@ke (127.0.0.1)&lt;br /&gt;
 Real User/Host:: Ollie@localhost&lt;br /&gt;
      Real Name:: Ollie&lt;br /&gt;
         Status:: IRC Operator&lt;br /&gt;
   Connected to:: irc.server.org&lt;br /&gt;
       Umode(s):: +oiwgh f@ke&lt;br /&gt;
     Channel(s):: #moo &lt;br /&gt;
 &lt;br /&gt;
          Ports:: 3787 -&amp;gt; 6667 (client -&amp;gt; server)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you can use this command only if you are [[Oper|opered up]].&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
Take a look at {{Relatedraws|check}} to get more information about them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Oper commands]]&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1611</id>
		<title>!seen</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=!seen&amp;diff=1611"/>
		<updated>2006-10-09T21:44:03Z</updated>

		<summary type="html">&lt;p&gt;Ollie: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pretty simple !seen script.&lt;br /&gt;
&lt;br /&gt;
 ;Seen script, pretty much self-explanatory.&lt;br /&gt;
 ;Syntax:&lt;br /&gt;
 ;/seen on/off&lt;br /&gt;
 ;/seen add/del (word) [This is to stop people trying to do stuff like, !seen penis, or something  stupid.] &lt;br /&gt;
 ;Just add any words you don&#039;t want to be used.&lt;br /&gt;
 ;/msg #channel/bot !seen name&lt;br /&gt;
 ;* &lt;br /&gt;
 ; Ollie&lt;br /&gt;
 &lt;br /&gt;
 alias seen {&lt;br /&gt;
  if ($1 == del) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
   if (!$read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is not in the database. | return }&lt;br /&gt;
    write -dw $+ $2 funny.txt&lt;br /&gt;
    echo -a Removed: $+(&amp;quot;,$2,&amp;quot;,.) From the &#039;funny&#039; words list.&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  if ($1 == add) &amp;amp;&amp;amp; ($2) {&lt;br /&gt;
    if ($read(funny.txt, w, $2)) { echo -a Error: $+(&amp;quot;,$2,&amp;quot;) is already in the database. | return }&lt;br /&gt;
    write funny.txt $2&lt;br /&gt;
    echo -a Added: $+(&amp;quot;,$2,&amp;quot;,.) To the &#039;funny&#039; words list.&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  if ($1 == on) {&lt;br /&gt;
    echo -a Seen Status: On&lt;br /&gt;
    set %seen on&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  if ($1 == off) {&lt;br /&gt;
    echo -a Seen Status: Off&lt;br /&gt;
    set %seen off&lt;br /&gt;
    return&lt;br /&gt;
  }&lt;br /&gt;
  echo -a Unknown parameter.&lt;br /&gt;
 }&lt;br /&gt;
 on *:text:!seen:*:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  var %target = $iif($chan,$chan,$nick)&lt;br /&gt;
  if ($3 == $nick) { &lt;br /&gt;
    describe %target hands $nick a mirror. &lt;br /&gt;
    return &lt;br /&gt;
  }&lt;br /&gt;
  if ($chan) &amp;amp;&amp;amp; ($3 ison $chan) { &lt;br /&gt;
    msg %target $3 Is in the channel! $iif(%last.spoke. [ $+ [ $3 ] ],His/her last words were: %last.spoke. [ $+ [ $3 ] ],They haven&#039;t spoken anything yet!&lt;br /&gt;
    ) &lt;br /&gt;
    return &lt;br /&gt;
  }&lt;br /&gt;
  if (!%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
    if ($read(funny.txt, w, $3)) { &lt;br /&gt;
      msg %target hoho. aren&#039;t you a funny one &lt;br /&gt;
      halt &lt;br /&gt;
    } &lt;br /&gt;
    if (!%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
      msg %target i have never seen $3 | return &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  if (%seen. [ $+ [ $3 ] ] ) { &lt;br /&gt;
    msg %target I last saw $3 %seen. [ $+ [ $3 ] ] That was $duration($calc($ctime - %seen.last. [ $+ [ $3 ] ] )) ago. $iif(%last.spoke. [ $+ [ $3 ] ],If i remember correctly.. his last words were: %last.spoke. [ $+ [ $3 ] ],He left without saying anything!&lt;br /&gt;
    )&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:NICK:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $nick ] ] ( $+ $address($nick,2) $+ ) changing his/her nickname to $newnick&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:kick:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $knick ] ] ( $+ $address($nick,2) $+ ) being kicked from $chan by $nick &lt;br /&gt;
  set %seen.last. [ $+ [ $nick ] ] $ctime&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:JOIN:#:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Joining channel $chan at $fulldate &lt;br /&gt;
  set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:text:*:#:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %last.spoke. [ $+ [ $nick ] ] $1-&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:quit:{&lt;br /&gt;
  if (%seen == off) { return }&lt;br /&gt;
  set %seen. [ $+ [ $nick ] ] $address($nick,2) Quitting at $fulldate &lt;br /&gt;
  set %seen.last. [ $+ [ $nick ] ] $ctime &lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Ollie</name></author>
	</entry>
</feed>