<?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=Vliedel</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=Vliedel"/>
	<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/Special:Contributions/Vliedel"/>
	<updated>2026-05-16T03:34:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Set&amp;diff=6024</id>
		<title>Set</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Set&amp;diff=6024"/>
		<updated>2013-10-25T19:10:50Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: better explanation of -z&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sets the value of %variable to the specified value.&lt;br /&gt;
 /set [-lsnzuN] &amp;lt;%variable&amp;gt; [value]&lt;br /&gt;
{| style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:10%&amp;quot; | &#039;&#039;&#039;&#039;&#039;Switch&#039;&#039;&#039;&#039;&#039; || Style=&amp;quot;width:90%&amp;quot; | &#039;&#039;&#039;&#039;&#039;Meaning&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| uN     || Unsets %var after N seconds, as long as %var isn&#039;t set again. If N is 0, it is unset when script finishes.&lt;br /&gt;
|-&lt;br /&gt;
| k     || Keeps the current -uN setting for a variable.&lt;br /&gt;
|-&lt;br /&gt;
| n      || Treats value as plain text.&lt;br /&gt;
|-&lt;br /&gt;
| z      || Decreases %var by 1 per second until it reaches zero, and then unsets it.&lt;br /&gt;
|-&lt;br /&gt;
| e      || Unsets the variable when mIRC exits.&lt;br /&gt;
|-&lt;br /&gt;
| l      || Sets %var as a local variable, same as using /[[var]] (Deprecated, use /var)&lt;br /&gt;
|-&lt;br /&gt;
| s      || Gives an output: * Set %var to value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
 set %fuu bar&lt;br /&gt;
 set %moo $+ %fuu 42&lt;br /&gt;
This will set &#039;&#039;%fuu&#039;&#039; to &#039;&#039;bar&#039;&#039; and then set &#039;&#039;%moobar&#039;&#039; to &#039;&#039;42&#039;&#039;, as the variable &#039;&#039;%fuu&#039;&#039; will first be evaluated to &#039;&#039;bar&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
 echo -a This is fuu: %fuu&lt;br /&gt;
&lt;br /&gt;
Will echo &#039;&#039;This is fuu: bar&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The variable %fuu is automatically evaluated in a /set or /var command when it is part of the variable name, however elsewhere the variable must be evaluated using either $eval or evaluation brackets, e.g.&lt;br /&gt;
 if (%moo [ $+ [ %fuu ] ] == 42)&lt;br /&gt;
 if ($($+(%,moo,%fuu),2) == 42)&lt;br /&gt;
&lt;br /&gt;
 set -u3 %fuu bar&lt;br /&gt;
This will set &#039;&#039;%fuu&#039;&#039; to &#039;&#039;bar&#039;&#039; and unset it after &#039;&#039;3&#039;&#039; seconds.&lt;br /&gt;
&lt;br /&gt;
 set -s %fuu 3&lt;br /&gt;
This will set &#039;&#039;%fuu&#039;&#039; to &#039;&#039;3&#039;&#039; and give an output to the active window: &#039;&#039;* Set %fuu to 3&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Var|/var]] sets a local variable.&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Unset|/unset]] unsets a variable.&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Unsetall|/unsetall]] unsets all variable from the variable list.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]][[Category:Variables]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Timer&amp;diff=6021</id>
		<title>Timer</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Timer&amp;diff=6021"/>
		<updated>2013-10-15T08:47:07Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: no numbers as timername!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Activates the specified timer to perform the specified command at a specified interval, and optionally at a specified time.&lt;br /&gt;
 /timer[N/name] [-ceomhipr] [time] &amp;lt;repetitions&amp;gt; &amp;lt;interval&amp;gt; &amp;lt;command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are not connected to a server and a timer is started, it will be an offline timer by default, meaning that it will continue to run whether you are connected to a server on not. If you are connected to a server while starting a timer, it will be an online timer, that will stop if you disconnect. You can make a timer being an offline timer by using the -o switch.&lt;br /&gt;
&lt;br /&gt;
To make a new timer, you can either use /timer without name/number or you can specify a name, without space between the command and the name (/timerfoo ...). If you do not specify a name/number, mIRC will get the first free timernumber it finds and use this.&lt;br /&gt;
&lt;br /&gt;
If you specify a delay of 0 seconds, the timer will trigger immediately after the calling script ends.&lt;br /&gt;
&lt;br /&gt;
You can also specify a time when the timer is supposed to trigger (see example below).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that if you specify 0 repetitions it will continue until you either stop it yourself or you disconnect, in case it is an online timer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that identifiers usually &#039;&#039;&#039;do not&#039;&#039;&#039; get re-evaluated during a timer (see example below). To force this, you have to use an exclamation mark after the &#039;&#039;$&#039;&#039; of an identifier (e.g. [[$time|$!time]] or [[$me|$!me]])&lt;br /&gt;
&lt;br /&gt;
You can &#039;&#039;&#039;stop&#039;&#039;&#039; a timer by using &#039;&#039;/timer&amp;lt;name|N&amp;gt; off&#039;&#039;, which will also be able to handle wildcards in the name (see example below).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use the following switches:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| width=&amp;quot;10%&amp;quot; | &#039;&#039;&#039;&#039;&#039;Switch&#039;&#039;&#039;&#039;&#039; || width=&amp;quot;90%&amp;quot; | &#039;&#039;&#039;&#039;&#039;Explanation&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; | c || will make mIRC &amp;quot;catch up&amp;quot; a timer by executing it more than once during one interval if the real-time interval isn&#039;t matching your requested interval.&lt;br /&gt;
|-&lt;br /&gt;
| m / h || indicates that the interval delay is in milliseconds.&lt;br /&gt;
|-&lt;br /&gt;
| h || make a high-resolution multimedia timer (uses system resources heavily)&lt;br /&gt;
|-&lt;br /&gt;
| e || will executes the command associated with the specified timer name (works with wildcard names too).&lt;br /&gt;
|-&lt;br /&gt;
| p || will pause a timer&lt;br /&gt;
|-&lt;br /&gt;
| r || will resume a timer&lt;br /&gt;
|-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; | i || will make a timer dynamically associate with whatever happens to be the active connection. If a server window is closed, the timer is associated with the next available server window.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
In the following, we&#039;ll always create an [[alias]] to be able to execute commands directly after creating the timer.&lt;br /&gt;
&lt;br /&gt;
 alias timertest {&lt;br /&gt;
  timer 2 2 [[echo]] -a moo!&lt;br /&gt;
 }&lt;br /&gt;
This alias just creates an timer that will echo &#039;&#039;moo!&#039;&#039; to your active window two times with a delay of 2 seconds.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 alias timertest {&lt;br /&gt;
  timercorrect 2 10 echo -a [[$asctime|$!asctime]]&lt;br /&gt;
  timerwrong 2 10 echo -a $asctime&lt;br /&gt;
 }&lt;br /&gt;
Here we create two timers, one with forcing it to re-evaluate the identifier (the one on top), the other not. You will see the first always echoing the current time, the other always echoing the time when it was started.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 alias timertest {&lt;br /&gt;
  timermilli -m 10 50 echo -a The difference is 50 milliseconds.&lt;br /&gt;
 }&lt;br /&gt;
This timer called milli will echo &#039;&#039;The difference is 50 milliseconds.&#039;&#039; every 0,05 seconds to your active window, all in all 10 times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 alias timertest {&lt;br /&gt;
  timertime 14:00 1 1 echo -a It is 14:00 o&#039;clock.&lt;br /&gt;
 }&lt;br /&gt;
This one will echo &#039;&#039;It is 14:00 o&#039;clock.&#039;&#039; to the active window when it is 14oclock, as we made the timer trigger then.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 timer1* off&lt;br /&gt;
We just stop all timers beginning with a 1.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
When using {, } and | in timers they will get evaluated before setting the timer so it is always advisable to avoid stacking commands inside of a timer.&lt;br /&gt;
&lt;br /&gt;
Best practise would be to never try and stack commands inside a timer, instead create an alias with the commands you wish to run and start a timer to execute the alias.&lt;br /&gt;
 timer 1 5 showme&lt;br /&gt;
 alias showme {&lt;br /&gt;
   if ($true) {&lt;br /&gt;
     echo -ag My name is $mnick&lt;br /&gt;
     echo -ag And I eat fish.&lt;br /&gt;
   }&lt;br /&gt;
   echo -ag That go moo!&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Although it should be avoided where ever possible it is possible to stack commands using [[$chr]](124) as the command delimiter.&lt;br /&gt;
 timer 1 5 echo -ag My name is $mnick $chr(124) echo -ag And I eat fish.&lt;br /&gt;
 ;;This will start a timer like this:&lt;br /&gt;
 * Timer 1 1 time(s) 5s delay echo -ag My name is Dana | echo -ag And I eat fish. (QuakeNet)&lt;br /&gt;
It is also possible to use $chr(123) and $chr(125) instead of { and } for stacking commands in an if-then-else.&lt;br /&gt;
 timer 1 5 if ([[$true]]) $chr(123) echo -ag My name is $mnick $chr(124) echo -ag And I eat fish. $chr(125) $chr(124) echo -ag That go moo!&lt;br /&gt;
 ;;This will start a timer like this:&lt;br /&gt;
 * Timer 1 1 time(s) 5s delay if ([[$true]]) { echo -ag My name is Dana | echo -ag And I eat fish. } | echo -ag That go moo! (QuakeNet)&lt;br /&gt;
&lt;br /&gt;
Take extra care when using the TIME switch with repeats. The time option is only used for setting the timer. Here is details of how the previously mentioned timed timer initiates.&lt;br /&gt;
 timer 14:00 1 1 echo -a It is 14:00 o&#039;clock.&lt;br /&gt;
 ;When when the time is 14:00, start a timer which runs once with a delay at 1 second.&lt;br /&gt;
 ;The result would be at 14:00:01 the echo would be displayed.&lt;br /&gt;
 &lt;br /&gt;
 timer 14:00 0 1 echo -a It is 14:00 o&#039;clock.&lt;br /&gt;
 ;When when the time is 14:00, start a timer which runs continually every second.&lt;br /&gt;
 ;The result would be at 14:00:01,14:00:02,14:00:03,14:00:04,14:00:05,... the echo would be displayed.&lt;br /&gt;
 &lt;br /&gt;
 ;If you wish to run a timer every day there is two options, either set the with a delay of one day or restart the timer.&lt;br /&gt;
 timer 14:00 0 [[$duration]](1day) echo -a It&#039;s 14:00!&lt;br /&gt;
 ;Using the above timer the echo would &#039;&#039;not&#039;&#039; run today but the duration amount 1day/86400 seconds after.&lt;br /&gt;
 ;To overcome that you can either set two timers like this:&lt;br /&gt;
 timer 14:00 0 $duration(1day) echo -a It&#039;s 14:00!&lt;br /&gt;
 timer 14:00 1 0 echo -a It&#039;s 14:00!&lt;br /&gt;
 ;Or if you&#039;re using an alias reinitialise the timer.&lt;br /&gt;
 timer 14:00 1 0 showTime&lt;br /&gt;
 alias showTime {&lt;br /&gt;
   .timer 14:00 1 1 showTime&lt;br /&gt;
   echo -a It&#039;s 14:00!&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Avoid&#039;&#039;&#039;&#039;&#039; using timer [time] 0 0 as this is almost certainly going to be a mistake.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[timers|/timers]] to stop all timers, take a look at.&lt;br /&gt;
* [[$timer]] to get information about a timer.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;br /&gt;
[[Category:Timer Commands and Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=QuakeNet&amp;diff=5753</id>
		<title>QuakeNet</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=QuakeNet&amp;diff=5753"/>
		<updated>2011-07-19T09:11:22Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#Redirect [[:Category:Quakenet]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Quakenet&amp;diff=5752</id>
		<title>Quakenet</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Quakenet&amp;diff=5752"/>
		<updated>2011-07-19T09:11:00Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[:Category:Quakenet]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Quakenet&amp;diff=5751</id>
		<title>Quakenet</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Quakenet&amp;diff=5751"/>
		<updated>2011-07-19T09:09:45Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Category:Quakenet]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=User:Vliedel&amp;diff=5726</id>
		<title>User:Vliedel</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=User:Vliedel&amp;diff=5726"/>
		<updated>2011-04-24T11:58:03Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: that was pretty much incorrect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Babel-2|nl|en-3}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[[Image:Boskabouter.jpg]]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
  &amp;lt;table border=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Age&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;26&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;tr valign=&amp;quot;top&amp;quot; height=&amp;quot;40&amp;quot;&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Country&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;The Netherlands&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Words of wisdom&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;with wisdom only you can&#039;t survive&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
[[Category:Members]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=If-Then-Else&amp;diff=5724</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=5724"/>
		<updated>2011-04-07T13:21:09Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: execute F, not return F&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
* Note: This is a reference. For a tutorial please see the [[basic control tutorial]].&lt;br /&gt;
The If-then-else statement allows you to compare values and execute different parts of a script based on that comparison. This is a basic structure for any script that includes anything more than one-liners!&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 skip the rest&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 C, D and E were false, execute F&lt;br /&gt;
 G               If A and B were false and G is true, execute this&lt;br /&gt;
 H               If A, B and G were all false, execute H&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;
 [[#&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;
 [[#!=|!]]         negation operator (!= is opposite of == and !isin is &amp;quot;is not in&amp;quot;)&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;
This isn&#039;t actually an operator, but a combination of two operators ! and =. And actually, = isn&#039;t an operator either, but in mIRC scripting it can be used instead of == and it works just the way == works. In most mIRC scripts you only see !=, which actually shouldn&#039;t be used. Instead, !== should be used to negate ==.&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 false since !== is the same as !=&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;
 if (!$away)       ;Returns $true if you are NOT away ($away returns $false and ! negates it to $true).&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 multiple of 9.&lt;br /&gt;
Multiples 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 multiple of 9.&lt;br /&gt;
\\ is the negate of //&lt;br /&gt;
&lt;br /&gt;
=== &amp;amp; ===&lt;br /&gt;
 if (N1 &amp;amp; N2) ; This will compare the bits that are [[$biton|turned on]] in the decimal N1 AND N2 in the same way [[$and]]() would.&lt;br /&gt;
As long as N1 and N2 share atleast 1 bit the condition is returned as true.&lt;br /&gt;
&lt;br /&gt;
 if (13 &amp;amp; 11) ;Is true, see the table below for explanation.&lt;br /&gt;
 echo -ag $and(13,11) ;returns 9.&lt;br /&gt;
&lt;br /&gt;
If you break down 13 and 11 into their bits as below:&lt;br /&gt;
{|class=&amp;quot;gallery&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:100px&amp;quot; | &#039;&#039;&#039;&#039;&#039;Binary&#039;&#039;&#039;&#039;&#039; || &#039;&#039;&#039;&#039;&#039;Value&#039;&#039;&#039;&#039;&#039; &lt;br /&gt;
|-&lt;br /&gt;
| 1101      || 13&lt;br /&gt;
|-&lt;br /&gt;
| 1011      || 11 &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1px dotted #2f6fab; color: Black;&amp;quot; | 1001      || style=&amp;quot;border:1px dotted #2f6fab; color: Black;&amp;quot; | 9 &lt;br /&gt;
|}&lt;br /&gt;
 if (11 &amp;amp; 4) ;Is false.&lt;br /&gt;
 echo -ag $and(11,4) ;returns 0.&lt;br /&gt;
{|class=&amp;quot;gallery&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:100px&amp;quot; | &#039;&#039;&#039;&#039;&#039;Binary&#039;&#039;&#039;&#039;&#039; || &#039;&#039;&#039;&#039;&#039;Value&#039;&#039;&#039;&#039;&#039; &lt;br /&gt;
|-&lt;br /&gt;
| 1011      || 11 &lt;br /&gt;
|-&lt;br /&gt;
| 0100      || 4&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border:1px dotted #2f6fab; color: Black;&amp;quot; | 0000      || style=&amp;quot;border:1px dotted #2f6fab; color: Black;&amp;quot; | 0&lt;br /&gt;
|}&lt;br /&gt;
Above you can see, 13 and 11 both have the first bit AND fourth bit on, so the statement is true. The binary 1001 value has a decimal value of 9.&lt;br /&gt;
Also you can see, 11 and 4 do not share any common bits, so the statement is false.&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. Note the $( ), it is needed to prevent mirc treat this statement as bitwise comparison.&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 or equal to 10&lt;br /&gt;
 if ($1 isnum 20-30)  ;Returns true if $1 is a number between 20 and 30 inclusive&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. Note that you need to be in the same channel to use this.&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. Note that you need to be in the same channel to use this.&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. Note also that you need to be in the same channel to use this.&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. Note that you need to be in the same channel to use this.&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. Note that you need to be in the same channel to use this.&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- contains only uppercase letters. So ABCD returns true, but even one lowercase letter makes it return false.&lt;br /&gt;
&lt;br /&gt;
====&#039;&#039;Use parenthesis correctly&#039;&#039;====&lt;br /&gt;
(A) || (B) &amp;amp;&amp;amp; (C) &amp;lt;- logical order for this is to check if either one of A or B is true, and C is true, but if you wish to check that B and C must be true, or A is true, you&#039;ll need to do (A) || ((B) &amp;amp;&amp;amp; (C))&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 the content of a text file, use [[$read]] to search through a file via its search switches.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[$v1]] &amp;amp; [[$v1|$v2]] - These identifiers allow you to retrieve the values of the last if condition.&lt;br /&gt;
* [[Basic control tutorial]] - An in depth tutorial on how to use these statements&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Auth-Update2&amp;diff=5706</id>
		<title>Auth-Update2</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Auth-Update2&amp;diff=5706"/>
		<updated>2011-03-30T12:31:49Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: new version: fixed delay timing, wait for server reply, copy known auths when joining a chan&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This snippet is a new version of [[Auth-Update|Auth_update]]&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH_UPDATE2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;&lt;br /&gt;
 ;  by Vliedel -- #vliedel @ QuakeNet&lt;br /&gt;
 ;  version 2.3  (written and tested on mIRC 6.35)&lt;br /&gt;
 ;  made for networks supporting WHOX&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;What does this script do?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - updates the auths of nicks and stores them in a hash table&lt;br /&gt;
 ;  - if a channel is too big, /who nick1,nick2,nick3 etc is done untill the auths for the channel is updated&lt;br /&gt;
 ;  - users who have a site with the auth in it will be saved without a /who&lt;br /&gt;
 ;    ie: &amp;quot;Vliedel&amp;quot; in &amp;quot;Vliedel.users.quakenet.org&amp;quot; will be treated as auth on the QuakeNet network&lt;br /&gt;
 ;  - users who are not authed (auth 0) will be checked every x time to see if they are authed yet&lt;br /&gt;
 ;  - script updates from largest to the smallest channel&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;How to use this script?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - config the options below&lt;br /&gt;
 ;  - /load -rs1 auth_update2.mrc to load the script (make sure the script it loaded on top)&lt;br /&gt;
 ;  - script starts on load or on join&lt;br /&gt;
 ;  - to get the auth of a nick use: $auth(nick) or $auth(nick,cid)&lt;br /&gt;
 ;  - to get a nick from an auth use: $auth-nick(auth) or $auth-nick(auth,cid)&lt;br /&gt;
 ;  - to recheck a nick that was not authed by command use: /auth.update &amp;lt;nick&amp;gt;&lt;br /&gt;
 ;    note that rechecking is done automatically, only use this command if you really want to recheck quickly&lt;br /&gt;
 ;  - this script should be loaded as last script in your list for optimal usage&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - You can use the following example script to see when a nicks auth is updated&lt;br /&gt;
 ;      on *:SIGNAL:authupdate.new:{&lt;br /&gt;
 ;        if (!$2) { echo -ag $1 is not authed }&lt;br /&gt;
 ;        else { echo -ag $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - The following signal is send when a requested auth is updated (with /auth.update &amp;lt;nick&amp;gt;)&lt;br /&gt;
 ;      on *:SIGNAL:authupdate.req:{&lt;br /&gt;
 ;        if ($2 == $null) { echo -ag requested: $1 is not on a common chan }&lt;br /&gt;
 ;        elseif ($2 == 0) { echo -ag requested: $1 is not authed }&lt;br /&gt;
 ;        else { echo -ag requested: $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;    Note that these signals return $2 == $null when someone isn&#039;t on a common channel.&lt;br /&gt;
 ;    This may occur for example when someone parted a channel between the /who and the who reply.&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Why is this script good?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - compared with my first auth_update, this script uses less resources, at the cost of a little bit more traffic&lt;br /&gt;
 ;  - sending /who chan for every channel is not needed and goes slow (lag)&lt;br /&gt;
 ;  - sending /who chan on join may cause Excess Flood or Max sendQ exceeded&lt;br /&gt;
 ;  - sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results (Max sendQ exceeded)&lt;br /&gt;
 ;  - unauthed users can auth without you knowing, so you need to check if they&#039;re authed every so many time.&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Since some people do not understand how to use this script on join, here is an example:&lt;br /&gt;
 ;&lt;br /&gt;
 ;  on *:JOIN:#:{&lt;br /&gt;
 ;    newuser $chan $nick&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;&lt;br /&gt;
 ;  ; $1 = nick   $2 = auth&lt;br /&gt;
 ;  on *:SIGNAL:authupdate.new:{&lt;br /&gt;
 ;    if (*.users.quakenet.org iswm $ial($1)) { return }&lt;br /&gt;
 ;    var %i = 1&lt;br /&gt;
 ;    while ($comchan($1,%i)) {&lt;br /&gt;
 ;      newuser $v1 $1&lt;br /&gt;
 ;      inc %i&lt;br /&gt;
 ;    }&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;&lt;br /&gt;
 ;  ; $1 = chan   $2 = nick&lt;br /&gt;
 ;  alias -l newuser {&lt;br /&gt;
 ;    var %auth = $auth($2)&lt;br /&gt;
 ;    if (%auth) { echo 4 -tg $1 $2 is authed as %auth }&lt;br /&gt;
 ;    elseif (%auth == 0) { echo 4 -tg $1 $2 is not authed }&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETTINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; maximum number of replies in a WHO, too high may cause &#039;Max sendQ exceeded&#039; disconnection&lt;br /&gt;
 ; too low may take the script a long time to update the auths, 1000 should be fine for most situations&lt;br /&gt;
 [[alias]] -l max.replies { [[return]] 1000 }&lt;br /&gt;
 &lt;br /&gt;
 ; maximum length of the /who &amp;lt;string&amp;gt;, too long may cause the server to ignore the command&lt;br /&gt;
 ; too low may slow things down, 400 should be fine in most cases&lt;br /&gt;
 [[alias]] -l max.len { [[return]] 400 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum time (seconds) between two /who commands (default 10)&lt;br /&gt;
 [[alias]] -l delay { [[return]] 10 }&lt;br /&gt;
 &lt;br /&gt;
 ; time (seconds) between the checking if any unauthed users should be rechecked (default 120)&lt;br /&gt;
 [[alias]] -l queue.delay { [[return]] 120 }&lt;br /&gt;
 &lt;br /&gt;
 ; time (seconds) to recheck if an unauthed user is now authed (default 600)&lt;br /&gt;
 [[alias]] -l queue.check { [[return]] 600 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum ratio of (nicks with unknown auth) / (total nicks) in a channel to do /who #channel rather then /who nick,nick, (default 0.09)&lt;br /&gt;
 [[alias]] -l min.ratio { [[return]] 0.09 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum nr of nicks with unknown auth in a channel to do /who #channel rather then /who nick,nick, (default 10)&lt;br /&gt;
 [[alias]] -l min.nicks { [[return]] 10 }&lt;br /&gt;
 &lt;br /&gt;
 ; The networks the script is supposed to work on (case sensitive)&lt;br /&gt;
 ; NOTE that the script ONLY works on networks supporting WHOX (ircu 2.10.* should work)&lt;br /&gt;
 [[alias]] -l used.network {&lt;br /&gt;
   [[return]] [[$istokcs]](QuakeNet UnderNet GameSurge HanIRC NetGamers OGameNet,[[$network]],32)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; For every network a check to see if a user has a site where his authname is in&lt;br /&gt;
 ; $1 is the site&lt;br /&gt;
 [[alias]] -l auth.in.site {&lt;br /&gt;
   [[Local_Variables|var]] %n = [[$network]]&lt;br /&gt;
   [[If-Then-Else|if]] (%n === QuakeNet) { [[return]] [[$iif]](*.users.quakenet.org iswm [[$1-|$1]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === UnderNet) { [[return]] [[$iif]](*.users.undernet.org iswm [[$1-|$1]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === GameSurge) { [[return]] [[$iif]](*.*.GameSurge iswm [[$1-|$1]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === HanIRC) { [[return]] [[$iif]](*.users.HanIRC.org iswm [[$1-|$1]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === NetGamers) { [[return]] [[$iif]](*.users.netgamers.org iswm [[$1-|$1]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === OGameNet) { [[return]] [[$iif]](*.user.OGameNet iswm [[$1-|$1]],[[$true]]) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; For every network the method to return the auth from the site&lt;br /&gt;
 ; $1 is the site&lt;br /&gt;
 [[alias]] -l auth.from.site {&lt;br /&gt;
   [[Local_Variables|var]] %n = [[$network]]&lt;br /&gt;
   [[If-Then-Else|if]] (%n === QuakeNet) { [[return]] [[$gettok]]([[$1-|$1]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === UnderNet) { [[return]] [[$gettok]]([[$1-|$1]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === GameSurge) { [[return]] [[$gettok]]([[$1-|$1]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === HanIRC) { [[return]] [[$gettok]]([[$1-|$1]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === NetGamers) { [[return]] [[$gettok]]([[$1-|$1]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%n === OGameNet) { [[return]] [[$gettok]]([[$1-|$1]],1,46) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $auth(nick [,cid])  returns the auth of the nick&lt;br /&gt;
 [[alias]] auth {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$isid]]) { [[$iif]]([[$show]],.auth,auth) [[$1-|$1-]] | [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) || ([[$1-|$2]] !== [[$null]] &amp;amp;&amp;amp; (![[$scid]]([[$1-|$2]]) || ![[$1-|$2]])) { [[return]] }&lt;br /&gt;
   [[return]] [[$gettok]]([[$hget]]([[$iif]]([[$1-|$2]],[[$1-|$2]],[[$cid]]) [[DollarPlus|$+]] .auths,[[DollarPlus|$+]](auth.,[[$comchan]]([[$1-|$1]],1),[[$chr]](44),[[$1-|$1]])),1,32)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $auth-nick(auth [,cid])  returns the first nick with that auth&lt;br /&gt;
 [[alias]] auth-nick {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) || ([[$1-|$2]] !== [[$null]] &amp;amp;&amp;amp; (![[$scid]]([[$1-|$2]]) || ![[$1-|$2]])) { [[return]] }&lt;br /&gt;
   [[return]] [[$gettok]]([[$hfind]]([[$iif]]([[$1-|$2]],[[$1-|$2]],[[$cid]]) [[DollarPlus|$+]] .auths,[[$1-|$1]],1,n).data,-1,44)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; /auth.update nick&lt;br /&gt;
 [[alias]] auth.update {&lt;br /&gt;
   [[If-Then-Else|if]] (!$used.network) || (![[$comchan]]([[$1-|$1]],1)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %t = [[$cid]] [[DollarPlus|$+]] .auths , %a = [[$hget]](%t,[[DollarPlus|$+]](auth.,[[$comchan]]([[$1-|$1]],1),[[$chr]](44),[[$1-|$1]]))&lt;br /&gt;
   [[If-Then-Else|if]] (0 * iswm %a) { [[hdel]] -w %t [[DollarPlus|$+]](auth.,*,[[$chr]](44),[[$1-|$1]]) }&lt;br /&gt;
   [[If-Then-Else|if]] (!%a) || (0 * iswm %a) { au.update n [[$1-|$1]] | [[hadd]] %t req. [[DollarPlus|$+]] [[$1-|$1]] 1 }&lt;br /&gt;
   [[If-Then-Else|else]] { .[[signal]] authupdate.req [[$1-|$1]] %a }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AU.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = t/n/c/r/d (timer nick chan repeat delay)&lt;br /&gt;
 ; [$1- = n nick]&lt;br /&gt;
 [[alias]] -l au.update {&lt;br /&gt;
   [[Local_Variables|var]] %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%t)) { [[hmake]] %t }&lt;br /&gt;
   [[Local_Variables|var]] %tim = au.update.delay. [[DollarPlus|$+]] [[$cid]] , %w = [[$hget]](%t,who) , %l = [[$hget]](%t,wholock)&lt;br /&gt;
   ; when not called by repeat or delay, we probably have something to /who&lt;br /&gt;
   [[If-Then-Else|if]] (([[$1-|$1]] != r) &amp;amp;&amp;amp; ([[$1-|$1]] != d)) { [[hadd]] %t who 1 }&lt;br /&gt;
   ; if we&#039;re waiting for reply, don&#039;t set timer or /who&lt;br /&gt;
   [[If-Then-Else|if]] (%l) { [[return]] }&lt;br /&gt;
   ; if called by delay timer and we probably have something to /who, then /who&lt;br /&gt;
   [[If-Then-Else|if]] (([[$1-|$1]] == d) &amp;amp;&amp;amp; (%w)) { au.who | [[return]] }&lt;br /&gt;
   ; if delay timer hasn&#039;t been set already, we want to /who or set the timer&lt;br /&gt;
   [[If-Then-Else|if]] (!$timer(%tim)) {&lt;br /&gt;
     ; if we just joined a chan or just finished a /who, then set delay timer&lt;br /&gt;
     [[If-Then-Else|if]] (([[$1-|$1]] == c) || ([[$1-|$1]] == r)) { .[[timer]] [[DollarPlus|$+]] %tim 1 $delay au.update d }&lt;br /&gt;
     [[If-Then-Else|else]] { au.who [[$iif]]([[$1-|$1]] == n,[[$1-|$2]]) }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NICKLIST CHANGING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on ^*:JOIN:#:{&lt;br /&gt;
   [[Local_Variables|var]] %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
   [[If-Then-Else|if]] (!$used.network) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == [[$me]]) {&lt;br /&gt;
     au.start&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%t)) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hfind]](%t,[[DollarPlus|$+]](auth.*,[[$chr]](44),[[$nick_(remote)|$nick]]),1,w)) { [[hadd]] %t [[DollarPlus|$+]](auth.,[[$chan_(remote)|$chan]],[[$chr]](44),[[$nick_(remote)|$nick]]) [[$hget]](%t,[[$v1]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ($auth.in.site($site)) { au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
   [[If-Then-Else|else]] { au.update n [[$nick_(remote)|$nick]] }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;366 Vliedel #vliedel :End of /NAMES list.&lt;br /&gt;
 RAW 366:*:{&lt;br /&gt;
   [[Local_Variables|var]] %c = [[$1-|$2]], %i = [[$nick_(nick)|$nick(]]%c,0), %w = auth.* [[DollarPlus|$+]] [[$chr]](44), %it = [[DollarPlus|$+]](auth.,%c,[[$chr]](44)), %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]]%c,%i)&lt;br /&gt;
     [[If-Then-Else|if]] ([[$hfind]](%t,%w [[DollarPlus|$+]] %n,1,w)) {&lt;br /&gt;
       [[tokenize]] 32 [[$hget]](%t,[[$v1]])&lt;br /&gt;
       [[hadd]] %t %it [[DollarPlus|$+]] %n [[$1-|$1]] [[$iif]]([[$1-|$2]],%c) [[$1-|$3]]&lt;br /&gt;
     }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   au.update c&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:PART:#:{ au.part [[$chan_(remote)|$chan]] [[$nick_(remote)|$nick]] | au.upd.nick [[$nick_(remote)|$nick]] $site [[$chan_(remote)|$chan]] }&lt;br /&gt;
 on *:KICK:#:{ au.part [[$chan_(remote)|$chan]] $knick | au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = chan   $2 = nick&lt;br /&gt;
 [[alias]] -l au.part {&lt;br /&gt;
   [[Local_Variables|var]] %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%t)) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$2]] == [[$me]]) {&lt;br /&gt;
     [[hdel]] -w %t auth. [[DollarPlus|$+]] [[$chan_(remote)|$chan]] [[DollarPlus|$+]] ,*&lt;br /&gt;
     [[hdel]] %t ctime. [[DollarPlus|$+]] [[$chan_(remote)|$chan]]&lt;br /&gt;
     [[Local_Variables|var]] %i = [[$hfind]](%t,req.*,0,w)&lt;br /&gt;
     [[while]] (%i) {&lt;br /&gt;
       [[Local_Variables|var]] %it = [[$hfind]](%t,req.*,%i,w) , %n = [[$gettok]](%it,2,46)&lt;br /&gt;
       [[If-Then-Else|if]] (%n ison [[$1-|$1]]) &amp;amp;&amp;amp; (![[$comchan]](%n,2)) { [[hdel]] %t %it | .[[signal]] authupdate.req %n }&lt;br /&gt;
       [[dec]] %i&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     [[hdel]] %t [[DollarPlus|$+]](auth.,[[$1-|$1]],[[$chr]](44),[[$1-|$2]])&lt;br /&gt;
     [[If-Then-Else|if]] ([[$hget]](%t,req. [[DollarPlus|$+]] [[$1-|$2]])) &amp;amp;&amp;amp; (![[$comchan]]([[$1-|$2]],2)) { [[hdel]] %t req. [[DollarPlus|$+]] [[$1-|$2]] | .[[signal]] authupdate.req [[$1-|$2]] }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:QUIT:{&lt;br /&gt;
   [[Local_Variables|var]] %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%t)) { [[return]] }&lt;br /&gt;
   [[hdel]] -w %t [[DollarPlus|$+]](auth.,*,[[$chr]](44),[[$nick_(remote)|$nick]])&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%t,req. [[DollarPlus|$+]] [[$nick_(remote)|$nick]])) { [[hdel]] %t req. [[DollarPlus|$+]] [[$nick_(remote)|$nick]] | .[[signal]] authupdate.req [[$nick_(remote)|$nick]] }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NICK:{&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]($newnick,0) , %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
   [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == $newnick) || (![[$hget]](%t)) { [[return]] }&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %it = [[DollarPlus|$+]](auth.,[[$comchan]]($newnick,%i),[[$chr]](44))&lt;br /&gt;
     [[$iif]]([[$hget]](%t,%it [[DollarPlus|$+]] [[$nick_(remote)|$nick]]),hadd,hdel) %t %it [[DollarPlus|$+]] $newnick [[$v1]]&lt;br /&gt;
     [[hdel]] %t %it [[DollarPlus|$+]] [[$nick_(remote)|$nick]]&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%t,req. [[DollarPlus|$+]] [[$nick_(remote)|$nick]])) { [[hadd]] %t req. [[DollarPlus|$+]] $newnick 1 | [[hdel]] %t req. [[DollarPlus|$+]] [[$nick_(remote)|$nick]] }&lt;br /&gt;
   [[If-Then-Else|if]] ($auth.in.site($site)) { au.upd.nick $newnick $site }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AU.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; [$1 = nick]&lt;br /&gt;
 [[alias]] -l au.who {&lt;br /&gt;
   [[Local_Variables|var]] %t = [[$cid]] [[DollarPlus|$+]] .auths , %t2 = [[$cid]] [[DollarPlus|$+]] .au.who&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%t2)) { [[hfree]] %t2 }&lt;br /&gt;
   [[hmake]] %t2&lt;br /&gt;
   [[hdel]] %t who&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]]) {&lt;br /&gt;
     [[Local_Variables|var]] %who = [[$1-|$1]] [[DollarPlus|$+]] ,,, [[DollarPlus|$+]] 137&lt;br /&gt;
     [[hadd]] %t2 -mask %who&lt;br /&gt;
     [[hadd]] %t wholock 1&lt;br /&gt;
     who %who n%nat,137&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0) , %sort , %ticks = [[$ticks]]&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %sort = %sort [[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%i),0) [[DollarPlus|$+]] . [[DollarPlus|$+]] %i&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[Local_Variables|var]] %sort = [[$sorttok]](%sort,32,n) , %i = [[$numtok]](%sort,32) , %maxlen = $max.len , %n.max = $max.replies  , %time = [[$calc]]([[$ctime]] - $queue.check) , %ids , %n.w , %len, %chans&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %c = [[$comchan]]([[$me]],[[$gettok]]([[$gettok]](%sort,%i,32),2,46)) , %n.0 = [[$hfind]](%t,0 %c &amp;amp;,0,w).data , %n.c = [[$nick_(nick)|$nick(]]%c,0)&lt;br /&gt;
     [[Local_Variables|var]] %n.l = [[$calc]](%n.c - [[$hfind]](%t,[[DollarPlus|$+]](auth.,%c,[[$chr]](44),*),0,w) + [[$iif]](%time &amp;lt; [[$hget]](%t,ctime. [[DollarPlus|$+]] %c),0,%n.0))&lt;br /&gt;
     [[If-Then-Else|if]] ([[$calc]](%len + [[$len]](%c) +1) &amp;gt; %maxlen) || ([[$calc]](%n.w + %n.c) &amp;gt; %n.max) { [[dec]] %i | [[continue]] }&lt;br /&gt;
     [[If-Then-Else|if]] (%n.l &amp;gt; 1) &amp;amp;&amp;amp; ((%n.l &amp;gt;= $min.nicks) || ([[$calc]](%n.l / %n.c) &amp;gt;= $min.ratio)) {&lt;br /&gt;
       [[Local_Variables|var]] %chans = %chans %c&lt;br /&gt;
       [[hadd]] %t ctime. [[DollarPlus|$+]] %c [[$ctime]]&lt;br /&gt;
       [[Local_Variables|var]] %j = [[$nick_(nick)|$nick(]]%c,0)&lt;br /&gt;
       [[while]] (%j) {&lt;br /&gt;
         [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]]%c,%j)&lt;br /&gt;
         [[If-Then-Else|if]] (![[$hget]](%t2,%n)) { [[hadd]] %t2 %n 1 | [[inc]] %n.w }&lt;br /&gt;
         [[dec]] %j&lt;br /&gt;
       }&lt;br /&gt;
       [[inc]] %len [[$calc]]([[$len]](%c) +1)&lt;br /&gt;
     }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0) , %nicks&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %c = [[$comchan]]([[$me]],%i)&lt;br /&gt;
     [[If-Then-Else|if]] (![[$istok]](%chans,%c,32)) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$calc]]([[$nick_(nick)|$nick(]]%c,0) - [[$hfind]](%t,[[DollarPlus|$+]](auth.,%c,[[$chr]](44),*),0,w)) &amp;gt; 0) {&lt;br /&gt;
         [[Local_Variables|var]] %j = [[$nick_(nick)|$nick(]]%c,0)&lt;br /&gt;
         [[while]] (%j) {&lt;br /&gt;
           [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]]%c,%j)&lt;br /&gt;
           [[If-Then-Else|if]] ([[$calc]](%len + [[$len]](%n) +1) &amp;gt; %maxlen) { [[goto]] end }&lt;br /&gt;
           [[Local_Variables|var]] %val = [[$hget]](%t,[[DollarPlus|$+]](auth.,%c,[[$chr]](44),%n))&lt;br /&gt;
           [[If-Then-Else|if]] (![[$hget]](%t2,%n)) &amp;amp;&amp;amp; ((%val == [[$null]]) || ([[$gettok]](%val,3,32) &amp;lt; %time)) { [[Local_Variables|var]] %nicks = %nicks %n | [[hadd]] %t2 %n 1 | [[inc]] %n.w | [[inc]] %len [[$len]](%n) }&lt;br /&gt;
           [[If-Then-Else|if]] (%n.w &amp;gt;= %n.max) { [[goto]] end }&lt;br /&gt;
           [[dec]] %j&lt;br /&gt;
         }&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[Local_Variables|var]] %j = [[$hfind]](%t,0 %c &amp;amp;,0,w).data&lt;br /&gt;
         [[while]] (%j) {&lt;br /&gt;
           [[Local_Variables|var]] %it = [[$hfind]](%t,0 %c &amp;amp;,%j,w).data , %n = [[$gettok]](%it,2,44)&lt;br /&gt;
           [[If-Then-Else|if]] ([[$calc]](%len + [[$len]](%n) +1) &amp;gt; %maxlen) { [[goto]] end }&lt;br /&gt;
           [[If-Then-Else|if]] (![[$hget]](%t2,%n)) &amp;amp;&amp;amp; ([[$gettok]]([[$hget]](%t,%it),3,32) &amp;lt; %time) &amp;amp;&amp;amp; (auth.* iswm %it) { [[Local_Variables|var]] %nicks = %nicks %n | [[hadd]] %t2 %n 1 | [[inc]] %n.w | [[inc]] %len [[$len]](%n) }&lt;br /&gt;
           [[If-Then-Else|if]] (%n.w &amp;gt;= %n.max) { [[goto]] end }&lt;br /&gt;
           [[dec]] %j&lt;br /&gt;
         }&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   :end&lt;br /&gt;
   [[Local_Variables|var]] %who = [[$replace]](%chans %nicks,[[$chr]](32),[[$chr]](44))&lt;br /&gt;
   [[If-Then-Else|if]] (%who) {&lt;br /&gt;
     [[Local_Variables|var]] %who = %who [[DollarPlus|$+]] ,,, [[DollarPlus|$+]] 137&lt;br /&gt;
     [[hadd]] %t2 -mask %who&lt;br /&gt;
     [[hadd]] %t wholock 1&lt;br /&gt;
     who %who n%nat,137&lt;br /&gt;
     [[If-Then-Else|if]] (%len &amp;gt; [[$calc]](%maxlen * 0.7)) || (%n.w &amp;gt; [[$calc]](%n.max * 0.7)) { [[hadd]] %t who 1 }&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] { au.update r }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW REPLIES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; RAW 354 SPECIAL WHO REPLY&lt;br /&gt;
 ; 354 &amp;lt;you&amp;gt;   &amp;lt;nr&amp;gt;  &amp;lt;nick&amp;gt;  &amp;lt;auth&amp;gt;&lt;br /&gt;
 ; 354 Vliedel 137   sy      rry&lt;br /&gt;
 RAW 354:&amp;amp; 137 &amp;amp; &amp;amp;:{&lt;br /&gt;
   [[haltdef]]&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$3]],0) , %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%t,req. [[DollarPlus|$+]] [[$1-|$3]])) { [[hdel]] %t req. [[DollarPlus|$+]] [[$1-|$3]] | .[[signal]] authupdate.req [[$1-|$3]] [[$iif]](%i,[[$1-|$4]]) }&lt;br /&gt;
   [[If-Then-Else|if]] (!%i) || (![[$hget]](%t)) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$gettok]]([[$hget]](%t,[[DollarPlus|$+]](auth.,[[$comchan]]([[$1-|$3]],1),[[$chr]](44),[[$1-|$3]])),1,32) !== [[$1-|$4]]) { .[[signal]] authupdate.new [[$1-|$3]] [[$1-|$4]] }&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %c = [[$comchan]]([[$1-|$3]],%i)&lt;br /&gt;
     [[hadd]] %t [[DollarPlus|$+]](auth.,%c,[[$chr]](44),[[$1-|$3]]) [[$1-|$4]] [[$iif]](![[$1-|$4]],%c [[$ctime]])&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; RAW 315 WHO END&lt;br /&gt;
 ; 315 &amp;lt;you&amp;gt;    &amp;lt;requested&amp;gt;      :End of /who list.&lt;br /&gt;
 ; 315 Vliedel  #vliedel,,,137   :End of /WHO list.&lt;br /&gt;
 RAW 315:&amp;amp; *,,,137 end of /WHO list.: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$cid]] [[DollarPlus|$+]] .au.who,-mask) == [[$1-|$2]]) {&lt;br /&gt;
     [[Local_Variables|var]] %who = [[$left]]([[$1-|$2]],-6) , %i = [[$wildtok]](%who,#*,0,44) , %t = [[$cid]] [[DollarPlus|$+]] .auths&lt;br /&gt;
     [[while]] (%i) {&lt;br /&gt;
       [[hadd]] %t ctime. [[DollarPlus|$+]] [[$wildtok]](%who,#*,%i,44) [[$ctime]]&lt;br /&gt;
       [[dec]] %i&lt;br /&gt;
     }&lt;br /&gt;
     [[hfree]] [[$cid]] [[DollarPlus|$+]] .au.who&lt;br /&gt;
     [[hdel]] %t wholock&lt;br /&gt;
     au.update r&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; STARTING AND STOPPING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:LOAD:{ scon -at1 au.load l }&lt;br /&gt;
 [[alias]] -l au.load {&lt;br /&gt;
   au.stop&lt;br /&gt;
   au.start&lt;br /&gt;
   au.update t&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l au.stop {&lt;br /&gt;
   .[[timer]] [[DollarPlus|$+]] au.update. [[DollarPlus|$+]] [[$cid]] off&lt;br /&gt;
   .[[timer]] [[DollarPlus|$+]] au.update.delay. [[DollarPlus|$+]] [[$cid]] off&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$cid]] [[DollarPlus|$+]] .auths)) { [[hfree]] [[$v1]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$cid]] [[DollarPlus|$+]] .au.who)) { [[hfree]] [[$v1]] }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l au.start {&lt;br /&gt;
   [[If-Then-Else|if]] (!$used.network) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]]([[$cid]] [[DollarPlus|$+]] .auths)) { [[hmake]] [[$cid]] [[DollarPlus|$+]] .auths }&lt;br /&gt;
   [[If-Then-Else|if]] (!$timer(au.update. [[DollarPlus|$+]] [[$cid]])) { .[[timer]] [[DollarPlus|$+]] au.update. [[DollarPlus|$+]] [[$cid]] 0 $queue.delay au.update t }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:DISCONNECT:{ au.stop }&lt;br /&gt;
 on *:UNLOAD:{ scon -a au.stop }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on ^*:TEXT:*:*:{ au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 on ^*:ACTION:*:*:{ au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 on ^*:NOTICE:*:*:{ au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 on ^*:RAWMODE:#:{ au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 on ^*:TOPIC:#:{ au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 on ^*:INVITE:#:{ au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 [[CTCP]] *:*:*:{ au.upd.nick [[$nick_(remote)|$nick]] $site }&lt;br /&gt;
 RAW 352:&amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; *:{ au.upd.nick [[$1-|$6]] [[$1-|$4]] }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = nick   $2 = site   [ $3 = chan (exclude it)]&lt;br /&gt;
 [[alias]] -l au.upd.nick {&lt;br /&gt;
   [[If-Then-Else|if]] (!$auth.in.site([[$1-|$2]])) || (![[$hget]]([[$cid]] [[DollarPlus|$+]] .auths)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0) , %t = [[$cid]] [[DollarPlus|$+]] .auths , %au = $auth.from.site([[$1-|$2]])&lt;br /&gt;
   [[If-Then-Else|if]] (!%i) || (%i == 1 &amp;amp;&amp;amp; [[$1-|$3]]) || ([[$hget]](%t,[[DollarPlus|$+]](auth.,[[$comchan]]([[$1-|$1]],1),[[$chr]](44),[[$1-|$1]])) == %au) { [[return]] }&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$comchan]]([[$1-|$1]],%i) !== [[$1-|$3]]) { [[hadd]] %t [[DollarPlus|$+]](auth.,[[$v1]],[[$chr]](44),[[$1-|$1]]) %au }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   .[[signal]] authupdate.new [[$1-|$1]] %au&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; USED DATA/TIMERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; TABLE &amp;lt;cid&amp;gt;.auths&lt;br /&gt;
 ;auth.&amp;lt;chan&amp;gt;,&amp;lt;nick&amp;gt; --&amp;gt; &amp;lt;auth&amp;gt; [chan ctime]&lt;br /&gt;
 ;req.&amp;lt;nick&amp;gt;         --&amp;gt; 1&lt;br /&gt;
 ;ctime.&amp;lt;chan&amp;gt;       --&amp;gt; &amp;lt;ctime&amp;gt;&lt;br /&gt;
 ;who                --&amp;gt; &amp;lt;1/null&amp;gt;&lt;br /&gt;
 ;wholock            --&amp;gt; &amp;lt;1/null&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 ; TABLE &amp;lt;cid&amp;gt;.au.who&lt;br /&gt;
 ; nick   --&amp;gt; 1&lt;br /&gt;
 ; -mask  --&amp;gt; /who string&lt;br /&gt;
 &lt;br /&gt;
 ; TIMER au.update.delay.&amp;lt;cid&amp;gt;&lt;br /&gt;
 ; TIMER au.update.&amp;lt;cid&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Archive]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Auth-Update2&amp;diff=5675</id>
		<title>Auth-Update2</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Auth-Update2&amp;diff=5675"/>
		<updated>2011-03-10T15:17:00Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: /load -rs1 to make sure the script is on top&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This snippet is a new version of [[Auth-Update|Auth_update]]&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH_UPDATE2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;&lt;br /&gt;
 ;  by Vliedel -- #vliedel @ QuakeNet&lt;br /&gt;
 ;  version 1.2  (written and tested on mIRC 6.35)&lt;br /&gt;
 ;  made for networks supporting WHOX&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;What does this script do?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - updates the auths of nicks and stores them in a hash table&lt;br /&gt;
 ;  - if a channel is too big, /who nick1,nick2,nick3 etc is done untill the auths for the channel is updated&lt;br /&gt;
 ;  - users who have a site with the auth in it will be saved without a /who&lt;br /&gt;
 ;    ie: &amp;quot;Vliedel&amp;quot; in &amp;quot;Vliedel.users.quakenet.org&amp;quot; will be treated as auth on the QuakeNet network&lt;br /&gt;
 ;  - users who are not authed (auth 0) will be checked every x time to see if they are authed yet&lt;br /&gt;
 ;  - script updates from largest to the smallest channel&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;How to use this script?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - config the options below&lt;br /&gt;
 ;  - /load -rs1 auth_update2.mrc to load the script&lt;br /&gt;
 ;  - script starts on load or on join&lt;br /&gt;
 ;  - to get the auth of a nick use: $auth(nick) or $auth(nick,cid)&lt;br /&gt;
 ;  - to get a nick from an auth use: $auth-nick(auth) or $auth-nick(auth,cid)&lt;br /&gt;
 ;  - to recheck a nick that was not authed by command use: /auth.update &amp;lt;nick&amp;gt;&lt;br /&gt;
 ;    note that rechecking is done automatically, only use this command if you really want to recheck quickly&lt;br /&gt;
 ;  - this script should be loaded as last script in your list for optimal usage&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - You can use the following example script to see when a nicks auth is updated&lt;br /&gt;
 ;      on *:SIGNAL:authupdate.new:{&lt;br /&gt;
 ;        if (!$2) { echo -ag $1 is not authed }&lt;br /&gt;
 ;        else { echo -ag $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - The following signal is send when a requested auth is updated (with /auth.update &amp;lt;nick&amp;gt;)&lt;br /&gt;
 ;      on *:SIGNAL:authupdate.req:{&lt;br /&gt;
 ;        if ($2 == $null) { echo -ag requested: $1 is not on a common chan }&lt;br /&gt;
 ;        elseif ($2 == 0) { echo -ag requested: $1 is not authed }&lt;br /&gt;
 ;        else { echo -ag requested: $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;    Note that these signals return $2 == $null when someone isn&#039;t on a common channel.&lt;br /&gt;
 ;    This may occur for example when someone parted a channel between the /who and the who reply.&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Why is this script good?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - compared with my first auth_update, this script uses less resources, at the cost of a little bit more traffic&lt;br /&gt;
 ;  - sending /who chan for every channel is not needed and goes slow (lag)&lt;br /&gt;
 ;  - sending /who chan on join may cause Excess Flood or Max sendQ exceeded&lt;br /&gt;
 ;  - sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results (Max sendQ exceeded)&lt;br /&gt;
 ;  - unauthed users can auth without you knowing, so you need to check if they&#039;re authed every so many time.&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Since some people do not understand how to use this script on join, here is an example:&lt;br /&gt;
 ;&lt;br /&gt;
 ;  on *:JOIN:#:{&lt;br /&gt;
 ;    newuser $chan $nick&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;  &lt;br /&gt;
 ;  ; $1 = nick   $2 = auth&lt;br /&gt;
 ;  on *:SIGNAL:authupdate.new:{&lt;br /&gt;
 ;    if (*.users.quakenet.org iswm $ial($1)) { return }&lt;br /&gt;
 ;    var %i = 1&lt;br /&gt;
 ;    while ($comchan($1,%i)) {&lt;br /&gt;
 ;      newuser $v1 $1&lt;br /&gt;
 ;      inc %i&lt;br /&gt;
 ;    }&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;  &lt;br /&gt;
 ;  ; $1 = chan   $2 = nick&lt;br /&gt;
 ;  alias -l newuser {&lt;br /&gt;
 ;    var %auth = $auth($2)&lt;br /&gt;
 ;    if (%auth) { echo 4 -tg $1 $2 is authed as %auth }&lt;br /&gt;
 ;    elseif (%auth == 0) { echo 4 -tg $1 $2 is not authed }&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETTINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; maximum number of replies in a WHO, too high may cause &#039;Max sendQ exceeded&#039; disconnection&lt;br /&gt;
 ; too low may take the script a long time to update the auths, 1000 should be fine for most situations&lt;br /&gt;
 alias -l max.replies { return 1000 }&lt;br /&gt;
 &lt;br /&gt;
 ; maximum length of the /who &amp;lt;string&amp;gt;, too long may cause the server to ignore the command&lt;br /&gt;
 ; too low may slow things down, 400 should be fine in most cases&lt;br /&gt;
 alias -l max.len { return 400 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum time (seconds) between two /who commands (default 10)&lt;br /&gt;
 alias -l delay { return 10 }&lt;br /&gt;
 &lt;br /&gt;
 ; time (seconds) between the checking if any unauthed users should be rechecked (default 120)&lt;br /&gt;
 alias -l queue.delay { return 120 }&lt;br /&gt;
 &lt;br /&gt;
 ; time (seconds) to recheck if an unauthed user is now authed (default 600)&lt;br /&gt;
 alias -l queue.check { return 600 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum ratio of (nicks with unknown auth) / (total nicks) in a channel to do /who #channel rather then /who nick,nick, (default 0.09)&lt;br /&gt;
 alias -l min.ratio { return 0.09 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum nr of nicks with unknown auth in a channel to do /who #channel rather then /who nick,nick, (default 10)&lt;br /&gt;
 alias -l min.nicks { return 10 }&lt;br /&gt;
 &lt;br /&gt;
 ; The networks the script is supposed to work on (case sensitive)&lt;br /&gt;
 ; NOTE that the script ONLY works on networks supporting WHOX (ircu 2.10.* should work)&lt;br /&gt;
 alias -l used.network {&lt;br /&gt;
   return $istokcs(QuakeNet UnderNet GameSurge HanIRC NetGamers OGameNet,$network,32)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; For every network a check to see if a user has a site where his authname is in&lt;br /&gt;
 ; $1 is the site&lt;br /&gt;
 alias -l auth.in.site {&lt;br /&gt;
   var %n = $network&lt;br /&gt;
   if (%n === QuakeNet) { return $iif(*.users.quakenet.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === UnderNet) { return $iif(*.users.undernet.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === GameSurge) { return $iif(*.*.GameSurge iswm $1,$true) }&lt;br /&gt;
   elseif (%n === HanIRC) { return $iif(*.users.HanIRC.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === NetGamers) { return $iif(*.users.netgamers.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === OGameNet) { return $iif(*.user.OGameNet iswm $1,$true) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; For every network the method to return the auth from the site&lt;br /&gt;
 ; $1 is the site&lt;br /&gt;
 alias -l auth.from.site {&lt;br /&gt;
   var %n = $network&lt;br /&gt;
   if (%n === QuakeNet) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === UnderNet) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === GameSurge) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === HanIRC) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === NetGamers) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === OGameNet) { return $gettok($1,1,46) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $auth(nick [,cid])  returns the auth of the nick&lt;br /&gt;
 alias auth {&lt;br /&gt;
   if (!$isid) { $iif($show,.auth,auth) $1- | return }&lt;br /&gt;
   if ($1 == $null) || ($2 !== $null &amp;amp;&amp;amp; (!$scid($2) || !$2)) { return }&lt;br /&gt;
   return $gettok($hget($iif($2,$2,$cid) $+ .auths,$+(auth.,$comchan($1,1),$chr(44),$1)),1,32)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $auth-nick(auth [,cid])  returns the first nick with that auth&lt;br /&gt;
 alias auth-nick {&lt;br /&gt;
   if ($1 == $null) || ($2 !== $null &amp;amp;&amp;amp; (!$scid($2) || !$2)) { return }&lt;br /&gt;
   return $gettok($hfind($iif($2,$2,$cid) $+ .auths,$1,1,n).data,-1,44)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
  &lt;br /&gt;
 ; /auth.update nick&lt;br /&gt;
 alias auth.update {&lt;br /&gt;
   if (!$used.network) || (!$comchan($1,1)) { return }&lt;br /&gt;
   var %t = $cid $+ .auths , %a = $hget(%t,$+(auth.,$comchan($1,1),$chr(44),$1))&lt;br /&gt;
   if (0 * iswm %a) { hdel -w %t $+(auth.,*,$chr(44),$1) }&lt;br /&gt;
   if (!%a) || (0 * iswm %a) { au.update n $1 | hadd %t req. $+ $1 1 }&lt;br /&gt;
   else { .signal authupdate.req $1 %a }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AU.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = t/n/c/r (timer nick chan repeat)&lt;br /&gt;
 ; [$1- = n nick]&lt;br /&gt;
 alias -l au.update {&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$hget(%t)) { hmake %t }&lt;br /&gt;
   var %tim = au.update.delay. $+ $cid , %d = $hget(%t,delay)&lt;br /&gt;
   if ($ctimer == %tim) &amp;amp;&amp;amp; ($1 !== r) { hadd -u $+ $delay %t delay 1 | au.who | return }&lt;br /&gt;
   if (!%d) || ($1 == r) { hadd -u $+ $delay %t delay 1 }&lt;br /&gt;
   if ((!$timer(%tim) &amp;amp;&amp;amp; (%d || $1 == c)) || $1 == r) { .timer $+ %tim 1 $delay au.update }&lt;br /&gt;
   if (!%d &amp;amp;&amp;amp; !$timer(%tim) &amp;amp;&amp;amp; $1 !== c &amp;amp;&amp;amp; $1 !== r) { au.who $iif($1 == n,$2) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NICKLIST CHANGING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on ^*:JOIN:#:{&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$used.network) { return }&lt;br /&gt;
   if ($nick == $me) { au.start | au.update c | return }&lt;br /&gt;
   if (!$hget(%t)) { return }&lt;br /&gt;
   if ($hfind(%t,$+(auth.*,$chr(44),$nick),1,w)) { hadd %t $+(auth.,$chan,$chr(44),$nick) $hget(%t,$v1) }&lt;br /&gt;
   elseif ($auth.in.site($site)) { au.upd.nick $nick $site }&lt;br /&gt;
   else { au.update n $nick }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:PART:#:{ au.part $chan $nick | au.upd.nick $nick $site $chan }&lt;br /&gt;
 on *:KICK:#:{ au.part $chan $knick | au.upd.nick $nick $site }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = chan   $2 = nick&lt;br /&gt;
 alias -l au.part {&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$hget(%t)) { return }&lt;br /&gt;
   if ($2 == $me) {&lt;br /&gt;
     hdel -w %t auth. $+ $chan $+ ,*&lt;br /&gt;
     hdel %t ctime. $+ $chan&lt;br /&gt;
     var %i = $hfind(%t,req.*,0,w)&lt;br /&gt;
     while (%i) {&lt;br /&gt;
       var %it = $hfind(%t,req.*,%i,w) , %n = $gettok(%it,2,46)&lt;br /&gt;
       if (%n ison $1) &amp;amp;&amp;amp; (!$comchan(%n,2)) { hdel %t %it | .signal authupdate.req %n }&lt;br /&gt;
       dec %i&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   else {&lt;br /&gt;
     hdel %t $+(auth.,$1,$chr(44),$2)&lt;br /&gt;
     if ($hget(%t,req. $+ $2)) &amp;amp;&amp;amp; (!$comchan($2,2)) { hdel %t req. $+ $2 | .signal authupdate.req $2 }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:QUIT:{&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$hget(%t)) { return }&lt;br /&gt;
   hdel -w %t $+(auth.,*,$chr(44),$nick)&lt;br /&gt;
   if ($hget(%t,req. $+ $nick)) { hdel %t req. $+ $nick | .signal authupdate.req $nick }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NICK:{&lt;br /&gt;
   var %i = $comchan($newnick,0) , %t = $cid $+ .auths&lt;br /&gt;
   if ($nick == $newnick) || (!$hget(%t)) { return }&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %it = $+(auth.,$comchan($newnick,%i),$chr(44))&lt;br /&gt;
     $iif($hget(%t,%it $+ $nick),hadd,hdel) %t %it $+ $newnick $v1&lt;br /&gt;
     hdel %t %it $+ $nick&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   if ($hget(%t,req. $+ $nick)) { hadd %t req. $+ $newnick 1 | hdel %t req. $+ $nick }&lt;br /&gt;
   if ($auth.in.site($site)) { au.upd.nick $newnick $site }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AU.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; [$1 = nick]&lt;br /&gt;
 alias -l au.who {&lt;br /&gt;
   var %t2 = $cid $+ .au.who&lt;br /&gt;
   if ($hget(%t2)) { hfree %t2 }&lt;br /&gt;
   hmake %t2&lt;br /&gt;
   if ($1) {&lt;br /&gt;
     var %who = $1 $+ ,,, $+ 137&lt;br /&gt;
     hadd %t2 -mask %who&lt;br /&gt;
     who %who n%nat,137&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   var %i = $comchan($me,0) , %t = $cid $+ .auths , %sort , %ticks = $ticks&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %sort = %sort $nick($comchan($me,%i),0) $+ . $+ %i&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   var %sort = $sorttok(%sort,32,n) , %i = $numtok(%sort,32) , %maxlen = $max.len , %n.max = $max.replies  , %time = $calc($ctime - $queue.check) , %ids , %n.w , %len&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %c = $comchan($me,$gettok($gettok(%sort,%i,32),2,46)) , %n.0 = $hfind(%t,0 %c &amp;amp;,0,w).data , %n.c = $nick(%c,0)&lt;br /&gt;
     var %n.l = $calc(%n.c - $hfind(%t,$+(auth.,%c,$chr(44),*),0,w) + $iif(%time &amp;lt; $hget(%t,ctime. $+ %c),0,%n.0))&lt;br /&gt;
     if ($calc(%len + $len(%c) +1) &amp;gt; %maxlen) || ($calc(%n.w + %n.c) &amp;gt; %n.max) { dec %i | continue }&lt;br /&gt;
     if (%n.l &amp;gt; 1) &amp;amp;&amp;amp; ((%n.l &amp;gt;= $min.nicks) || ($calc(%n.l / %n.c) &amp;gt;= $min.ratio)) {&lt;br /&gt;
       var %chans = %chans %c&lt;br /&gt;
       hadd %t ctime. $+ %c $ctime&lt;br /&gt;
       var %j = $nick(%c,0)&lt;br /&gt;
       while (%j) {&lt;br /&gt;
         var %n = $nick(%c,%j)&lt;br /&gt;
         if (!$hget(%t2,%n)) { hadd %t2 %n 1 | inc %n.w }&lt;br /&gt;
         dec %j&lt;br /&gt;
       }&lt;br /&gt;
       inc %len $calc($len(%c) +1)&lt;br /&gt;
     }&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   var %i = $comchan($me,0) , %nicks&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %c = $comchan($me,%i)&lt;br /&gt;
     if (!$istok(%chans,%c,32)) {&lt;br /&gt;
       if ($calc($nick(%c,0) - $hfind(%t,$+(auth.,%c,$chr(44),*),0,w)) &amp;gt; 0) {&lt;br /&gt;
         var %j = $nick(%c,0)&lt;br /&gt;
         while (%j) {&lt;br /&gt;
           var %n = $nick(%c,%j)&lt;br /&gt;
           if ($calc(%len + $len(%n) +1) &amp;gt; %maxlen) { goto end }&lt;br /&gt;
           var %val = $hget(%t,$+(auth.,%c,$chr(44),%n))&lt;br /&gt;
           if (!$hget(%t2,%n)) &amp;amp;&amp;amp; ((%val == $null) || ($gettok(%val,3,32) &amp;lt; %time)) { var %nicks = %nicks %n | hadd %t2 %n 1 | inc %n.w | inc %len $len(%n) }&lt;br /&gt;
           if (%n.w &amp;gt;= %n.max) { goto end }&lt;br /&gt;
           dec %j&lt;br /&gt;
         }&lt;br /&gt;
       }&lt;br /&gt;
       else {&lt;br /&gt;
         var %j = $hfind(%t,0 %c &amp;amp;,0,w).data&lt;br /&gt;
         while (%j) {&lt;br /&gt;
           var %it = $hfind(%t,0 %c &amp;amp;,%j,w).data , %n = $gettok(%it,2,44)&lt;br /&gt;
           if ($calc(%len + $len(%n) +1) &amp;gt; %maxlen) { goto end }&lt;br /&gt;
           if (!$hget(%t2,%n)) &amp;amp;&amp;amp; ($gettok($hget(%t,%it),3,32) &amp;lt; %time) &amp;amp;&amp;amp; (auth.* iswm %it) { var %nicks = %nicks %n | hadd %t2 %n 1 | inc %n.w | inc %len $len(%n) }&lt;br /&gt;
            if (%n.w &amp;gt;= %n.max) { goto end }&lt;br /&gt;
           dec %j&lt;br /&gt;
         }&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   :end&lt;br /&gt;
   var %who = $replace(%chans %nicks,$chr(32),$chr(44))&lt;br /&gt;
   if (%who) {&lt;br /&gt;
     var %who = %who $+ ,,, $+ 137&lt;br /&gt;
     hadd %t2 -mask %who&lt;br /&gt;
     who %who n%nat,137&lt;br /&gt;
     if (%len &amp;gt; $calc(%maxlen * 0.7)) || (%n.w &amp;gt; $calc(%n.max * 0.7)) { au.update r }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW REPLIES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; RAW 354 SPECIAL WHO REPLY&lt;br /&gt;
 ; 354 &amp;lt;you&amp;gt;   &amp;lt;nr&amp;gt;  &amp;lt;nick&amp;gt;  &amp;lt;auth&amp;gt;&lt;br /&gt;
 ; 354 Vliedel 137   sy      rry&lt;br /&gt;
 RAW 354:&amp;amp; 137 &amp;amp; &amp;amp;:{&lt;br /&gt;
   haltdef&lt;br /&gt;
   var %i = $comchan($3,0) , %t = $cid $+ .auths&lt;br /&gt;
   if ($hget(%t,req. $+ $3)) { hdel %t req. $+ $3 | .signal authupdate.req $3 $iif(%i,$4) }&lt;br /&gt;
   if (!%i) || (!$hget(%t)) { return }&lt;br /&gt;
   if ($gettok($hget(%t,$+(auth.,$comchan($3,1),$chr(44),$3)),1,32) !== $4) { .signal authupdate.new $3 $4 }&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %c = $comchan($3,%i)&lt;br /&gt;
     hadd %t $+(auth.,%c,$chr(44),$3) $4 $iif(!$4,%c $ctime)&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; RAW 315 WHO END&lt;br /&gt;
 ; 315 &amp;lt;you&amp;gt;    &amp;lt;requested&amp;gt;      :End of /who list.&lt;br /&gt;
 ; 315 Vliedel  #vliedel,,,137   :End of /WHO list.&lt;br /&gt;
 RAW 315:&amp;amp; *,,,137 end of /WHO list.: {&lt;br /&gt;
   if ($hget($cid $+ .au.who,-mask) == $2) {&lt;br /&gt;
     var %who = $left($2,-6) , %i = $wildtok(%who,#*,0,44) , %t = $cid $+ .auths&lt;br /&gt;
     while (%i) {&lt;br /&gt;
       hadd %t ctime. $+ $wildtok(%who,#*,%i,44) $ctime&lt;br /&gt;
       dec %i&lt;br /&gt;
     }&lt;br /&gt;
     hfree $cid $+ .au.who&lt;br /&gt;
   }&lt;br /&gt;
   haltdef&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; STARTING AND STOPPING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:LOAD:{ scon -at1 au.load l }&lt;br /&gt;
 alias -l au.load {&lt;br /&gt;
   au.stop&lt;br /&gt;
   au.start&lt;br /&gt;
   au.update t&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 alias -l au.stop {&lt;br /&gt;
   .timer $+ au.update. $+ $cid off&lt;br /&gt;
   .timer $+ au.update.delay. $+ $cid off&lt;br /&gt;
   if ($hget($cid $+ .auths)) { hfree $v1 }&lt;br /&gt;
   if ($hget($cid $+ .au.who)) { hfree $v1 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 alias -l au.start {&lt;br /&gt;
   if (!$used.network) { return }&lt;br /&gt;
   if (!$hget($cid $+ .auths)) { hmake $cid $+ .auths }&lt;br /&gt;
   if (!$timer(au.update. $+ $cid)) { .timer $+ au.update. $+ $cid 0 $queue.delay au.update t }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:DISCONNECT:{ au.stop }&lt;br /&gt;
 on *:UNLOAD:{ scon -a au.stop }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on ^*:TEXT:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:ACTION:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:NOTICE:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:RAWMODE:#:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:TOPIC:#:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:INVITE:#:{ au.upd.nick $nick $site }&lt;br /&gt;
 CTCP *:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 RAW 352:&amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; *: { au.upd.nick $6 $4 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = nick   $2 = site   [ $3 = chan (exclude it)]&lt;br /&gt;
 alias -l au.upd.nick {&lt;br /&gt;
   if (!$auth.in.site($2)) || (!$hget($cid $+ .auths)) { return }&lt;br /&gt;
   var %i = $comchan($1,0) , %t = $cid $+ .auths , %au = $auth.from.site($2)&lt;br /&gt;
   if (!%i) || (%i == 1 &amp;amp;&amp;amp; $3) || ($hget(%t,$+(auth.,$comchan($1,1),$chr(44),$1)) == %au) { return }&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     if ($comchan($1,%i) !== $3) { hadd %t $+(auth.,$v1,$chr(44),$1) %au }&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   .signal authupdate.new $1 %au&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; USED DATA/TIMERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; TABLE &amp;lt;cid&amp;gt;.auths&lt;br /&gt;
 ;auth.&amp;lt;chan&amp;gt;,&amp;lt;nick&amp;gt; --&amp;gt; &amp;lt;auth&amp;gt; [chan ctime]&lt;br /&gt;
 ;req.&amp;lt;nick&amp;gt;         --&amp;gt; 1&lt;br /&gt;
 ;ctime.&amp;lt;chan&amp;gt;       --&amp;gt; &amp;lt;ctime&amp;gt;&lt;br /&gt;
 ;delay              --&amp;gt; &amp;lt;1/0/null&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 ; TABLE &amp;lt;cid&amp;gt;.au.who&lt;br /&gt;
 ; nick   --&amp;gt; 1&lt;br /&gt;
 ; -mask  --&amp;gt; /who string&lt;br /&gt;
 &lt;br /&gt;
 ; TIMER au.update.delay.&amp;lt;cid&amp;gt;&lt;br /&gt;
 ; TIMER au.update.&amp;lt;cid&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Archive]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Auth-Update2&amp;diff=5674</id>
		<title>Auth-Update2</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Auth-Update2&amp;diff=5674"/>
		<updated>2011-03-10T15:16:02Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: added on join example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This snippet is a new version of [[Auth-Update|Auth_update]]&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH_UPDATE2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;&lt;br /&gt;
 ;  by Vliedel -- #vliedel @ QuakeNet&lt;br /&gt;
 ;  version 1.2  (written and tested on mIRC 6.35)&lt;br /&gt;
 ;  made for networks supporting WHOX&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;What does this script do?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - updates the auths of nicks and stores them in a hash table&lt;br /&gt;
 ;  - if a channel is too big, /who nick1,nick2,nick3 etc is done untill the auths for the channel is updated&lt;br /&gt;
 ;  - users who have a site with the auth in it will be saved without a /who&lt;br /&gt;
 ;    ie: &amp;quot;Vliedel&amp;quot; in &amp;quot;Vliedel.users.quakenet.org&amp;quot; will be treated as auth on the QuakeNet network&lt;br /&gt;
 ;  - users who are not authed (auth 0) will be checked every x time to see if they are authed yet&lt;br /&gt;
 ;  - script updates from largest to the smallest channel&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;How to use this script?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - config the options below&lt;br /&gt;
 ;  - /load -rs auth_update2.mrc to load the script&lt;br /&gt;
 ;  - script starts on load or on join&lt;br /&gt;
 ;  - to get the auth of a nick use: $auth(nick) or $auth(nick,cid)&lt;br /&gt;
 ;  - to get a nick from an auth use: $auth-nick(auth) or $auth-nick(auth,cid)&lt;br /&gt;
 ;  - to recheck a nick that was not authed by command use: /auth.update &amp;lt;nick&amp;gt;&lt;br /&gt;
 ;    note that rechecking is done automatically, only use this command if you really want to recheck quickly&lt;br /&gt;
 ;  - this script should be loaded as last script in your list for optimal usage&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - You can use the following example script to see when a nicks auth is updated&lt;br /&gt;
 ;      on *:SIGNAL:authupdate.new:{&lt;br /&gt;
 ;        if (!$2) { echo -ag $1 is not authed }&lt;br /&gt;
 ;        else { echo -ag $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - The following signal is send when a requested auth is updated (with /auth.update &amp;lt;nick&amp;gt;)&lt;br /&gt;
 ;      on *:SIGNAL:authupdate.req:{&lt;br /&gt;
 ;        if ($2 == $null) { echo -ag requested: $1 is not on a common chan }&lt;br /&gt;
 ;        elseif ($2 == 0) { echo -ag requested: $1 is not authed }&lt;br /&gt;
 ;        else { echo -ag requested: $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;    Note that these signals return $2 == $null when someone isn&#039;t on a common channel.&lt;br /&gt;
 ;    This may occur for example when someone parted a channel between the /who and the who reply.&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Why is this script good?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - compared with my first auth_update, this script uses less resources, at the cost of a little bit more traffic&lt;br /&gt;
 ;  - sending /who chan for every channel is not needed and goes slow (lag)&lt;br /&gt;
 ;  - sending /who chan on join may cause Excess Flood or Max sendQ exceeded&lt;br /&gt;
 ;  - sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results (Max sendQ exceeded)&lt;br /&gt;
 ;  - unauthed users can auth without you knowing, so you need to check if they&#039;re authed every so many time.&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Since some people do not understand how to use this script on join, here is an example:&lt;br /&gt;
 ;&lt;br /&gt;
 ;  on *:JOIN:#:{&lt;br /&gt;
 ;    newuser $chan $nick&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;  &lt;br /&gt;
 ;  ; $1 = nick   $2 = auth&lt;br /&gt;
 ;  on *:SIGNAL:authupdate.new:{&lt;br /&gt;
 ;    if (*.users.quakenet.org iswm $ial($1)) { return }&lt;br /&gt;
 ;    var %i = 1&lt;br /&gt;
 ;    while ($comchan($1,%i)) {&lt;br /&gt;
 ;      newuser $v1 $1&lt;br /&gt;
 ;      inc %i&lt;br /&gt;
 ;    }&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;  &lt;br /&gt;
 ;  ; $1 = chan   $2 = nick&lt;br /&gt;
 ;  alias -l newuser {&lt;br /&gt;
 ;    var %auth = $auth($2)&lt;br /&gt;
 ;    if (%auth) { echo 4 -tg $1 $2 is authed as %auth }&lt;br /&gt;
 ;    elseif (%auth == 0) { echo 4 -tg $1 $2 is not authed }&lt;br /&gt;
 ;  }&lt;br /&gt;
 ;&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETTINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; maximum number of replies in a WHO, too high may cause &#039;Max sendQ exceeded&#039; disconnection&lt;br /&gt;
 ; too low may take the script a long time to update the auths, 1000 should be fine for most situations&lt;br /&gt;
 alias -l max.replies { return 1000 }&lt;br /&gt;
 &lt;br /&gt;
 ; maximum length of the /who &amp;lt;string&amp;gt;, too long may cause the server to ignore the command&lt;br /&gt;
 ; too low may slow things down, 400 should be fine in most cases&lt;br /&gt;
 alias -l max.len { return 400 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum time (seconds) between two /who commands (default 10)&lt;br /&gt;
 alias -l delay { return 10 }&lt;br /&gt;
 &lt;br /&gt;
 ; time (seconds) between the checking if any unauthed users should be rechecked (default 120)&lt;br /&gt;
 alias -l queue.delay { return 120 }&lt;br /&gt;
 &lt;br /&gt;
 ; time (seconds) to recheck if an unauthed user is now authed (default 600)&lt;br /&gt;
 alias -l queue.check { return 600 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum ratio of (nicks with unknown auth) / (total nicks) in a channel to do /who #channel rather then /who nick,nick, (default 0.09)&lt;br /&gt;
 alias -l min.ratio { return 0.09 }&lt;br /&gt;
 &lt;br /&gt;
 ; minimum nr of nicks with unknown auth in a channel to do /who #channel rather then /who nick,nick, (default 10)&lt;br /&gt;
 alias -l min.nicks { return 10 }&lt;br /&gt;
 &lt;br /&gt;
 ; The networks the script is supposed to work on (case sensitive)&lt;br /&gt;
 ; NOTE that the script ONLY works on networks supporting WHOX (ircu 2.10.* should work)&lt;br /&gt;
 alias -l used.network {&lt;br /&gt;
   return $istokcs(QuakeNet UnderNet GameSurge HanIRC NetGamers OGameNet,$network,32)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; For every network a check to see if a user has a site where his authname is in&lt;br /&gt;
 ; $1 is the site&lt;br /&gt;
 alias -l auth.in.site {&lt;br /&gt;
   var %n = $network&lt;br /&gt;
   if (%n === QuakeNet) { return $iif(*.users.quakenet.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === UnderNet) { return $iif(*.users.undernet.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === GameSurge) { return $iif(*.*.GameSurge iswm $1,$true) }&lt;br /&gt;
   elseif (%n === HanIRC) { return $iif(*.users.HanIRC.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === NetGamers) { return $iif(*.users.netgamers.org iswm $1,$true) }&lt;br /&gt;
   elseif (%n === OGameNet) { return $iif(*.user.OGameNet iswm $1,$true) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; For every network the method to return the auth from the site&lt;br /&gt;
 ; $1 is the site&lt;br /&gt;
 alias -l auth.from.site {&lt;br /&gt;
   var %n = $network&lt;br /&gt;
   if (%n === QuakeNet) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === UnderNet) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === GameSurge) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === HanIRC) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === NetGamers) { return $gettok($1,1,46) }&lt;br /&gt;
   elseif (%n === OGameNet) { return $gettok($1,1,46) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $auth(nick [,cid])  returns the auth of the nick&lt;br /&gt;
 alias auth {&lt;br /&gt;
   if (!$isid) { $iif($show,.auth,auth) $1- | return }&lt;br /&gt;
   if ($1 == $null) || ($2 !== $null &amp;amp;&amp;amp; (!$scid($2) || !$2)) { return }&lt;br /&gt;
   return $gettok($hget($iif($2,$2,$cid) $+ .auths,$+(auth.,$comchan($1,1),$chr(44),$1)),1,32)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $auth-nick(auth [,cid])  returns the first nick with that auth&lt;br /&gt;
 alias auth-nick {&lt;br /&gt;
   if ($1 == $null) || ($2 !== $null &amp;amp;&amp;amp; (!$scid($2) || !$2)) { return }&lt;br /&gt;
   return $gettok($hfind($iif($2,$2,$cid) $+ .auths,$1,1,n).data,-1,44)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
  &lt;br /&gt;
 ; /auth.update nick&lt;br /&gt;
 alias auth.update {&lt;br /&gt;
   if (!$used.network) || (!$comchan($1,1)) { return }&lt;br /&gt;
   var %t = $cid $+ .auths , %a = $hget(%t,$+(auth.,$comchan($1,1),$chr(44),$1))&lt;br /&gt;
   if (0 * iswm %a) { hdel -w %t $+(auth.,*,$chr(44),$1) }&lt;br /&gt;
   if (!%a) || (0 * iswm %a) { au.update n $1 | hadd %t req. $+ $1 1 }&lt;br /&gt;
   else { .signal authupdate.req $1 %a }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AU.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = t/n/c/r (timer nick chan repeat)&lt;br /&gt;
 ; [$1- = n nick]&lt;br /&gt;
 alias -l au.update {&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$hget(%t)) { hmake %t }&lt;br /&gt;
   var %tim = au.update.delay. $+ $cid , %d = $hget(%t,delay)&lt;br /&gt;
   if ($ctimer == %tim) &amp;amp;&amp;amp; ($1 !== r) { hadd -u $+ $delay %t delay 1 | au.who | return }&lt;br /&gt;
   if (!%d) || ($1 == r) { hadd -u $+ $delay %t delay 1 }&lt;br /&gt;
   if ((!$timer(%tim) &amp;amp;&amp;amp; (%d || $1 == c)) || $1 == r) { .timer $+ %tim 1 $delay au.update }&lt;br /&gt;
   if (!%d &amp;amp;&amp;amp; !$timer(%tim) &amp;amp;&amp;amp; $1 !== c &amp;amp;&amp;amp; $1 !== r) { au.who $iif($1 == n,$2) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NICKLIST CHANGING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on ^*:JOIN:#:{&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$used.network) { return }&lt;br /&gt;
   if ($nick == $me) { au.start | au.update c | return }&lt;br /&gt;
   if (!$hget(%t)) { return }&lt;br /&gt;
   if ($hfind(%t,$+(auth.*,$chr(44),$nick),1,w)) { hadd %t $+(auth.,$chan,$chr(44),$nick) $hget(%t,$v1) }&lt;br /&gt;
   elseif ($auth.in.site($site)) { au.upd.nick $nick $site }&lt;br /&gt;
   else { au.update n $nick }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:PART:#:{ au.part $chan $nick | au.upd.nick $nick $site $chan }&lt;br /&gt;
 on *:KICK:#:{ au.part $chan $knick | au.upd.nick $nick $site }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = chan   $2 = nick&lt;br /&gt;
 alias -l au.part {&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$hget(%t)) { return }&lt;br /&gt;
   if ($2 == $me) {&lt;br /&gt;
     hdel -w %t auth. $+ $chan $+ ,*&lt;br /&gt;
     hdel %t ctime. $+ $chan&lt;br /&gt;
     var %i = $hfind(%t,req.*,0,w)&lt;br /&gt;
     while (%i) {&lt;br /&gt;
       var %it = $hfind(%t,req.*,%i,w) , %n = $gettok(%it,2,46)&lt;br /&gt;
       if (%n ison $1) &amp;amp;&amp;amp; (!$comchan(%n,2)) { hdel %t %it | .signal authupdate.req %n }&lt;br /&gt;
       dec %i&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   else {&lt;br /&gt;
     hdel %t $+(auth.,$1,$chr(44),$2)&lt;br /&gt;
     if ($hget(%t,req. $+ $2)) &amp;amp;&amp;amp; (!$comchan($2,2)) { hdel %t req. $+ $2 | .signal authupdate.req $2 }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:QUIT:{&lt;br /&gt;
   var %t = $cid $+ .auths&lt;br /&gt;
   if (!$hget(%t)) { return }&lt;br /&gt;
   hdel -w %t $+(auth.,*,$chr(44),$nick)&lt;br /&gt;
   if ($hget(%t,req. $+ $nick)) { hdel %t req. $+ $nick | .signal authupdate.req $nick }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NICK:{&lt;br /&gt;
   var %i = $comchan($newnick,0) , %t = $cid $+ .auths&lt;br /&gt;
   if ($nick == $newnick) || (!$hget(%t)) { return }&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %it = $+(auth.,$comchan($newnick,%i),$chr(44))&lt;br /&gt;
     $iif($hget(%t,%it $+ $nick),hadd,hdel) %t %it $+ $newnick $v1&lt;br /&gt;
     hdel %t %it $+ $nick&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   if ($hget(%t,req. $+ $nick)) { hadd %t req. $+ $newnick 1 | hdel %t req. $+ $nick }&lt;br /&gt;
   if ($auth.in.site($site)) { au.upd.nick $newnick $site }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AU.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; [$1 = nick]&lt;br /&gt;
 alias -l au.who {&lt;br /&gt;
   var %t2 = $cid $+ .au.who&lt;br /&gt;
   if ($hget(%t2)) { hfree %t2 }&lt;br /&gt;
   hmake %t2&lt;br /&gt;
   if ($1) {&lt;br /&gt;
     var %who = $1 $+ ,,, $+ 137&lt;br /&gt;
     hadd %t2 -mask %who&lt;br /&gt;
     who %who n%nat,137&lt;br /&gt;
     return&lt;br /&gt;
   }&lt;br /&gt;
   var %i = $comchan($me,0) , %t = $cid $+ .auths , %sort , %ticks = $ticks&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %sort = %sort $nick($comchan($me,%i),0) $+ . $+ %i&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   var %sort = $sorttok(%sort,32,n) , %i = $numtok(%sort,32) , %maxlen = $max.len , %n.max = $max.replies  , %time = $calc($ctime - $queue.check) , %ids , %n.w , %len&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %c = $comchan($me,$gettok($gettok(%sort,%i,32),2,46)) , %n.0 = $hfind(%t,0 %c &amp;amp;,0,w).data , %n.c = $nick(%c,0)&lt;br /&gt;
     var %n.l = $calc(%n.c - $hfind(%t,$+(auth.,%c,$chr(44),*),0,w) + $iif(%time &amp;lt; $hget(%t,ctime. $+ %c),0,%n.0))&lt;br /&gt;
     if ($calc(%len + $len(%c) +1) &amp;gt; %maxlen) || ($calc(%n.w + %n.c) &amp;gt; %n.max) { dec %i | continue }&lt;br /&gt;
     if (%n.l &amp;gt; 1) &amp;amp;&amp;amp; ((%n.l &amp;gt;= $min.nicks) || ($calc(%n.l / %n.c) &amp;gt;= $min.ratio)) {&lt;br /&gt;
       var %chans = %chans %c&lt;br /&gt;
       hadd %t ctime. $+ %c $ctime&lt;br /&gt;
       var %j = $nick(%c,0)&lt;br /&gt;
       while (%j) {&lt;br /&gt;
         var %n = $nick(%c,%j)&lt;br /&gt;
         if (!$hget(%t2,%n)) { hadd %t2 %n 1 | inc %n.w }&lt;br /&gt;
         dec %j&lt;br /&gt;
       }&lt;br /&gt;
       inc %len $calc($len(%c) +1)&lt;br /&gt;
     }&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   var %i = $comchan($me,0) , %nicks&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %c = $comchan($me,%i)&lt;br /&gt;
     if (!$istok(%chans,%c,32)) {&lt;br /&gt;
       if ($calc($nick(%c,0) - $hfind(%t,$+(auth.,%c,$chr(44),*),0,w)) &amp;gt; 0) {&lt;br /&gt;
         var %j = $nick(%c,0)&lt;br /&gt;
         while (%j) {&lt;br /&gt;
           var %n = $nick(%c,%j)&lt;br /&gt;
           if ($calc(%len + $len(%n) +1) &amp;gt; %maxlen) { goto end }&lt;br /&gt;
           var %val = $hget(%t,$+(auth.,%c,$chr(44),%n))&lt;br /&gt;
           if (!$hget(%t2,%n)) &amp;amp;&amp;amp; ((%val == $null) || ($gettok(%val,3,32) &amp;lt; %time)) { var %nicks = %nicks %n | hadd %t2 %n 1 | inc %n.w | inc %len $len(%n) }&lt;br /&gt;
           if (%n.w &amp;gt;= %n.max) { goto end }&lt;br /&gt;
           dec %j&lt;br /&gt;
         }&lt;br /&gt;
       }&lt;br /&gt;
       else {&lt;br /&gt;
         var %j = $hfind(%t,0 %c &amp;amp;,0,w).data&lt;br /&gt;
         while (%j) {&lt;br /&gt;
           var %it = $hfind(%t,0 %c &amp;amp;,%j,w).data , %n = $gettok(%it,2,44)&lt;br /&gt;
           if ($calc(%len + $len(%n) +1) &amp;gt; %maxlen) { goto end }&lt;br /&gt;
           if (!$hget(%t2,%n)) &amp;amp;&amp;amp; ($gettok($hget(%t,%it),3,32) &amp;lt; %time) &amp;amp;&amp;amp; (auth.* iswm %it) { var %nicks = %nicks %n | hadd %t2 %n 1 | inc %n.w | inc %len $len(%n) }&lt;br /&gt;
            if (%n.w &amp;gt;= %n.max) { goto end }&lt;br /&gt;
           dec %j&lt;br /&gt;
         }&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   :end&lt;br /&gt;
   var %who = $replace(%chans %nicks,$chr(32),$chr(44))&lt;br /&gt;
   if (%who) {&lt;br /&gt;
     var %who = %who $+ ,,, $+ 137&lt;br /&gt;
     hadd %t2 -mask %who&lt;br /&gt;
     who %who n%nat,137&lt;br /&gt;
     if (%len &amp;gt; $calc(%maxlen * 0.7)) || (%n.w &amp;gt; $calc(%n.max * 0.7)) { au.update r }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW REPLIES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; RAW 354 SPECIAL WHO REPLY&lt;br /&gt;
 ; 354 &amp;lt;you&amp;gt;   &amp;lt;nr&amp;gt;  &amp;lt;nick&amp;gt;  &amp;lt;auth&amp;gt;&lt;br /&gt;
 ; 354 Vliedel 137   sy      rry&lt;br /&gt;
 RAW 354:&amp;amp; 137 &amp;amp; &amp;amp;:{&lt;br /&gt;
   haltdef&lt;br /&gt;
   var %i = $comchan($3,0) , %t = $cid $+ .auths&lt;br /&gt;
   if ($hget(%t,req. $+ $3)) { hdel %t req. $+ $3 | .signal authupdate.req $3 $iif(%i,$4) }&lt;br /&gt;
   if (!%i) || (!$hget(%t)) { return }&lt;br /&gt;
   if ($gettok($hget(%t,$+(auth.,$comchan($3,1),$chr(44),$3)),1,32) !== $4) { .signal authupdate.new $3 $4 }&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     var %c = $comchan($3,%i)&lt;br /&gt;
     hadd %t $+(auth.,%c,$chr(44),$3) $4 $iif(!$4,%c $ctime)&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; RAW 315 WHO END&lt;br /&gt;
 ; 315 &amp;lt;you&amp;gt;    &amp;lt;requested&amp;gt;      :End of /who list.&lt;br /&gt;
 ; 315 Vliedel  #vliedel,,,137   :End of /WHO list.&lt;br /&gt;
 RAW 315:&amp;amp; *,,,137 end of /WHO list.: {&lt;br /&gt;
   if ($hget($cid $+ .au.who,-mask) == $2) {&lt;br /&gt;
     var %who = $left($2,-6) , %i = $wildtok(%who,#*,0,44) , %t = $cid $+ .auths&lt;br /&gt;
     while (%i) {&lt;br /&gt;
       hadd %t ctime. $+ $wildtok(%who,#*,%i,44) $ctime&lt;br /&gt;
       dec %i&lt;br /&gt;
     }&lt;br /&gt;
     hfree $cid $+ .au.who&lt;br /&gt;
   }&lt;br /&gt;
   haltdef&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; STARTING AND STOPPING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:LOAD:{ scon -at1 au.load l }&lt;br /&gt;
 alias -l au.load {&lt;br /&gt;
   au.stop&lt;br /&gt;
   au.start&lt;br /&gt;
   au.update t&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 alias -l au.stop {&lt;br /&gt;
   .timer $+ au.update. $+ $cid off&lt;br /&gt;
   .timer $+ au.update.delay. $+ $cid off&lt;br /&gt;
   if ($hget($cid $+ .auths)) { hfree $v1 }&lt;br /&gt;
   if ($hget($cid $+ .au.who)) { hfree $v1 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 alias -l au.start {&lt;br /&gt;
   if (!$used.network) { return }&lt;br /&gt;
   if (!$hget($cid $+ .auths)) { hmake $cid $+ .auths }&lt;br /&gt;
   if (!$timer(au.update. $+ $cid)) { .timer $+ au.update. $+ $cid 0 $queue.delay au.update t }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:DISCONNECT:{ au.stop }&lt;br /&gt;
 on *:UNLOAD:{ scon -a au.stop }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on ^*:TEXT:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:ACTION:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:NOTICE:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:RAWMODE:#:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:TOPIC:#:{ au.upd.nick $nick $site }&lt;br /&gt;
 on ^*:INVITE:#:{ au.upd.nick $nick $site }&lt;br /&gt;
 CTCP *:*:*:{ au.upd.nick $nick $site }&lt;br /&gt;
 RAW 352:&amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; *: { au.upd.nick $6 $4 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = nick   $2 = site   [ $3 = chan (exclude it)]&lt;br /&gt;
 alias -l au.upd.nick {&lt;br /&gt;
   if (!$auth.in.site($2)) || (!$hget($cid $+ .auths)) { return }&lt;br /&gt;
   var %i = $comchan($1,0) , %t = $cid $+ .auths , %au = $auth.from.site($2)&lt;br /&gt;
   if (!%i) || (%i == 1 &amp;amp;&amp;amp; $3) || ($hget(%t,$+(auth.,$comchan($1,1),$chr(44),$1)) == %au) { return }&lt;br /&gt;
   while (%i) {&lt;br /&gt;
     if ($comchan($1,%i) !== $3) { hadd %t $+(auth.,$v1,$chr(44),$1) %au }&lt;br /&gt;
     dec %i&lt;br /&gt;
   }&lt;br /&gt;
   .signal authupdate.new $1 %au&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; USED DATA/TIMERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 ; TABLE &amp;lt;cid&amp;gt;.auths&lt;br /&gt;
 ;auth.&amp;lt;chan&amp;gt;,&amp;lt;nick&amp;gt; --&amp;gt; &amp;lt;auth&amp;gt; [chan ctime]&lt;br /&gt;
 ;req.&amp;lt;nick&amp;gt;         --&amp;gt; 1&lt;br /&gt;
 ;ctime.&amp;lt;chan&amp;gt;       --&amp;gt; &amp;lt;ctime&amp;gt;&lt;br /&gt;
 ;delay              --&amp;gt; &amp;lt;1/0/null&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 ; TABLE &amp;lt;cid&amp;gt;.au.who&lt;br /&gt;
 ; nick   --&amp;gt; 1&lt;br /&gt;
 ; -mask  --&amp;gt; /who string&lt;br /&gt;
 &lt;br /&gt;
 ; TIMER au.update.delay.&amp;lt;cid&amp;gt;&lt;br /&gt;
 ; TIMER au.update.&amp;lt;cid&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Archive]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Why_and_how_to_use_File_Handlers&amp;diff=5673</id>
		<title>Why and how to use File Handlers</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Why_and_how_to_use_File_Handlers&amp;diff=5673"/>
		<updated>2011-03-07T23:25:15Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: enhanced example script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File handlers are mIRC&#039;s most primitive method of handling file operations. If you are familiar with lower-level programing languages such as the popular C family and its derivatives, you will better recognize their functionality as that of &amp;amp;quot;Streams&amp;amp;quot;. In these lower level languages, there are Input streams and Output streams (For reading from and writing to a file respectively), but mIRC uses file handling for both.&lt;br /&gt;
&lt;br /&gt;
So why use file handlers when mIRC is a high level language and provides us with such useful and easy methods as the [[$read]]() identifier and [[write]] command? Consider the following code that reads from every line in the file with $read and a [[While_loops|while loop]].&lt;br /&gt;
&lt;br /&gt;
 [[Aliases|alias]] example {&lt;br /&gt;
   [[var]] %i = 1&lt;br /&gt;
   while (%i [[If#.3C.3D|&amp;lt;=]] [[$lines]](examplefile.txt)) {&lt;br /&gt;
     [[noop]] $read(examplefile.txt,n,%i)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
When mIRC uses $read, it internally opens a &amp;amp;quot;stream&amp;amp;quot; with the file and goes through each line until it reaches the line it was told. Since we give it a number, it counts the lines. On the first round, mIRC reads line &amp;amp;quot;1&amp;amp;quot;, sees we asked for line &amp;amp;quot;1&amp;amp;quot;, and is done. On the second time however, it reads line &amp;amp;quot;1&amp;amp;quot;, sees we asked for &amp;amp;quot;2&amp;amp;quot;, keeps going, and sees line &amp;amp;quot;2&amp;amp;quot;, its done. This will continue for line 3 (1 2 3) and 4 (1 2 3 4) until we are finished. If examplefile.txt were 50 lines big, mIRC would internally read 1275 lines before finishing. The formula for this if you&#039;re curious is: (1 + lines)*lines/2&lt;br /&gt;
&lt;br /&gt;
So obviously there are performance issues with $read. If you think you will never have to do this, consider having to perform reverse wild card matches (wild card address in a file vs. full addresses, where you can&#039;t wild card search with $read), or parsing a downloaded web page.&lt;br /&gt;
&lt;br /&gt;
==Opening a Stream==&lt;br /&gt;
&lt;br /&gt;
A file handler stream must be opened when you want to begin, and closed when you are done. You will not be able to open two handlers of the same name without closing one first, nor will you be able to perform an operation on a stream you have not yet opened.&lt;br /&gt;
 /[[fopen]] [-no] &amp;amp;lt;Stream Name&amp;amp;gt; &amp;amp;lt;File Name&amp;amp;gt;&lt;br /&gt;
This command opens a stream, assuming it is not opened already.&lt;br /&gt;
&lt;br /&gt;
*The -n switch will make this stream only work if the file doesn&#039;t exist, and will create it for you. If it does exist, the command will give an error. &lt;br /&gt;
*The -o switch will create the file if it doesn&#039;t exist, and overwrite it if it does.&lt;br /&gt;
Without either of these switches, the command will give an error if the file does not exist, as it will be unable to create the stream.&lt;br /&gt;
&lt;br /&gt;
Throughout this tutorial I will be using a file called bans.txt to illustrate my point. At the end, we will create an efficient alias ($isbanned(Address)) that will search the file line by line and see if any line wild card matches Address, returning [[$true]] or [[$false]] accordingly. I will build on it as we go, here is the first code to create the stream.&lt;br /&gt;
&lt;br /&gt;
 alias isbanned {&lt;br /&gt;
   if (![[$isfile]](bans.txt)) { [[return]] $false }&lt;br /&gt;
   .fopen bancheck bans.txt &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This opens a stream called &amp;amp;quot;bancheck&amp;amp;quot; with the file &amp;amp;quot;bans.txt&amp;amp;quot;. The first line stops if &amp;amp;quot;bans.txt&amp;amp;quot; doesn&#039;t exist, because obviously the address can&#039;t be banned! The . in front of fopen is a &amp;amp;quot;silent&amp;amp;quot; command prefix, which keeps it from telling us about the file handler being opened. Most people don&#039;t care :)&lt;br /&gt;
&lt;br /&gt;
==Status of a Stream==&lt;br /&gt;
&lt;br /&gt;
[[$fopen]] has nothing inherent to do with opening the stream, its used to check the status of file handlers. After opening the handler in isbanned, we did not close it. At this point, if we were to [[echo]] $fopen(bancheck) it would return &amp;amp;quot;bancheck&amp;amp;quot;, proving that the stream was opened. If it were not opened, it would return &amp;amp;quot;[[$null]]&amp;amp;quot;. You can also use $fopen(N) to get file handler number N, 0 of course returning the total number of opened streams. $fopen(1), assuming this was the only file handler opened, would also return &amp;amp;quot;bancheck&amp;amp;quot;, $fopen(0) would return 1.&lt;br /&gt;
&lt;br /&gt;
Properties of $fopen:&lt;br /&gt;
*&#039;&#039;fname&#039;&#039; returns the name of the file  the stream is reading from. $fopen(bancheck).fname would return &amp;amp;quot;bans.txt&amp;amp;quot;&lt;br /&gt;
*&#039;&#039;pos&#039;&#039; returns the current position of the file pointer. Think of the pointer as the blinking | on the screen when you type. As you read, the pointer advances to the next part of the file (after the last character you read). pos returns a number in bytes, basically the number of characters (letters, numbers, spaces) that have already been read. If the first line contained &amp;amp;quot;foo bar&amp;amp;quot; and we have read to &amp;amp;quot;foo&amp;amp;quot;, .pos would return &amp;amp;quot;3&amp;amp;quot;, as in three characters read. $fopen(bancheck).pos would return 0 as we have not read any bytes from the stream yet.&lt;br /&gt;
*&#039;&#039;eof&#039;&#039; returns a $true or $false value based on whether or not the pointer has reached the end of the file (EoF is a general programing term for end of stream or, &amp;amp;quot;End Of File&amp;amp;quot;). You should note that if you intend to keep a stream open, .eof will bug as of version 6.21, because it is set to the number of bytes that were in the file when you began your read. If new text is written to the file while your pointer is opened (say from 30 to 50 bytes), once .pos was 30, .eof would be true, even though you were not technically at the end of the file. I recommend comparing .pos to [[$file]](name).size instead of using if with eof. $fopen(bancheck).eof would return $false since we are not yet at the end of the file bans.txt&lt;br /&gt;
*&#039;&#039;err&#039;&#039; simply returns an error code if there was one. $fopen(bancheck).err would return 0 because we have had no errors (hopefully).&lt;br /&gt;
&lt;br /&gt;
 alias isbanned {&lt;br /&gt;
   if (!$isfile(bans.txt)) { return $false }&lt;br /&gt;
   if ($fopen(bancheck)) { .[[fclose]] bancheck }&lt;br /&gt;
   .fopen bancheck bans.txt  &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we add a check to make sure bancheck is not already opened for some reason, and close it if it is, avoiding the &amp;amp;quot;name already in use&amp;amp;quot; error.&lt;br /&gt;
&lt;br /&gt;
==Reading from the Stream==&lt;br /&gt;
&lt;br /&gt;
There are two ways to read from a stream. You can use [[$fread]] or [[$fgetc]].&lt;br /&gt;
&lt;br /&gt;
*$fgetc(file handler name | file handler number) will return the next character after the current pointer position, and advanced the pointer past that character: assume the pointer is at the end of the bold characters: Before $fgetc: &#039;&#039;&#039;a&#039;&#039;&#039;bc, After: &#039;&#039;&#039;ab&#039;&#039;&#039;c&lt;br /&gt;
**Returns: b, the next character in line.&lt;br /&gt;
*$fread(name|number) will return the next line after the pointer, and advanced the pointer past that line.&lt;br /&gt;
*$fread(name|number,M,&amp;amp;amp;bvar) will read from the current pointer position, the next M bytes into &amp;amp;amp;bvar&lt;br /&gt;
**To learn about binary variables, see the [[:Category:Binary_Files|Binary Files]] category.&lt;br /&gt;
&lt;br /&gt;
 alias isbanned { &lt;br /&gt;
   if (!$isfile(bans.txt)) { return $false }&lt;br /&gt;
   if ($fopen(bancheck)) { .fclose bancheck }&lt;br /&gt;
   .fopen bancheck bans.txt  &lt;br /&gt;
   while (!$fopen(bancheck).eof) {&lt;br /&gt;
     var %thisAddress = $fread(bancheck)&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This would read every line in consecutive, non recursive order, setting the line to %thisAddress. Remember, without using $fread or $fgetc this loop would be infinite because the pointer would never advance and never reach the end of file (.eof)&lt;br /&gt;
&lt;br /&gt;
Another way to do this is (more effective yet slower):&lt;br /&gt;
&lt;br /&gt;
 alias isbanned {&lt;br /&gt;
   if (!$isfile(bans.txt)) { return $false }&lt;br /&gt;
   if ($fopen(bancheck)) { .fclose bancheck }&lt;br /&gt;
   .fopen bancheck bans.txt&lt;br /&gt;
   while ($fopen(bancheck).pos &amp;amp;lt; $file(bans.txt).size) {&lt;br /&gt;
     var %thisAddress = $fread(bancheck)&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This of course would read until the pointer is at the last position in the file (The last byte, its size in bytes).&lt;br /&gt;
&lt;br /&gt;
==Searching for Text in a Stream==&lt;br /&gt;
&lt;br /&gt;
File handlers support a bit of high-level influence, allowing you to search for a location in the stream and set the pointer to it using /[[fseek]]. Each seek is from the current position of the pointer foward.&lt;br /&gt;
 /fseek [-lnwr] &amp;amp;lt;Stream Name&amp;amp;gt; &amp;amp;lt;Pattern&amp;amp;gt;&lt;br /&gt;
* If you do not use a switch, it will look for the next occurance of the words you specify as pattern.&lt;br /&gt;
* If you use -l, it will go to the Nth line (ie line 5, 5 as the pattern.)&lt;br /&gt;
* If you use -n, it will seek to the next line automatically. This is fairly useless, in all honesty, but use as needed.&lt;br /&gt;
* If you use -w, it will look by wild card as the pattern (*foobar*)&lt;br /&gt;
* If you use -r, it will use a regular expression as the pattern (see http://www.regular-expressions.info or another tutorial to learn how to use these)&lt;br /&gt;
&lt;br /&gt;
We might, for example, wish to start looking at the line that reads &amp;amp;quot;Start Here&amp;amp;quot;, so we would use after opening the file:&lt;br /&gt;
 .fseek bancheck Start Here&lt;br /&gt;
It is important to note that the pointer will be placed at the &amp;amp;quot;S&amp;amp;quot; in start here (The first byte in the found string), so to start reading after it, we should use:&lt;br /&gt;
 noop $fread(bancheck)&lt;br /&gt;
This will read the next line (and do nothing with it), but will advanced the pointer past the line, letting us start after it.&lt;br /&gt;
&lt;br /&gt;
==Final Notes==&lt;br /&gt;
&lt;br /&gt;
* fclose can use wild cards as well, .fclose * closes everything&lt;br /&gt;
* If an error occurs, the handlers will not be closed and the reading will stop, do not forget to check to see if it is opened before trying to open it again, or you will have errors in your script.&lt;br /&gt;
* $feof and $ferr are the values of .eof and .err for the last file handlers read from.&lt;br /&gt;
 .[[flist]] [name | wildcard]&lt;br /&gt;
* This will list all file handlers matching name or wild card; no parameter will list all file handlers.&lt;br /&gt;
 .fwrite [-bn] &amp;amp;lt;Stream Name&amp;amp;gt; &amp;amp;lt;Text | &amp;amp;amp;Binvar&amp;amp;gt;&lt;br /&gt;
*This will write a binary (provided -b is specified), or text (-n will add an endline character) into the stream at the current position of the pointer.&lt;br /&gt;
&lt;br /&gt;
==Final Product==&lt;br /&gt;
I&#039;ll leave you to analyze this and use what you have learned to understand it - now go and use $read ineffectively no more!&lt;br /&gt;
 alias isbanned {&lt;br /&gt;
   if (!$isfile(bans.txt)) return $false&lt;br /&gt;
   if ($fopen(bancheck)) .fclose bancheck&lt;br /&gt;
   .fopen bancheck bans.txt&lt;br /&gt;
   if ($fopen(bancheck).err) return $false&lt;br /&gt;
   while ($fopen(bancheck).pos &amp;amp;lt; $file(bans.txt).size) {&lt;br /&gt;
     var %thisAddress = $fread(bancheck)&lt;br /&gt;
     if (%thisAddress iswm $1) return $true&lt;br /&gt;
   }&lt;br /&gt;
   return $false&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
A test alias showing speed differences of /fwrite &amp;amp; /write and $fread &amp;amp; $read&lt;br /&gt;
&lt;br /&gt;
 [[alias]] filetest {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isfile]](filetest.txt)) { [[echo]] -ag The file filetest.txt already exists! | halt }&lt;br /&gt;
   [[If-Then-Else|if]] ($fopen(filetest)) { .[[fclose]] filetest }&lt;br /&gt;
 &lt;br /&gt;
   [[Local_Variables|var]] %max = 1000, %str = [[$str]](x,100)&lt;br /&gt;
 &lt;br /&gt;
   ;; WRITE-part&lt;br /&gt;
 &lt;br /&gt;
   [[Local_Variables|var]] %x = %max, %t = [[$ticks]]&lt;br /&gt;
   .[[fopen]] -n filetest filetest.txt&lt;br /&gt;
   [[while]] (%x) {&lt;br /&gt;
     .[[fwrite]] -n filetest %str&lt;br /&gt;
     [[dec]] %x&lt;br /&gt;
   }&lt;br /&gt;
   .[[fclose]] filetest&lt;br /&gt;
   [[echo]] -ag /fwrite with %max lines: [[$calc]]([[$ticks]] - %t) [[DollarPlus|$+]] ms&lt;br /&gt;
   .[[remove]] filetest.txt&lt;br /&gt;
 &lt;br /&gt;
   [[Local_Variables|var]] %x = %max, %t = [[$ticks]]&lt;br /&gt;
   [[while]] (%x) {&lt;br /&gt;
     [[write]] filetest.txt %str&lt;br /&gt;
     [[dec]] %x&lt;br /&gt;
   }&lt;br /&gt;
   [[echo]] -ag /write with %max lines: [[$calc]]([[$ticks]] - %t) [[DollarPlus|$+]] ms&lt;br /&gt;
 &lt;br /&gt;
   ;; READ-part&lt;br /&gt;
 &lt;br /&gt;
   [[Local_Variables|var]] %t = [[$ticks]]&lt;br /&gt;
   .[[fopen]] filetest filetest.txt&lt;br /&gt;
   [[while]] (!$fopen(filetest).eof) {&lt;br /&gt;
     [[noop]] -qg $fread(filetest)&lt;br /&gt;
   }&lt;br /&gt;
   .[[fclose]] filetest&lt;br /&gt;
   [[echo]] -ag $ [[DollarPlus|$+]] fread with %max lines: [[$calc]]([[$ticks]] - %t) [[DollarPlus|$+]] ms&lt;br /&gt;
 &lt;br /&gt;
   [[Local_Variables|var]] %x = %max,%t = [[$ticks]]&lt;br /&gt;
   [[while]] (%x) {&lt;br /&gt;
     [[noop]] [[$read]](filetest.txt,%x)&lt;br /&gt;
     [[dec]] %x&lt;br /&gt;
   }&lt;br /&gt;
   [[echo]] -ag $ [[DollarPlus|$+]] read with %max lines: [[$calc]]([[$ticks]] - %t) [[DollarPlus|$+]] ms&lt;br /&gt;
   .[[remove]] filetest.txt&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
I got these results:&lt;br /&gt;
 /fwrite with 5000 lines: 171ms&lt;br /&gt;
 /write with 5000 lines: 1844ms&lt;br /&gt;
 $fread with 5000 lines: 156ms&lt;br /&gt;
 $read with 5000 lines: 16969ms&lt;br /&gt;
&lt;br /&gt;
{{Author|aca20031}}&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:File Handling]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5540</id>
		<title>How to query a CS Server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5540"/>
		<updated>2011-02-13T20:06:00Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: removed dead links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you want to e.g. get the number and names of all player who are currently playing on a CS-server, you have to send a so-called &amp;quot;query&amp;quot; to this server (using UDP) and handle everything the server sends back to you. This isn&#039;t as easy as it sounds. At first, you would have to &#039;learn&#039;, or, at least, understand the protocol a CS-server uses (e.g. what do I have to send to the server to get a &#039;good&#039; reply and what&#039;s the structure of this reply). If you want to learn more about these protocols, take a look at http://developer.valvesoftware.com/wiki/Server_Queries .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following script &#039;&#039;&#039;echo&#039;&#039;&#039;s the output to your active window. You will have to modify it to be able to use it as &#039;bot&#039;. It&#039;s a more complex script and you don&#039;t need to understand it (completely) to be able to use it.&lt;br /&gt;
&lt;br /&gt;
 ; HL server query snippet by Saturn&lt;br /&gt;
 ;&lt;br /&gt;
 ; 16-04-2009: update to protocol version 48 by NaNg&lt;br /&gt;
 ; 29-01-2011: update to fix UTF8 problem in mIRC 7.* and fixed name problems if last char is space by NaNg&lt;br /&gt;
 ;&lt;br /&gt;
 ; usage:&lt;br /&gt;
 ; /hlinfo &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlinfo &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
 ; /hlplay &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlplay &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens a new socket if you want to get general information about a running CS-server&lt;br /&gt;
 [[alias]] hlinfo {&lt;br /&gt;
   [[If-Then-Else|if]] (!$2) [[tokenize]] 58 [[$1-|$1]]&lt;br /&gt;
  &lt;br /&gt;
   ; using a dynamic socket name so we can use multiple instances at once&lt;br /&gt;
   [[var]] %sock = [[DollarPlus|$+]](hlinfo-,[[$ticks]])&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   [[bset]] &amp;amp;t 1 255 255 255 255&lt;br /&gt;
   bset -t &amp;amp;t 5 TSource Engine Query&lt;br /&gt;
   bset &amp;amp;t 25 0&lt;br /&gt;
   ; actually open the socket, and send the query&lt;br /&gt;
   [[sockudp]] -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; closing the socket after 60seconds if there is no response (else it will be closed by another event (see below))&lt;br /&gt;
   .[[timer]] $+ %sock 1 60 [[sockclose]] %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will get all data sent back from the server&lt;br /&gt;
 [[on_udpread|on *:UDPREAD]]:hlinfo-*:{&lt;br /&gt;
   ; save it in a binary variable&lt;br /&gt;
   [[sockread]] -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables that we will use below&lt;br /&gt;
   var %offset, %name, %map, %game, %num, %max, %ip, %dir&lt;br /&gt;
  &lt;br /&gt;
   ; following the protocol, this &amp;quot;m&amp;quot; shows us that we queried a Half-Life 1 server&lt;br /&gt;
   if ([[$chr]]([[$bvar]](&amp;amp;reply,5)) == m) {&lt;br /&gt;
     ; Half-Life 1 info reply&lt;br /&gt;
  &lt;br /&gt;
     %offset = 6&lt;br /&gt;
  &lt;br /&gt;
     ; save the ip&lt;br /&gt;
     %ip = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     [[inc]] %offset [[$calc]]([[$len]]($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the same&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the current map&lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the game directory&lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the name of the game&lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; current and maximum players&lt;br /&gt;
     %num = $bvar(&amp;amp;reply,%offset)&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 1))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; else we get data for a CS:Source game&lt;br /&gt;
   else {&lt;br /&gt;
     ; Source info reply&lt;br /&gt;
     ; we do the same as above&lt;br /&gt;
     %offset = 7&lt;br /&gt;
  &lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %num = $bvar(&amp;amp;reply,$calc(%offset + 2))&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 3))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; now we echo all stored details to the active window&lt;br /&gt;
   [[echo]] -a Info for [[$sock]]([[$sockname]]).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
   echo -a Name: %name&lt;br /&gt;
   echo -a Map: %map&lt;br /&gt;
   echo -a Game: %game&lt;br /&gt;
   echo -a Players: %num $+ / $+ %max&lt;br /&gt;
  &lt;br /&gt;
   ; and turn off the timer closing the socket&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; as we can close it now manually&lt;br /&gt;
   [[sockclose]] $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 ; this is the alias that will be called from hlplay to open the socket&lt;br /&gt;
 alias hlchal {&lt;br /&gt;
   ; $1 = ip, $2 = port, $3- = what to call when received&lt;br /&gt;
   ; use dynamic socket name as above&lt;br /&gt;
   var %sock = $+(hlchal-,$ticks)&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   bset &amp;amp;t 1 255 255 255 255 85 255 255 255 255&lt;br /&gt;
   ; open the socket, and ask for a player challenge number&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; mark it with the ip and port (and the query we want to call when we&#039;ve received something from the server)&lt;br /&gt;
   [[sockmark]] %sock $3- $1-2&lt;br /&gt;
   ; and make a new timer to close it after 60 seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; read everything that comes back from the hlchal-* query&lt;br /&gt;
 on *:UDPREAD:hlchal-*:{&lt;br /&gt;
   ; and save it in the binary variable called &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
   ; actually call the alias saved in the sockmark (hlplay_query)&lt;br /&gt;
   $sock($sockname).mark $bvar(&amp;amp;reply,6,4)&lt;br /&gt;
   ; and turn the timer off because we can close it manually&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias we can call to make everything easier&lt;br /&gt;
 ; it will call other aliases to open sockets etc.&lt;br /&gt;
 alias hlplay {&lt;br /&gt;
   if (!$2) tokenize 58 $1&lt;br /&gt;
   hlchal $1-2 hlplay_query&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens the _real_ socket to receive data (everything before was just to challenge the server (read the website mentioned above))&lt;br /&gt;
 alias hlplay_query {&lt;br /&gt;
   ; set a binary variable&lt;br /&gt;
   bset &amp;amp;query 1 255 255 255 255 85 $3-&lt;br /&gt;
   ; use dynamic socket names again&lt;br /&gt;
   var %sock = $+(hlplay-,$ticks)&lt;br /&gt;
   ; open the socket&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;query&lt;br /&gt;
   ; and turn on the timer closing the socket after 60seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will receive all data from the server as response to our query&lt;br /&gt;
 on *:UDPREAD:hlplay-*:{&lt;br /&gt;
   ; we save it in &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables we will use later&lt;br /&gt;
   var %i = 1, %num = $bvar(&amp;amp;reply,6), %offset = 7&lt;br /&gt;
   var %count = 0, %name, %kills&lt;br /&gt;
  &lt;br /&gt;
   ; and echo the number of players&lt;br /&gt;
   echo -a Players on $sock($sockname).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
  &lt;br /&gt;
   ; now we can loop through all player and save some details about them&lt;br /&gt;
   [[while]] (%i &amp;lt;= %num) {&lt;br /&gt;
     inc %offset&lt;br /&gt;
  &lt;br /&gt;
     ; the name&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the kills&lt;br /&gt;
     %kills = $bvar(&amp;amp;reply,%offset).long&lt;br /&gt;
     if ($isbit(%kills,32)) dec %kills $calc(2^32)&lt;br /&gt;
     inc %offset 8&lt;br /&gt;
  &lt;br /&gt;
     ; and if there was a player&lt;br /&gt;
     if (%name != $null) {&lt;br /&gt;
       ; increase the variable that shows us the number of the player&lt;br /&gt;
       inc %count&lt;br /&gt;
       ; and echo it to the active window with the kills saved above&lt;br /&gt;
       echo -a %count $+ . %name - %kills&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; increase %i so we go on with the next player&lt;br /&gt;
     inc %i&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; if there are no players online, echo it aswell&lt;br /&gt;
   if (%count == 0) echo -a No players found!&lt;br /&gt;
  &lt;br /&gt;
   ; turn off the timer&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; and close the socket manually&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to RCON a source engine based server]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5539</id>
		<title>How to query a CS Server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5539"/>
		<updated>2011-02-13T19:58:23Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you want to e.g. get the number and names of all player who are currently playing on a CS-server, you have to send a so-called &amp;quot;query&amp;quot; to this server (using UDP) and handle everything the server sends back to you. This isn&#039;t as easy as it sounds. At first, you would have to &#039;learn&#039;, or, at least, understand the protocol a CS-server uses (e.g. what do I have to send to the server to get a &#039;good&#039; reply and what&#039;s the structure of this reply). If you want to learn more about these protocols, take a look at http://dev.kquery.com/ or http://www.valve-erc.com/srcsdk/Code/Networking/serverqueries.html or http://developer.valvesoftware.com/wiki/Server_Queries .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following script &#039;&#039;&#039;echo&#039;&#039;&#039;s the output to your active window. You will have to modify it to be able to use it as &#039;bot&#039;. It&#039;s a more complex script and you don&#039;t need to understand it (completely) to be able to use it.&lt;br /&gt;
&lt;br /&gt;
 ; HL server query snippet by Saturn&lt;br /&gt;
 ;&lt;br /&gt;
 ; 16-04-2009: update to protocol version 48 by NaNg&lt;br /&gt;
 ; 29-01-2011: update to fix UTF8 problem in mIRC 7.* and fixed name problems if last char is space by NaNg&lt;br /&gt;
 ;&lt;br /&gt;
 ; usage:&lt;br /&gt;
 ; /hlinfo &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlinfo &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
 ; /hlplay &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlplay &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens a new socket if you want to get general information about a running CS-server&lt;br /&gt;
 [[alias]] hlinfo {&lt;br /&gt;
   [[If-Then-Else|if]] (!$2) [[tokenize]] 58 [[$1-|$1]]&lt;br /&gt;
  &lt;br /&gt;
   ; using a dynamic socket name so we can use multiple instances at once&lt;br /&gt;
   [[var]] %sock = [[DollarPlus|$+]](hlinfo-,[[$ticks]])&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   [[bset]] &amp;amp;t 1 255 255 255 255&lt;br /&gt;
   bset -t &amp;amp;t 5 TSource Engine Query&lt;br /&gt;
   bset &amp;amp;t 25 0&lt;br /&gt;
   ; actually open the socket, and send the query&lt;br /&gt;
   [[sockudp]] -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; closing the socket after 60seconds if there is no response (else it will be closed by another event (see below))&lt;br /&gt;
   .[[timer]] $+ %sock 1 60 [[sockclose]] %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will get all data sent back from the server&lt;br /&gt;
 [[on_udpread|on *:UDPREAD]]:hlinfo-*:{&lt;br /&gt;
   ; save it in a binary variable&lt;br /&gt;
   [[sockread]] -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables that we will use below&lt;br /&gt;
   var %offset, %name, %map, %game, %num, %max, %ip, %dir&lt;br /&gt;
  &lt;br /&gt;
   ; following the protocol, this &amp;quot;m&amp;quot; shows us that we queried a Half-Life 1 server&lt;br /&gt;
   if ([[$chr]]([[$bvar]](&amp;amp;reply,5)) == m) {&lt;br /&gt;
     ; Half-Life 1 info reply&lt;br /&gt;
  &lt;br /&gt;
     %offset = 6&lt;br /&gt;
  &lt;br /&gt;
     ; save the ip&lt;br /&gt;
     %ip = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     [[inc]] %offset [[$calc]]([[$len]]($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the same&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the current map&lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the game directory&lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the name of the game&lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; current and maximum players&lt;br /&gt;
     %num = $bvar(&amp;amp;reply,%offset)&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 1))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; else we get data for a CS:Source game&lt;br /&gt;
   else {&lt;br /&gt;
     ; Source info reply&lt;br /&gt;
     ; we do the same as above&lt;br /&gt;
     %offset = 7&lt;br /&gt;
  &lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %num = $bvar(&amp;amp;reply,$calc(%offset + 2))&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 3))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; now we echo all stored details to the active window&lt;br /&gt;
   [[echo]] -a Info for [[$sock]]([[$sockname]]).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
   echo -a Name: %name&lt;br /&gt;
   echo -a Map: %map&lt;br /&gt;
   echo -a Game: %game&lt;br /&gt;
   echo -a Players: %num $+ / $+ %max&lt;br /&gt;
  &lt;br /&gt;
   ; and turn off the timer closing the socket&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; as we can close it now manually&lt;br /&gt;
   [[sockclose]] $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 ; this is the alias that will be called from hlplay to open the socket&lt;br /&gt;
 alias hlchal {&lt;br /&gt;
   ; $1 = ip, $2 = port, $3- = what to call when received&lt;br /&gt;
   ; use dynamic socket name as above&lt;br /&gt;
   var %sock = $+(hlchal-,$ticks)&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   bset &amp;amp;t 1 255 255 255 255 85 255 255 255 255&lt;br /&gt;
   ; open the socket, and ask for a player challenge number&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; mark it with the ip and port (and the query we want to call when we&#039;ve received something from the server)&lt;br /&gt;
   [[sockmark]] %sock $3- $1-2&lt;br /&gt;
   ; and make a new timer to close it after 60 seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; read everything that comes back from the hlchal-* query&lt;br /&gt;
 on *:UDPREAD:hlchal-*:{&lt;br /&gt;
   ; and save it in the binary variable called &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
   ; actually call the alias saved in the sockmark (hlplay_query)&lt;br /&gt;
   $sock($sockname).mark $bvar(&amp;amp;reply,6,4)&lt;br /&gt;
   ; and turn the timer off because we can close it manually&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias we can call to make everything easier&lt;br /&gt;
 ; it will call other aliases to open sockets etc.&lt;br /&gt;
 alias hlplay {&lt;br /&gt;
   if (!$2) tokenize 58 $1&lt;br /&gt;
   hlchal $1-2 hlplay_query&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens the _real_ socket to receive data (everything before was just to challenge the server (read the website mentioned above))&lt;br /&gt;
 alias hlplay_query {&lt;br /&gt;
   ; set a binary variable&lt;br /&gt;
   bset &amp;amp;query 1 255 255 255 255 85 $3-&lt;br /&gt;
   ; use dynamic socket names again&lt;br /&gt;
   var %sock = $+(hlplay-,$ticks)&lt;br /&gt;
   ; open the socket&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;query&lt;br /&gt;
   ; and turn on the timer closing the socket after 60seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will receive all data from the server as response to our query&lt;br /&gt;
 on *:UDPREAD:hlplay-*:{&lt;br /&gt;
   ; we save it in &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables we will use later&lt;br /&gt;
   var %i = 1, %num = $bvar(&amp;amp;reply,6), %offset = 7&lt;br /&gt;
   var %count = 0, %name, %kills&lt;br /&gt;
  &lt;br /&gt;
   ; and echo the number of players&lt;br /&gt;
   echo -a Players on $sock($sockname).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
  &lt;br /&gt;
   ; now we can loop through all player and save some details about them&lt;br /&gt;
   [[while]] (%i &amp;lt;= %num) {&lt;br /&gt;
     inc %offset&lt;br /&gt;
  &lt;br /&gt;
     ; the name&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the kills&lt;br /&gt;
     %kills = $bvar(&amp;amp;reply,%offset).long&lt;br /&gt;
     if ($isbit(%kills,32)) dec %kills $calc(2^32)&lt;br /&gt;
     inc %offset 8&lt;br /&gt;
  &lt;br /&gt;
     ; and if there was a player&lt;br /&gt;
     if (%name != $null) {&lt;br /&gt;
       ; increase the variable that shows us the number of the player&lt;br /&gt;
       inc %count&lt;br /&gt;
       ; and echo it to the active window with the kills saved above&lt;br /&gt;
       echo -a %count $+ . %name - %kills&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; increase %i so we go on with the next player&lt;br /&gt;
     inc %i&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; if there are no players online, echo it aswell&lt;br /&gt;
   if (%count == 0) echo -a No players found!&lt;br /&gt;
  &lt;br /&gt;
   ; turn off the timer&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; and close the socket manually&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to RCON a source engine based server]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5538</id>
		<title>How to RCON a source engine based server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5538"/>
		<updated>2011-02-13T19:58:01Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Source RCON control snippet by NaNg&lt;br /&gt;
 ; Date: 12-02-2011&lt;br /&gt;
 ; Tested on mIRC 7.14&lt;br /&gt;
 ;&lt;br /&gt;
 ; Remote control window for Source engine based games (e.g. HL2, OrangeBox, CS:S, CSP etc.),&lt;br /&gt;
 ; based on the Source RCON Protocol found at http://developer.valvesoftware.com/wiki/Source_RCON_Protocol&lt;br /&gt;
 ;&lt;br /&gt;
 ; Warning! I couldn&#039;t find a perfect way to open the socket nicely everytime it closes, so don&#039;t rely on it&lt;br /&gt;
 ; to be connected 24/7 (plus, the socket is closed on the server side every changelevel).&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /sourcercon &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;pass&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; Define a prefix for sockent names.&lt;br /&gt;
 [[alias]] -l srcon.prefix { [[return]] SRcon }&lt;br /&gt;
  &lt;br /&gt;
 ; Set the command requests and response types.&lt;br /&gt;
 [[alias]] -l srcon.req.execcmd { [[return]] 2 }&lt;br /&gt;
 [[alias]] -l srcon.req.auth { [[return]] 3 }&lt;br /&gt;
 [[alias]] -l srcon.res.cmd { [[return]] 0 }&lt;br /&gt;
 [[alias]] -l srcon.res.auth { [[return]] 2 }&lt;br /&gt;
  &lt;br /&gt;
 ; Turn the given number to a 4-byte number.&lt;br /&gt;
 [[alias]] -l srcon.inttobytes {&lt;br /&gt;
   [[tokenize]] 46 [[$longip]]([[$1-|$1]])&lt;br /&gt;
   [[return]] [[$1-|$4]] [[$1-|$3]] [[$1-|$2]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Validates arguments and tries to open the socket to the game server for authentication.&lt;br /&gt;
 [[alias]] sourcercon {&lt;br /&gt;
   ; Validate arguments (simple, no need for full validation).&lt;br /&gt;
   [[If-Then-Else|if]] ((![[$longip]]([[$1-|$1]])) || ([[$1-|$2]] !isnum 1-65536) || (![[$1-|$3]])) {&lt;br /&gt;
     [[echo]] -ag Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Save the server&#039;s address.&lt;br /&gt;
   [[Local_Variables|var]] %server.addr = [[DollarPlus|$+]]([[$1-|$1]],:,[[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Check that the user has not opened a Rcon window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a Rcon step over another Rcon for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag Rcon window for [[$1-|$1]] is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Open the Rcon window whilst activating it, with an editbox, hide the @ prefix and maximize it.&lt;br /&gt;
   window -aek0x @ [[DollarPlus|$+]] %server.addr&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Source RCON window. Type a command\cvar to send to the server, responses will be displayed here.&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Warning! commands like exit or quit will close the server! avoid using them!&lt;br /&gt;
  &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($srcon.prefix,%server.addr)&lt;br /&gt;
  &lt;br /&gt;
   ; Open the socket to the server.&lt;br /&gt;
   [[sockopen]] %sockname [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
  &lt;br /&gt;
   ; Mark the socket with the Rcon password.&lt;br /&gt;
   [[sockmark]] %sockname [[$1-|$3]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Catch all sockopens with the Source Rcon sockets prefix.&lt;br /&gt;
 ; Build the authentication request packet and send it to the server.&lt;br /&gt;
 on *:SOCKOPEN:$([[DollarPlus|$+]]($srcon.prefix, *)): {&lt;br /&gt;
   ; Initialize the request ID for the connection.&lt;br /&gt;
   [[set]] %srcon.id. [[DollarPlus|$+]] [[$sockname]] 0&lt;br /&gt;
  &lt;br /&gt;
   ; Constructed auth request to send to the server.&lt;br /&gt;
   srcon.getrequest &amp;amp;srcon.auth %srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ] $srcon.req.auth [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
   ; Send the authentication packet.&lt;br /&gt;
   [[sockwrite]] [[$sockname]] &amp;amp;srcon.auth&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Read data from the game server.&lt;br /&gt;
 on *:SOCKREAD:$([[DollarPlus|$+]]($srcon.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If there were errors, $sockerr will tell us so.&lt;br /&gt;
   ; Write the error message to the window and clear the connection.&lt;br /&gt;
   [[If-Then-Else|if]] ($sockerr) {&lt;br /&gt;
     [[aline]] 04 %srcon.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     srcon.clear [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If a prior packet didn&#039;t finish receiving, continue reading it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$sockname]])) {&lt;br /&gt;
     ; Set the packet size.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$hget]]([[$sockname]], size)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = [[$hget]]([[$sockname]], left)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the request id.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$hget]]([[$sockname]], id)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the command response type.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$hget]]([[$sockname]], cmd)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the cut string1.&lt;br /&gt;
     [[noop]] [[$hget]]([[$sockname]], string1, &amp;amp;srcon.pckt.string1)&lt;br /&gt;
  &lt;br /&gt;
     ; Read the rest of string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.rest&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Append the rest of string1 to the already received string1.&lt;br /&gt;
     [[bcopy]] &amp;amp;srcon.pckt.string1 [[$calc]]([[$bvar]](&amp;amp;srcon.pckt.string1, 0) + 1) &amp;amp;srcon.pckt.rest 1 -1&lt;br /&gt;
  &lt;br /&gt;
     ; Clear the un-needed variables.&lt;br /&gt;
     [[hfree]] [[$sockname]]&lt;br /&gt;
   }&lt;br /&gt;
   ; Else, if the packet wasn&#039;t splitted.&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     ; Read the packet size.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.size&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$bvar]](&amp;amp;srcon.pckt.size, 1).long&lt;br /&gt;
  &lt;br /&gt;
     ; Initialize the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = %srcon.pckt.size&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet id.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.id&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$bvar]](&amp;amp;srcon.pckt.id, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; If the request id is an error, stop processing, display an error and clear the connection.&lt;br /&gt;
     [[If-Then-Else|if]] ($srcon.inttobytes(%srcon.pckt.id) == 255 255 255 255) {&lt;br /&gt;
       [[aline]] 04 %srcon.window * Error: Failed authentication (probably wrong password).&lt;br /&gt;
       srcon.clear [[$sockname]]&lt;br /&gt;
       [[return]]&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet command response type.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.cmd&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$bvar]](&amp;amp;srcon.pckt.cmd, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Read string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.string1&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If the number of bytes left to read is still positive, the packet was splitted.&lt;br /&gt;
   ; This means that we&#039;ll save the variables to globals so it can be used in the next read.&lt;br /&gt;
   [[If-Then-Else|if]] (%srcon.pckt.left &amp;gt; 0) {&lt;br /&gt;
     [[hmake]] [[$sockname]]&lt;br /&gt;
     [[hadd]] [[$sockname]] size %srcon.pckt.size&lt;br /&gt;
     [[hadd]] [[$sockname]] left %srcon.pckt.left&lt;br /&gt;
     [[hadd]] [[$sockname]] id %srcon.pckt.id&lt;br /&gt;
     [[hadd]] [[$sockname]] cmd %srcon.pckt.cmd&lt;br /&gt;
     [[hadd]] -b [[$sockname]] string1 &amp;amp;srcon.pckt.string1&lt;br /&gt;
   }&lt;br /&gt;
   ; Only if we&#039;ve finished reading all the packet, display it.&lt;br /&gt;
   ; NOTE: At this point, string1 also contains string2 (the one 0x00 byte), however it doesn&#039;t matter to us&lt;br /&gt;
   ; since we&#039;re only reading the text which is terminated in string1 by a 0x00 byte.&lt;br /&gt;
   [[If-Then-Else|elseif]] (%srcon.pckt.left == 0) {&lt;br /&gt;
     ; If the response type was an auth response, display a &amp;quot;connected&amp;quot; message.&lt;br /&gt;
     [[If-Then-Else|if]] (%srcon.pckt.cmd == $srcon.res.auth) {&lt;br /&gt;
       [[aline]] 12 %srcon.window Now connected!&lt;br /&gt;
     }&lt;br /&gt;
     ; If the response type was a command response, display it.&lt;br /&gt;
     [[If-Then-Else|elseif]] (%srcon.pckt.cmd == $srcon.res.cmd) {&lt;br /&gt;
       ; Convert the binary string1 to a usable variable.&lt;br /&gt;
       [[Local_Variables|var]] %srcon.pckt.string1 = [[$bvar]](&amp;amp;srcon.pckt.string1, 1, [[$bvar]](&amp;amp;srcon.pckt.string1, 0)).text&lt;br /&gt;
  &lt;br /&gt;
       ; Tokenize the lines to be printed and print them.&lt;br /&gt;
       [[tokenize]] [[$asc]]([[$lf]]) %srcon.pckt.string1&lt;br /&gt;
       [[aline]] %srcon.window [[$$|$*]]&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sockets may close on their own if not kept alive.&lt;br /&gt;
 ; In case that happens when the window is still open, the socket will be reopened.&lt;br /&gt;
 on *:SOCKCLOSE:$([[DollarPlus|$+]]($srcon.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If the window and the current request id still exists, reopen the socket.&lt;br /&gt;
   [[If-Then-Else|if]] (([[$window_(remote)|$window(]]%srcon.window)) &amp;amp;&amp;amp; (%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ])) {&lt;br /&gt;
     ; Save the socket details before terminating it.&lt;br /&gt;
     %srcon.name = [[$sockname]]&lt;br /&gt;
     %srcon.ip = [[$sock]]([[$sockname]]).ip&lt;br /&gt;
     %srcon.port = [[$sock]]([[$sockname]]).port&lt;br /&gt;
     %srcon.pass = [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
     ; Terminate the socket so it could be reopened.&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
  &lt;br /&gt;
     ; Reopen the socket to the server.&lt;br /&gt;
     [[sockopen]] %srcon.name %srcon.ip %srcon.port&lt;br /&gt;
  &lt;br /&gt;
     ; Mark the socket with the Rcon password.&lt;br /&gt;
     [[sockmark]] %srcon.name %srcon.pass&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sends user input to the server as is.&lt;br /&gt;
 ; NOTE: Commands like exit or quit will close the server!&lt;br /&gt;
 on *:INPUT:@: {&lt;br /&gt;
   ; Get the socket name.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.socket = [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
  &lt;br /&gt;
   ; Check if the socket is still alive.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$sock]](%srcon.socket)) {&lt;br /&gt;
     [[aline]] 04 $target * Error: Socket is dead. Close the window and try again.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Build the execute command request packet and send it to the server.&lt;br /&gt;
  &lt;br /&gt;
   ; Increment the current request id.&lt;br /&gt;
   [[inc]] %srcon.id. [[DollarPlus|$+]] %srcon.socket&lt;br /&gt;
  &lt;br /&gt;
   ; Construct the request to send to the game server.&lt;br /&gt;
   srcon.getrequest &amp;amp;srcon.cmd %srcon.id. [ [[DollarPlus|$+]] [ %srcon.socket ] ] $srcon.req.execcmd [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   [[aline]] $target -&amp;gt; [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Send the command request.&lt;br /&gt;
   [[sockwrite]] %srcon.socket &amp;amp;srcon.cmd&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; If the user has closed the rcon window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   srcon.clear [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Constructs a request with the given parameters:&lt;br /&gt;
 ; $1 = Bvar to store the request&lt;br /&gt;
 ; $2 = Request ID&lt;br /&gt;
 ; $3 = Request type&lt;br /&gt;
 ; $4- = Request data (password/command)&lt;br /&gt;
 [[alias]] -l srcon.getrequest {&lt;br /&gt;
   ; Clear the given bvar to make sure it doesn&#039;t contain any preset values.&lt;br /&gt;
   [[bunset]] [[$1-|$1]]&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request ID in the request.&lt;br /&gt;
   [[bset]] [[$1-|$1]] 5 $srcon.inttobytes([[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request type.&lt;br /&gt;
   [[bset]] [[$1-|$1]] 9 $srcon.inttobytes([[$1-|$3]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set string1 the request data.&lt;br /&gt;
   [[bset]] -t [[$1-|$1]] 13 [[$1-|$4-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Terminate string1 with 0x00 and set string2 to 0x00.&lt;br /&gt;
   [[bset]] [[$1-|$1]] [[$calc]]([[$bvar]]([[$1-|$1]],0) + 1) 00 00&lt;br /&gt;
  &lt;br /&gt;
   ; Set the packet size.&lt;br /&gt;
   [[bset]] [[$1-|$1]] 1 $srcon.inttobytes([[$calc]]([[$bvar]]([[$1-|$1]], 0) - 4))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Clears the socket and the request id.&lt;br /&gt;
 [[alias]] -l srcon.clear {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[$1-|$1]])) {&lt;br /&gt;
     [[sockclose]] [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Clear the id var.&lt;br /&gt;
   [[Unset|unset]] %srcon.id. [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5537</id>
		<title>How to RCON a source engine based server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5537"/>
		<updated>2011-02-13T19:18:36Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Source RCON control snippet by NaNg&lt;br /&gt;
 ; Date: 12-02-2011&lt;br /&gt;
 ; Tested on mIRC 7.14&lt;br /&gt;
 ;&lt;br /&gt;
 ; Remote control window for Source engine based games (e.g. HL2, OrangeBox, CS:S, CSP etc.),&lt;br /&gt;
 ; based on the Source RCON Protocol found at http://developer.valvesoftware.com/wiki/Source_RCON_Protocol&lt;br /&gt;
 ;&lt;br /&gt;
 ; Warning! I couldn&#039;t find a perfect way to open the socket nicely everytime it closes, so don&#039;t rely on it&lt;br /&gt;
 ; to be connected 24/7 (plus, the socket is closed on the server side every changelevel).&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /sourcercon &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;pass&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; Define a prefix for sockent names.&lt;br /&gt;
 [[alias]] -l srcon.prefix { [[return]] SRcon }&lt;br /&gt;
  &lt;br /&gt;
 ; Set the command requests and response types.&lt;br /&gt;
 [[alias]] -l srcon.req.execcmd { [[return]] 2 }&lt;br /&gt;
 [[alias]] -l srcon.req.auth { [[return]] 3 }&lt;br /&gt;
 [[alias]] -l srcon.res.cmd { [[return]] 0 }&lt;br /&gt;
 [[alias]] -l srcon.res.auth { [[return]] 2 }&lt;br /&gt;
  &lt;br /&gt;
 ; Turn the given number to a 4-byte number.&lt;br /&gt;
 [[alias]] -l srcon.inttobytes {&lt;br /&gt;
   [[tokenize]] 46 [[$longip]]([[$1-|$1]])&lt;br /&gt;
   [[return]] [[$1-|$4]] [[$1-|$3]] [[$1-|$2]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Validates arguments and tries to open the socket to the game server for authentication.&lt;br /&gt;
 [[alias]] sourcercon {&lt;br /&gt;
   ; Validate arguments (simple, no need for full validation).&lt;br /&gt;
   [[If-Then-Else|if]] ((![[$longip]]([[$1-|$1]])) || ([[$1-|$2]] !isnum 1-65536) || (![[$1-|$3]])) {&lt;br /&gt;
     [[echo]] -ag Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Save the server&#039;s address.&lt;br /&gt;
   [[Local_Variables|var]] %server.addr = [[DollarPlus|$+]]([[$1-|$1]],:,[[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Check that the user has not opened a Rcon window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a Rcon step over another Rcon for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag Rcon window for [[$1-|$1]] is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Open the Rcon window whilst activating it, with an editbox, hide the @ prefix and maximize it.&lt;br /&gt;
   window -aek0x @ [[DollarPlus|$+]] %server.addr&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Source RCON window. Type a command\cvar to send to the server, responses will be displayed here.&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Warning! commands like exit or quit will close the server! avoid using them!&lt;br /&gt;
  &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($srcon.prefix,%server.addr)&lt;br /&gt;
  &lt;br /&gt;
   ; Open the socket to the server.&lt;br /&gt;
   [[sockopen]] %sockname [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
  &lt;br /&gt;
   ; Mark the socket with the Rcon password.&lt;br /&gt;
   [[sockmark]] %sockname [[$1-|$3]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Catch all sockopens with the Source Rcon sockets prefix.&lt;br /&gt;
 ; Build the authentication request packet and send it to the server.&lt;br /&gt;
 on *:SOCKOPEN:$([[DollarPlus|$+]]($srcon.prefix, *)): {&lt;br /&gt;
   ; Initialize the request ID for the connection.&lt;br /&gt;
   [[set]] %srcon.id. [[DollarPlus|$+]] [[$sockname]] 0&lt;br /&gt;
  &lt;br /&gt;
   ; Constructed auth request to send to the server.&lt;br /&gt;
   srcon.getrequest &amp;amp;srcon.auth %srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ] $srcon.req.auth [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
   ; Send the authentication packet.&lt;br /&gt;
   [[sockwrite]] [[$sockname]] &amp;amp;srcon.auth&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Read data from the game server.&lt;br /&gt;
 on *:SOCKREAD:$([[DollarPlus|$+]]($srcon.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If there were errors, $sockerr will tell us so.&lt;br /&gt;
   ; Write the error message to the window and clear the connection.&lt;br /&gt;
   [[If-Then-Else|if]] ($sockerr) {&lt;br /&gt;
     [[aline]] 04 %srcon.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     srcon.clear [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If a prior packet didn&#039;t finish receiving, continue reading it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$sockname]])) {&lt;br /&gt;
     ; Set the packet size.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$hget]]([[$sockname]], size)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = [[$hget]]([[$sockname]], left)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the request id.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$hget]]([[$sockname]], id)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the command response type.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$hget]]([[$sockname]], cmd)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the cut string1.&lt;br /&gt;
     [[noop]] [[$hget]]([[$sockname]], string1, &amp;amp;srcon.pckt.string1)&lt;br /&gt;
  &lt;br /&gt;
     ; Read the rest of string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.rest&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Append the rest of string1 to the already received string1.&lt;br /&gt;
     [[bcopy]] &amp;amp;srcon.pckt.string1 [[$calc]]([[$bvar]](&amp;amp;srcon.pckt.string1, 0) + 1) &amp;amp;srcon.pckt.rest 1 -1&lt;br /&gt;
  &lt;br /&gt;
     ; Clear the un-needed variables.&lt;br /&gt;
     [[hfree]] [[$sockname]]&lt;br /&gt;
   }&lt;br /&gt;
   ; Else, if the packet wasn&#039;t splitted.&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     ; Read the packet size.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.size&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$bvar]](&amp;amp;srcon.pckt.size, 1).long&lt;br /&gt;
  &lt;br /&gt;
     ; Initialize the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = %srcon.pckt.size&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet id.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.id&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$bvar]](&amp;amp;srcon.pckt.id, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; If the request id is an error, stop processing, display an error and clear the connection.&lt;br /&gt;
     [[If-Then-Else|if]] ($srcon.inttobytes(%srcon.pckt.id) == 255 255 255 255) {&lt;br /&gt;
       [[aline]] 04 %srcon.window * Error: Failed authentication (probably wrong password).&lt;br /&gt;
       srcon.clear [[$sockname]]&lt;br /&gt;
       [[return]]&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet command response type.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.cmd&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$bvar]](&amp;amp;srcon.pckt.cmd, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Read string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.string1&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If the number of bytes left to read is still positive, the packet was splitted.&lt;br /&gt;
   ; This means that we&#039;ll save the variables to globals so it can be used in the next read.&lt;br /&gt;
   [[If-Then-Else|if]] (%srcon.pckt.left &amp;gt; 0) {&lt;br /&gt;
     [[hmake]] [[$sockname]]&lt;br /&gt;
     [[hadd]] [[$sockname]] size %srcon.pckt.size&lt;br /&gt;
     [[hadd]] [[$sockname]] left %srcon.pckt.left&lt;br /&gt;
     [[hadd]] [[$sockname]] id %srcon.pckt.id&lt;br /&gt;
     [[hadd]] [[$sockname]] cmd %srcon.pckt.cmd&lt;br /&gt;
     [[hadd]] -b [[$sockname]] string1 &amp;amp;srcon.pckt.string1&lt;br /&gt;
   }&lt;br /&gt;
   ; Only if we&#039;ve finished reading all the packet, display it.&lt;br /&gt;
   ; NOTE: At this point, string1 also contains string2 (the one 0x00 byte), however it doesn&#039;t matter to us&lt;br /&gt;
   ; since we&#039;re only reading the text which is terminated in string1 by a 0x00 byte.&lt;br /&gt;
   [[If-Then-Else|elseif]] (%srcon.pckt.left == 0) {&lt;br /&gt;
     ; If the response type was an auth response, display a &amp;quot;connected&amp;quot; message.&lt;br /&gt;
     [[If-Then-Else|if]] (%srcon.pckt.cmd == $srcon.res.auth) {&lt;br /&gt;
       [[aline]] 12 %srcon.window Now connected!&lt;br /&gt;
     }&lt;br /&gt;
     ; If the response type was a command response, display it.&lt;br /&gt;
     [[If-Then-Else|elseif]] (%srcon.pckt.cmd == $srcon.res.cmd) {&lt;br /&gt;
       ; Convert the binary string1 to a usable variable.&lt;br /&gt;
       [[Local_Variables|var]] %srcon.pckt.string1 = [[$bvar]](&amp;amp;srcon.pckt.string1, 1, [[$bvar]](&amp;amp;srcon.pckt.string1, 0)).text&lt;br /&gt;
  &lt;br /&gt;
       ; Tokenize the lines to be printed and print them.&lt;br /&gt;
       [[tokenize]] [[$asc]]([[$lf]]) %srcon.pckt.string1&lt;br /&gt;
       [[aline]] %srcon.window [[$$|$*]]&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sockets may close on their own if not kept alive.&lt;br /&gt;
 ; In case that happens when the window is still open, the socket will be reopened.&lt;br /&gt;
 on *:SOCKCLOSE:$([[DollarPlus|$+]]($srcon.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If the window and the current request id still exists, reopen the socket.&lt;br /&gt;
   [[If-Then-Else|if]] (([[$window_(remote)|$window(]]%srcon.window)) &amp;amp;&amp;amp; (%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ])) {&lt;br /&gt;
     ; Save the socket details before terminating it.&lt;br /&gt;
     %srcon.name = [[$sockname]]&lt;br /&gt;
     %srcon.ip = [[$sock]]([[$sockname]]).ip&lt;br /&gt;
     %srcon.port = [[$sock]]([[$sockname]]).port&lt;br /&gt;
     %srcon.pass = [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
     ; Terminate the socket so it could be reopened.&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
  &lt;br /&gt;
     ; Reopen the socket to the server.&lt;br /&gt;
     [[sockopen]] %srcon.name %srcon.ip %srcon.port&lt;br /&gt;
  &lt;br /&gt;
     ; Mark the socket with the Rcon password.&lt;br /&gt;
     [[sockmark]] %srcon.name %srcon.pass&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sends user input to the server as is.&lt;br /&gt;
 ; NOTE: Commands like exit or quit will close the server!&lt;br /&gt;
 on *:INPUT:@: {&lt;br /&gt;
   ; Get the socket name.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.socket = [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
  &lt;br /&gt;
   ; Check if the socket is still alive.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$sock]](%srcon.socket)) {&lt;br /&gt;
     [[aline]] 04 $target * Error: Socket is dead. Close the window and try again.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Build the execute command request packet and send it to the server.&lt;br /&gt;
  &lt;br /&gt;
   ; Increment the current request id.&lt;br /&gt;
   [[inc]] %srcon.id. [[DollarPlus|$+]] %srcon.socket&lt;br /&gt;
  &lt;br /&gt;
   ; Construct the request to send to the game server.&lt;br /&gt;
   srcon.getrequest &amp;amp;srcon.cmd %srcon.id. [ [[DollarPlus|$+]] [ %srcon.socket ] ] $srcon.req.execcmd [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   [[aline]] $target -&amp;gt; [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Send the command request.&lt;br /&gt;
   [[sockwrite]] %srcon.socket &amp;amp;srcon.cmd&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; If the user has closed the rcon window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   srcon.clear [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Constructs a request with the given parameters:&lt;br /&gt;
 ; $1 = Bvar to store the request&lt;br /&gt;
 ; $2 = Request ID&lt;br /&gt;
 ; $3 = Request type&lt;br /&gt;
 ; $4- = Request data (password/command)&lt;br /&gt;
 [[alias]] -l srcon.getrequest {&lt;br /&gt;
   ; Clear the given bvar to make sure it doesn&#039;t contain any preset values.&lt;br /&gt;
   [[bunset]] [[$1-|$1]]&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request ID in the request.&lt;br /&gt;
   [[bset]] [[$1-|$1]] 5 $srcon.inttobytes([[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request type.&lt;br /&gt;
   [[bset]] [[$1-|$1]] 9 $srcon.inttobytes([[$1-|$3]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set string1 the request data.&lt;br /&gt;
   [[bset]] -t [[$1-|$1]] 13 [[$1-|$4-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Terminate string1 with 0x00 and set string2 to 0x00.&lt;br /&gt;
   [[bset]] [[$1-|$1]] [[$calc]]([[$bvar]]([[$1-|$1]],0) + 1) 00 00&lt;br /&gt;
  &lt;br /&gt;
   ; Set the packet size.&lt;br /&gt;
   [[bset]] [[$1-|$1]] 1 $srcon.inttobytes([[$calc]]([[$bvar]]([[$1-|$1]], 0) - 4))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Clears the socket and the request id.&lt;br /&gt;
 [[alias]] -l srcon.clear {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[$1-|$1]])) {&lt;br /&gt;
     [[sockclose]] [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Clear the id var.&lt;br /&gt;
   [[Unset|unset]] %srcon.id. [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How_to_query_a_CS_Server]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5536</id>
		<title>How to RCON a source engine based server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5536"/>
		<updated>2011-02-12T20:46:45Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: added see also&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Source RCON control snippet by NaNg&lt;br /&gt;
 ; Date: 10-02-2011&lt;br /&gt;
 ;&lt;br /&gt;
 ; Remote control window for Source engine based games (e.g. HL2, OrangeBox, CS:S, CSP etc.),&lt;br /&gt;
 ; based on the Source RCON Protocol found at http://developer.valvesoftware.com/wiki/Source_RCON_Protocol&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /sourcercon &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;pass&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; Define a prefix for sockent names.&lt;br /&gt;
 [[alias]] -l srcon.prefix { [[return]] SRcon }&lt;br /&gt;
  &lt;br /&gt;
 ; Set the command requests and response types.&lt;br /&gt;
 [[alias]] -l srcon.req.execcmd { [[return]] 2 }&lt;br /&gt;
 [[alias]] -l srcon.req.auth { [[return]] 3 }&lt;br /&gt;
 [[alias]] -l srcon.res.cmd { [[return]] 0 }&lt;br /&gt;
 [[alias]] -l srcon.res.auth { [[return]] 2 }&lt;br /&gt;
  &lt;br /&gt;
 ; Turn the given number to a 4-byte number.&lt;br /&gt;
 [[alias]] -l srcon.inttobytes {&lt;br /&gt;
   [[tokenize]] 46 [[$longip]]([[$1-|$1]])&lt;br /&gt;
   [[return]] [[$1-|$4]] [[$1-|$3]] [[$1-|$2]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Validates arguments and tries to open the socket to the game server for authentication.&lt;br /&gt;
 [[alias]] sourcercon {&lt;br /&gt;
   ; Validate arguments (simple, no need for full validation).&lt;br /&gt;
   [[If-Then-Else|if]] ((![[$longip]]([[$1-|$1]])) || ([[$1-|$2]] !isnum 1-65536) || (![[$1-|$3]])) {&lt;br /&gt;
     [[echo]] -ag Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Save the server&#039;s address.&lt;br /&gt;
   [[Local_Variables|var]] %server.addr = [[DollarPlus|$+]]([[$1-|$1]],:,[[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Check that the user has not opened a Rcon window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a Rcon step over another Rcon for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag Rcon window for [[$1-|$1]] is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Open the Rcon window whilst activating it, with an editbox, hide the @ prefix and maximize it.&lt;br /&gt;
   window -aek0x @ [[DollarPlus|$+]] %server.addr sourcercon.execcmd&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Source RCON window. If there&#039;s no error, you&#039;re connected!&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Type a command\cvar to send to the server, responses will be displayed here.&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Warning! commands like exit or quit will close the server! avoid using them!&lt;br /&gt;
  &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($srcon.prefix,%server.addr)&lt;br /&gt;
  &lt;br /&gt;
   ; Open the socket to the server.&lt;br /&gt;
   [[sockopen]] %sockname [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
  &lt;br /&gt;
   ; Mark the socket with the Rcon password.&lt;br /&gt;
   [[sockmark]] %sockname [[$1-|$3]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Catch all sockopens with the Source Rcon sockets prefix.&lt;br /&gt;
 ; Build the authentication request packet and send it to the server.&lt;br /&gt;
 on *:SOCKOPEN:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Initialize the request ID for the connection.&lt;br /&gt;
   [[set]] %srcon.id. [[DollarPlus|$+]] [[$sockname]] 0&lt;br /&gt;
  &lt;br /&gt;
   ; Constructed auth request to send to the server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ], $srcon.req.auth, [[$sock]]([[$sockname]]).mark, &amp;amp;srcon.auth)&lt;br /&gt;
  &lt;br /&gt;
   ; Send the authentication packet.&lt;br /&gt;
   [[sockwrite]] [[$sockname]] &amp;amp;srcon.auth&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Read data from the game server.&lt;br /&gt;
 on *:SOCKREAD:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If there were errors, $sockerr will tell us so.&lt;br /&gt;
   ; Write the error message to the window and clear the connection.&lt;br /&gt;
   [[If-Then-Else|if]] ($sockerr) {&lt;br /&gt;
     [[aline]] 04 %srcon.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     srcon.clear [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If a prior packet didn&#039;t finish receiving, continue reading it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$sockname]])) {&lt;br /&gt;
     ; Set the packet size.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$hget]]([[$sockname]], size)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = [[$hget]]([[$sockname]], left)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the request id.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$hget]]([[$sockname]], id)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the command response type.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$hget]]([[$sockname]], cmd)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the cut string1.&lt;br /&gt;
     [[noop]] [[$hget]]([[$sockname]], string1, &amp;amp;srcon.pckt.string1)&lt;br /&gt;
  &lt;br /&gt;
     ; Read the rest of string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.rest&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Append the rest of string1 to the already received string1.&lt;br /&gt;
     [[bcopy]] &amp;amp;srcon.pckt.string1 [[$calc]]([[$bvar]](&amp;amp;srcon.pckt.string1, 0) + 1) &amp;amp;srcon.pckt.rest 1 -1&lt;br /&gt;
  &lt;br /&gt;
     ; Clear the un-needed variables.&lt;br /&gt;
     [[hfree]] [[$sockname]]&lt;br /&gt;
   }&lt;br /&gt;
   ; Else, if the packet wasn&#039;t splitted.&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     ; Read the packet size.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.size&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$bvar]](&amp;amp;srcon.pckt.size, 1).long&lt;br /&gt;
  &lt;br /&gt;
     ; Initialize the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = %srcon.pckt.size&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet id.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.id&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$bvar]](&amp;amp;srcon.pckt.id, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; If the request id is an error, stop processing, display an error and clear the connection.&lt;br /&gt;
     [[If-Then-Else|if]] ($srcon.inttobytes(%srcon.pckt.id) == 255 255 255 255) {&lt;br /&gt;
       [[aline]] 04 %srcon.window * Error: Failed authentication (probably wrong password).&lt;br /&gt;
       srcon.clear [[$sockname]]&lt;br /&gt;
       [[return]]&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet command response type.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.cmd&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$bvar]](&amp;amp;srcon.pckt.cmd, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Read string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.string1&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If the number of bytes left to read is still positive, the packet was splitted.&lt;br /&gt;
   ; This means that we&#039;ll save the variables to globals so it can be used in the next read.&lt;br /&gt;
   [[If-Then-Else|if]] (%srcon.pckt.left &amp;gt; 0) {&lt;br /&gt;
     [[hmake]] [[$sockname]]&lt;br /&gt;
     [[hadd]] [[$sockname]] size %srcon.pckt.size&lt;br /&gt;
     [[hadd]] [[$sockname]] left %srcon.pckt.left&lt;br /&gt;
     [[hadd]] [[$sockname]] id %srcon.pckt.id&lt;br /&gt;
     [[hadd]] [[$sockname]] cmd %srcon.pckt.cmd&lt;br /&gt;
     [[hadd]] -b [[$sockname]] string1 &amp;amp;srcon.pckt.string1&lt;br /&gt;
   }&lt;br /&gt;
   ; Only if we&#039;ve finished reading all the packet and the response type was a command response, display it.&lt;br /&gt;
   ; NOTE: At this point, string1 also contains string2 (the one 0x00 byte), however it doesn&#039;t matter to us&lt;br /&gt;
   ; since we&#039;re only reading the text which is terminated in string1 by a 0x00 byte.&lt;br /&gt;
   [[If-Then-Else|elseif]] ((%srcon.pckt.left == 0) &amp;amp;&amp;amp; (%srcon.pckt.cmd == $srcon.res.cmd)) {&lt;br /&gt;
     ; Convert the binary string1 to a usable variable.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.string1 = [[$bvar]](&amp;amp;srcon.pckt.string1, 1, [[$bvar]](&amp;amp;srcon.pckt.string1, 0)).text&lt;br /&gt;
  &lt;br /&gt;
     ; Tokenize the lines to be printed and print them.&lt;br /&gt;
     [[tokenize]] [[$asc]]([[$lf]]) %srcon.pckt.string1&lt;br /&gt;
     [[aline]] %srcon.window [[$$|$*]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sockets may close on their own if not kept alive.&lt;br /&gt;
 ; In case that happens when the window is still open, the socket will be reopened.&lt;br /&gt;
 on *:SOCKCLOSE:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If the window and the current request id still exists, reopen the socket.&lt;br /&gt;
   [[If-Then-Else|if]] (([[$window_(remote)|$window(]]%srcon.window)) &amp;amp;&amp;amp; (%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ])) {&lt;br /&gt;
     ; Save the socket details before terminating it.&lt;br /&gt;
     %srcon.name = [[$sockname]]&lt;br /&gt;
     %srcon.ip = [[$sock]]([[$sockname]]).ip&lt;br /&gt;
     %srcon.port = [[$sock]]([[$sockname]]).port&lt;br /&gt;
     %srcon.pass = [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
     ; Terminate the socket so it could be reopened.&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
  &lt;br /&gt;
     ; Reopen the socket to the server.&lt;br /&gt;
     [[sockopen]] %srcon.name %srcon.ip %srcon.port&lt;br /&gt;
  &lt;br /&gt;
     ; Mark the socket with the Rcon password.&lt;br /&gt;
     [[sockmark]] %srcon.name %srcon.pass&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sends user input to the server as is.&lt;br /&gt;
 ; NOTE: Commands like exit or quit will close the server!&lt;br /&gt;
 on *:INPUT:@: {&lt;br /&gt;
   ; Get the socket name.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.socket = [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
  &lt;br /&gt;
   ; Check if the socket is still alive.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$sock]](%srcon.socket)) {&lt;br /&gt;
     [[aline]] 04 $target * Error: Socket is dead. Close the window and try again.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Build the execute command request packet and send it to the server.&lt;br /&gt;
  &lt;br /&gt;
   ; Increment the current request id.&lt;br /&gt;
   [[inc]] %srcon.id. [[DollarPlus|$+]] %srcon.socket&lt;br /&gt;
  &lt;br /&gt;
   ; Construct the request to send to the game server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ %srcon.socket ] ], $srcon.req.execcmd, [[$1-|$1-]], &amp;amp;srcon.cmd)&lt;br /&gt;
  &lt;br /&gt;
   [[aline]] $target -&amp;gt; [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Send the command request.&lt;br /&gt;
   [[sockwrite]] %srcon.socket &amp;amp;srcon.cmd&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; If the user has closed the rcon window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   srcon.clear [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Constructs a request with the given parameters:&lt;br /&gt;
 ; $1 = Request ID&lt;br /&gt;
 ; $2 = Request type&lt;br /&gt;
 ; $3 = Request data (password/command)&lt;br /&gt;
 ; $4 = Bvar to store the request&lt;br /&gt;
 [[alias]] -l srcon.getrequest {&lt;br /&gt;
   ; Clear the given bvar to make sure it doesn&#039;t contain any preset values.&lt;br /&gt;
   [[bunset]] [[$1-|$4]]&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request ID in the request.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 5 $srcon.inttobytes([[$1-|$1]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request type.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 9 $srcon.inttobytes([[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set string1 the request data.&lt;br /&gt;
   [[bset]] -t [[$1-|$4]] 13 [[$1-|$3]]&lt;br /&gt;
  &lt;br /&gt;
   ; Terminate string1 with 0x00 and set string2 to 0x00.&lt;br /&gt;
   [[bset]] [[$1-|$4]] [[$calc]]([[$bvar]]([[$1-|$4]],0) + 1) 00 00&lt;br /&gt;
  &lt;br /&gt;
   ; Set the packet size.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 1 $srcon.inttobytes([[$calc]]([[$bvar]]([[$1-|$4]], 0) - 4))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Clears the socket and the request id.&lt;br /&gt;
 [[alias]] -l srcon.clear {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[$1-|$1]])) {&lt;br /&gt;
     [[sockclose]] [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Clear the id var.&lt;br /&gt;
   [[Unset|unset]] %srcon.id. [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How_to_query_a_CS_Server]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5535</id>
		<title>How to query a CS Server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5535"/>
		<updated>2011-02-12T20:43:14Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: added see also&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you want to e.g. get the number and names of all player who are currently playing on a CS-server, you have to send a so-called &amp;quot;query&amp;quot; to this server (using UDP) and handle everything the server sends back to you. This isn&#039;t as easy as it sounds. At first, you would have to &#039;learn&#039;, or, at least, understand the protocol a CS-server uses (e.g. what do I have to send to the server to get a &#039;good&#039; reply and what&#039;s the structure of this reply). If you want to learn more about these protocols, take a look at http://dev.kquery.com/ or http://www.valve-erc.com/srcsdk/Code/Networking/serverqueries.html or http://developer.valvesoftware.com/wiki/Server_Queries .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following script &#039;&#039;&#039;echo&#039;&#039;&#039;s the output to your active window. You will have to modify it to be able to use it as &#039;bot&#039;. It&#039;s a more complex script and you don&#039;t need to understand it (completely) to be able to use it.&lt;br /&gt;
&lt;br /&gt;
 ; HL server query snippet by Saturn&lt;br /&gt;
 ;&lt;br /&gt;
 ; 16-04-2009: update to protocol version 48 by NaNg&lt;br /&gt;
 ; 29-01-2011: update to fix UTF8 problem in mIRC 7.* and fixed name problems if last char is space by NaNg&lt;br /&gt;
 ;&lt;br /&gt;
 ; usage:&lt;br /&gt;
 ; /hlinfo &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlinfo &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
 ; /hlplay &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlplay &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens a new socket if you want to get general information about a running CS-server&lt;br /&gt;
 [[alias]] hlinfo {&lt;br /&gt;
   [[If-Then-Else|if]] (!$2) [[tokenize]] 58 [[$1-|$1]]&lt;br /&gt;
  &lt;br /&gt;
   ; using a dynamic socket name so we can use multiple instances at once&lt;br /&gt;
   [[var]] %sock = [[DollarPlus|$+]](hlinfo-,[[$ticks]])&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   [[bset]] &amp;amp;t 1 255 255 255 255&lt;br /&gt;
   bset -t &amp;amp;t 5 TSource Engine Query&lt;br /&gt;
   bset &amp;amp;t 25 0&lt;br /&gt;
   ; actually open the socket, and send the query&lt;br /&gt;
   [[sockudp]] -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; closing the socket after 60seconds if there is no response (else it will be closed by another event (see below))&lt;br /&gt;
   .[[timer]] $+ %sock 1 60 [[sockclose]] %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will get all data sent back from the server&lt;br /&gt;
 [[on_udpread|on *:UDPREAD]]:hlinfo-*:{&lt;br /&gt;
   ; save it in a binary variable&lt;br /&gt;
   [[sockread]] -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables that we will use below&lt;br /&gt;
   var %offset, %name, %map, %game, %num, %max, %ip, %dir&lt;br /&gt;
  &lt;br /&gt;
   ; following the protocol, this &amp;quot;m&amp;quot; shows us that we queried a Half-Life 1 server&lt;br /&gt;
   if ([[$chr]]([[$bvar]](&amp;amp;reply,5)) == m) {&lt;br /&gt;
     ; Half-Life 1 info reply&lt;br /&gt;
  &lt;br /&gt;
     %offset = 6&lt;br /&gt;
  &lt;br /&gt;
     ; save the ip&lt;br /&gt;
     %ip = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     [[inc]] %offset [[$calc]]([[$len]]($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the same&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the current map&lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the game directory&lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the name of the game&lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; current and maximum players&lt;br /&gt;
     %num = $bvar(&amp;amp;reply,%offset)&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 1))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; else we get data for a CS:Source game&lt;br /&gt;
   else {&lt;br /&gt;
     ; Source info reply&lt;br /&gt;
     ; we do the same as above&lt;br /&gt;
     %offset = 7&lt;br /&gt;
  &lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %num = $bvar(&amp;amp;reply,$calc(%offset + 2))&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 3))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; now we echo all stored details to the active window&lt;br /&gt;
   [[echo]] -a Info for [[$sock]]([[$sockname]]).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
   echo -a Name: %name&lt;br /&gt;
   echo -a Map: %map&lt;br /&gt;
   echo -a Game: %game&lt;br /&gt;
   echo -a Players: %num $+ / $+ %max&lt;br /&gt;
  &lt;br /&gt;
   ; and turn off the timer closing the socket&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; as we can close it now manually&lt;br /&gt;
   [[sockclose]] $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 ; this is the alias that will be called from hlplay to open the socket&lt;br /&gt;
 alias hlchal {&lt;br /&gt;
   ; $1 = ip, $2 = port, $3- = what to call when received&lt;br /&gt;
   ; use dynamic socket name as above&lt;br /&gt;
   var %sock = $+(hlchal-,$ticks)&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   bset &amp;amp;t 1 255 255 255 255 85 255 255 255 255&lt;br /&gt;
   ; open the socket, and ask for a player challenge number&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; mark it with the ip and port (and the query we want to call when we&#039;ve received something from the server)&lt;br /&gt;
   [[sockmark]] %sock $3- $1-2&lt;br /&gt;
   ; and make a new timer to close it after 60 seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; read everything that comes back from the hlchal-* query&lt;br /&gt;
 on *:UDPREAD:hlchal-*:{&lt;br /&gt;
   ; and save it in the binary variable called &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
   ; actually call the alias saved in the sockmark (hlplay_query)&lt;br /&gt;
   $sock($sockname).mark $bvar(&amp;amp;reply,6,4)&lt;br /&gt;
   ; and turn the timer off because we can close it manually&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias we can call to make everything easier&lt;br /&gt;
 ; it will call other aliases to open sockets etc.&lt;br /&gt;
 alias hlplay {&lt;br /&gt;
   if (!$2) tokenize 58 $1&lt;br /&gt;
   hlchal $1-2 hlplay_query&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens the _real_ socket to receive data (everything before was just to challenge the server (read the website mentioned above))&lt;br /&gt;
 alias hlplay_query {&lt;br /&gt;
   ; set a binary variable&lt;br /&gt;
   bset &amp;amp;query 1 255 255 255 255 85 $3-&lt;br /&gt;
   ; use dynamic socket names again&lt;br /&gt;
   var %sock = $+(hlplay-,$ticks)&lt;br /&gt;
   ; open the socket&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;query&lt;br /&gt;
   ; and turn on the timer closing the socket after 60seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will receive all data from the server as response to our query&lt;br /&gt;
 on *:UDPREAD:hlplay-*:{&lt;br /&gt;
   ; we save it in &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables we will use later&lt;br /&gt;
   var %i = 1, %num = $bvar(&amp;amp;reply,6), %offset = 7&lt;br /&gt;
   var %count = 0, %name, %kills&lt;br /&gt;
  &lt;br /&gt;
   ; and echo the number of players&lt;br /&gt;
   echo -a Players on $sock($sockname).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
  &lt;br /&gt;
   ; now we can loop through all player and save some details about them&lt;br /&gt;
   [[while]] (%i &amp;lt;= %num) {&lt;br /&gt;
     inc %offset&lt;br /&gt;
  &lt;br /&gt;
     ; the name&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the kills&lt;br /&gt;
     %kills = $bvar(&amp;amp;reply,%offset).long&lt;br /&gt;
     if ($isbit(%kills,32)) dec %kills $calc(2^32)&lt;br /&gt;
     inc %offset 8&lt;br /&gt;
  &lt;br /&gt;
     ; and if there was a player&lt;br /&gt;
     if (%name != $null) {&lt;br /&gt;
       ; increase the variable that shows us the number of the player&lt;br /&gt;
       inc %count&lt;br /&gt;
       ; and echo it to the active window with the kills saved above&lt;br /&gt;
       echo -a %count $+ . %name - %kills&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; increase %i so we go on with the next player&lt;br /&gt;
     inc %i&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; if there are no players online, echo it aswell&lt;br /&gt;
   if (%count == 0) echo -a No players found!&lt;br /&gt;
  &lt;br /&gt;
   ; turn off the timer&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; and close the socket manually&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[How_to_RCON_a_source_engine_based_server]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5533</id>
		<title>How to RCON a source engine based server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5533"/>
		<updated>2011-02-11T12:57:40Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Source RCON control snippet by NaNg&lt;br /&gt;
 ; Date: 10-02-2011&lt;br /&gt;
 ;&lt;br /&gt;
 ; Remote control window for Source engine based games (e.g. HL2, OrangeBox, CS:S, CSP etc.),&lt;br /&gt;
 ; based on the Source RCON Protocol found at http://developer.valvesoftware.com/wiki/Source_RCON_Protocol&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /sourcercon &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;pass&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; Define a prefix for sockent names.&lt;br /&gt;
 [[alias]] -l srcon.prefix { [[return]] SRcon }&lt;br /&gt;
  &lt;br /&gt;
 ; Set the command requests and response types.&lt;br /&gt;
 [[alias]] -l srcon.req.execcmd { [[return]] 2 }&lt;br /&gt;
 [[alias]] -l srcon.req.auth { [[return]] 3 }&lt;br /&gt;
 [[alias]] -l srcon.res.cmd { [[return]] 0 }&lt;br /&gt;
 [[alias]] -l srcon.res.auth { [[return]] 2 }&lt;br /&gt;
  &lt;br /&gt;
 ; Turn the given number to a 4-byte number.&lt;br /&gt;
 [[alias]] -l srcon.inttobytes {&lt;br /&gt;
   [[tokenize]] 46 [[$longip]]([[$1-|$1]])&lt;br /&gt;
   [[return]] [[$1-|$4]] [[$1-|$3]] [[$1-|$2]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Validates arguments and tries to open the socket to the game server for authentication.&lt;br /&gt;
 [[alias]] sourcercon {&lt;br /&gt;
   ; Validate arguments (simple, no need for full validation).&lt;br /&gt;
   [[If-Then-Else|if]] ((![[$longip]]([[$1-|$1]])) || ([[$1-|$2]] !isnum 1-65536) || (![[$1-|$3]])) {&lt;br /&gt;
     [[echo]] -ag Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Save the server&#039;s address.&lt;br /&gt;
   [[Local_Variables|var]] %server.addr = [[DollarPlus|$+]]([[$1-|$1]],:,[[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Check that the user has not opened a Rcon window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a Rcon step over another Rcon for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag Rcon window for [[$1-|$1]] is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Open the Rcon window whilst activating it, with an editbox, hide the @ prefix and maximize it.&lt;br /&gt;
   window -aek0x @ [[DollarPlus|$+]] %server.addr sourcercon.execcmd&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Source RCON window. If there&#039;s no error, you&#039;re connected!&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Type a command\cvar to send to the server, responses will be displayed here.&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Warning! commands like exit or quit will close the server! avoid using them!&lt;br /&gt;
  &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($srcon.prefix,%server.addr)&lt;br /&gt;
  &lt;br /&gt;
   ; Open the socket to the server.&lt;br /&gt;
   [[sockopen]] %sockname [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
  &lt;br /&gt;
   ; Mark the socket with the Rcon password.&lt;br /&gt;
   [[sockmark]] %sockname [[$1-|$3]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Catch all sockopens with the Source Rcon sockets prefix.&lt;br /&gt;
 ; Build the authentication request packet and send it to the server.&lt;br /&gt;
 on *:SOCKOPEN:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Initialize the request ID for the connection.&lt;br /&gt;
   [[set]] %srcon.id. [[DollarPlus|$+]] [[$sockname]] 0&lt;br /&gt;
  &lt;br /&gt;
   ; Constructed auth request to send to the server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ], $srcon.req.auth, [[$sock]]([[$sockname]]).mark, &amp;amp;srcon.auth)&lt;br /&gt;
  &lt;br /&gt;
   ; Send the authentication packet.&lt;br /&gt;
   [[sockwrite]] [[$sockname]] &amp;amp;srcon.auth&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Read data from the game server.&lt;br /&gt;
 on *:SOCKREAD:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If there were errors, $sockerr will tell us so.&lt;br /&gt;
   ; Write the error message to the window and clear the connection.&lt;br /&gt;
   [[If-Then-Else|if]] ($sockerr) {&lt;br /&gt;
     [[aline]] 04 %srcon.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     srcon.clear [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If a prior packet didn&#039;t finish receiving, continue reading it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$sockname]])) {&lt;br /&gt;
     ; Set the packet size.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$hget]]([[$sockname]], size)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = [[$hget]]([[$sockname]], left)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the request id.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$hget]]([[$sockname]], id)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the command response type.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$hget]]([[$sockname]], cmd)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the cut string1.&lt;br /&gt;
     [[noop]] [[$hget]]([[$sockname]], string1, &amp;amp;srcon.pckt.string1)&lt;br /&gt;
  &lt;br /&gt;
     ; Read the rest of string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.rest&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Append the rest of string1 to the already received string1.&lt;br /&gt;
     [[bcopy]] &amp;amp;srcon.pckt.string1 [[$calc]]([[$bvar]](&amp;amp;srcon.pckt.string1, 0) + 1) &amp;amp;srcon.pckt.rest 1 -1&lt;br /&gt;
  &lt;br /&gt;
     ; Clear the un-needed variables.&lt;br /&gt;
     [[hfree]] [[$sockname]]&lt;br /&gt;
   }&lt;br /&gt;
   ; Else, if the packet wasn&#039;t splitted.&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     ; Read the packet size.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.size&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$bvar]](&amp;amp;srcon.pckt.size, 1).long&lt;br /&gt;
  &lt;br /&gt;
     ; Initialize the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = %srcon.pckt.size&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet id.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.id&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$bvar]](&amp;amp;srcon.pckt.id, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; If the request id is an error, stop processing, display an error and clear the connection.&lt;br /&gt;
     [[If-Then-Else|if]] ($srcon.inttobytes(%srcon.pckt.id) == 255 255 255 255) {&lt;br /&gt;
       [[aline]] 04 %srcon.window * Error: Failed authentication (probably wrong password).&lt;br /&gt;
       srcon.clear [[$sockname]]&lt;br /&gt;
       [[return]]&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet command response type.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.cmd&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$bvar]](&amp;amp;srcon.pckt.cmd, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Read string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.string1&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If the number of bytes left to read is still positive, the packet was splitted.&lt;br /&gt;
   ; This means that we&#039;ll save the variables to globals so it can be used in the next read.&lt;br /&gt;
   [[If-Then-Else|if]] (%srcon.pckt.left &amp;gt; 0) {&lt;br /&gt;
     [[hmake]] [[$sockname]]&lt;br /&gt;
     [[hadd]] [[$sockname]] size %srcon.pckt.size&lt;br /&gt;
     [[hadd]] [[$sockname]] left %srcon.pckt.left&lt;br /&gt;
     [[hadd]] [[$sockname]] id %srcon.pckt.id&lt;br /&gt;
     [[hadd]] [[$sockname]] cmd %srcon.pckt.cmd&lt;br /&gt;
     [[hadd]] -b [[$sockname]] string1 &amp;amp;srcon.pckt.string1&lt;br /&gt;
   }&lt;br /&gt;
   ; Only if we&#039;ve finished reading all the packet and the response type was a command response, display it.&lt;br /&gt;
   ; NOTE: At this point, string1 also contains string2 (the one 0x00 byte), however it doesn&#039;t matter to us&lt;br /&gt;
   ; since we&#039;re only reading the text which is terminated in string1 by a 0x00 byte.&lt;br /&gt;
   [[If-Then-Else|elseif]] ((%srcon.pckt.left == 0) &amp;amp;&amp;amp; (%srcon.pckt.cmd == $srcon.res.cmd)) {&lt;br /&gt;
     ; Convert the binary string1 to a usable variable.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.string1 = [[$bvar]](&amp;amp;srcon.pckt.string1, 1, [[$bvar]](&amp;amp;srcon.pckt.string1, 0)).text&lt;br /&gt;
  &lt;br /&gt;
     ; Tokenize the lines to be printed and print them.&lt;br /&gt;
     [[tokenize]] [[$asc]]([[$lf]]) %srcon.pckt.string1&lt;br /&gt;
     [[aline]] %srcon.window [[$$|$*]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sockets may close on their own if not kept alive.&lt;br /&gt;
 ; In case that happens when the window is still open, the socket will be reopened.&lt;br /&gt;
 on *:SOCKCLOSE:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If the window and the current request id still exists, reopen the socket.&lt;br /&gt;
   [[If-Then-Else|if]] (([[$window_(remote)|$window(]]%srcon.window)) &amp;amp;&amp;amp; (%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ])) {&lt;br /&gt;
     ; Save the socket details before terminating it.&lt;br /&gt;
     %srcon.name = [[$sockname]]&lt;br /&gt;
     %srcon.ip = [[$sock]]([[$sockname]]).ip&lt;br /&gt;
     %srcon.port = [[$sock]]([[$sockname]]).port&lt;br /&gt;
     %srcon.pass = [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
     ; Terminate the socket so it could be reopened.&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
  &lt;br /&gt;
     ; Reopen the socket to the server.&lt;br /&gt;
     [[sockopen]] %srcon.name %srcon.ip %srcon.port&lt;br /&gt;
  &lt;br /&gt;
     ; Mark the socket with the Rcon password.&lt;br /&gt;
     [[sockmark]] %srcon.name %srcon.pass&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sends user input to the server as is.&lt;br /&gt;
 ; NOTE: Commands like exit or quit will close the server!&lt;br /&gt;
 on *:INPUT:@: {&lt;br /&gt;
   ; Get the socket name.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.socket = [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
  &lt;br /&gt;
   ; Check if the socket is still alive.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$sock]](%srcon.socket)) {&lt;br /&gt;
     [[aline]] 04 $target * Error: Socket is dead. Close the window and try again.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Build the execute command request packet and send it to the server.&lt;br /&gt;
  &lt;br /&gt;
   ; Increment the current request id.&lt;br /&gt;
   [[inc]] %srcon.id. [[DollarPlus|$+]] %srcon.socket&lt;br /&gt;
  &lt;br /&gt;
   ; Construct the request to send to the game server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ %srcon.socket ] ], $srcon.req.execcmd, [[$1-|$1-]], &amp;amp;srcon.cmd)&lt;br /&gt;
  &lt;br /&gt;
   [[aline]] $target -&amp;gt; [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Send the command request.&lt;br /&gt;
   [[sockwrite]] %srcon.socket &amp;amp;srcon.cmd&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; If the user has closed the rcon window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   srcon.clear [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Constructs a request with the given parameters:&lt;br /&gt;
 ; $1 = Request ID&lt;br /&gt;
 ; $2 = Request type&lt;br /&gt;
 ; $3 = Request data (password/command)&lt;br /&gt;
 ; $4 = Bvar to store the request&lt;br /&gt;
 [[alias]] -l srcon.getrequest {&lt;br /&gt;
   ; Clear the given bvar to make sure it doesn&#039;t contain any preset values.&lt;br /&gt;
   [[bunset]] [[$1-|$4]]&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request ID in the request.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 5 $srcon.inttobytes([[$1-|$1]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request type.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 9 $srcon.inttobytes([[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set string1 the request data.&lt;br /&gt;
   [[bset]] -t [[$1-|$4]] 13 [[$1-|$3]]&lt;br /&gt;
  &lt;br /&gt;
   ; Terminate string1 with 0x00 and set string2 to 0x00.&lt;br /&gt;
   [[bset]] [[$1-|$4]] [[$calc]]([[$bvar]]([[$1-|$4]],0) + 1) 00 00&lt;br /&gt;
  &lt;br /&gt;
   ; Set the packet size.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 1 $srcon.inttobytes([[$calc]]([[$bvar]]([[$1-|$4]], 0) - 4))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Clears the socket and the request id.&lt;br /&gt;
 [[alias]] -l srcon.clear {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[$1-|$1]])) {&lt;br /&gt;
     [[sockclose]] [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Clear the id var.&lt;br /&gt;
   [[Unset|unset]] %srcon.id. [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5532</id>
		<title>How to RCON a source engine based server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5532"/>
		<updated>2011-02-11T12:53:36Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: Created page with &amp;quot; ; Source RCON control snippet by NaNg  ; Date: 10-02-2011  ;  ; Remote control window for Source engine based games (e.g. HL2, OrangeBox, CS:S, CSP etc.),  ; based on the Source...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Source RCON control snippet by NaNg&lt;br /&gt;
 ; Date: 10-02-2011&lt;br /&gt;
 ;&lt;br /&gt;
 ; Remote control window for Source engine based games (e.g. HL2, OrangeBox, CS:S, CSP etc.),&lt;br /&gt;
 ; based on the Source RCON Protocol found at http://developer.valvesoftware.com/wiki/Source_RCON_Protocol&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /sourcercon &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;pass&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; Define a prefix for sockent names.&lt;br /&gt;
 [[alias]] -l srcon.prefix { [[return]] SRcon }&lt;br /&gt;
  &lt;br /&gt;
 ; Set the command requests and response types.&lt;br /&gt;
 [[alias]] -l srcon.req.execcmd { [[return]] 2 }&lt;br /&gt;
 [[alias]] -l srcon.req.auth { [[return]] 3 }&lt;br /&gt;
 [[alias]] -l srcon.res.cmd { [[return]] 0 }&lt;br /&gt;
 [[alias]] -l srcon.res.auth { [[return]] 2 }&lt;br /&gt;
  &lt;br /&gt;
 ; Turn the given number to a 4-byte number.&lt;br /&gt;
 [[alias]] -l srcon.inttobytes {&lt;br /&gt;
   [[tokenize]] 46 [[$longip]]([[$1-|$1]])&lt;br /&gt;
   [[return]] [[$1-|$4]] [[$1-|$3]] [[$1-|$2]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Validates arguments and tries to open the socket to the game server for authentication.&lt;br /&gt;
 [[alias]] sourcercon {&lt;br /&gt;
   ; Validate arguments (simple, no need for full validation).&lt;br /&gt;
   [[If-Then-Else|if]] ((![[$longip]]([[$1-|$1]])) || ([[$1-|$2]] !isnum 1-65536) || (![[$1-|$3]])) {&lt;br /&gt;
     [[echo]] -ag Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Save the server&#039;s address.&lt;br /&gt;
   [[Local_Variables|var]] %server.addr = [[DollarPlus|$+]]([[$1-|$1]],:,[[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Check that the user has not opened a Rcon window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a Rcon step over another Rcon for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag Rcon window for [[$1-|$1]] is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Open the Rcon window whilst activating it, with an editbox, hide the @ prefix and maximize it.&lt;br /&gt;
   window -aek0x @ [[DollarPlus|$+]] %server.addr sourcercon.execcmd&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Source RCON window. If there&#039;s no error, you&#039;re connected!&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Type a command\cvar to send to the server, responses will be displayed here.&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Warning! commands like exit or quit will close the server! avoid using them!&lt;br /&gt;
  &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($srcon.prefix,%server.addr)&lt;br /&gt;
  &lt;br /&gt;
   ; Open the socket to the server.&lt;br /&gt;
   [[sockopen]] %sockname [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
  &lt;br /&gt;
   ; Mark the socket with the Rcon password.&lt;br /&gt;
   [[sockmark]] %sockname [[$1-|$3]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Catch all sockopens with the Source Rcon sockets prefix.&lt;br /&gt;
 ; Build the authentication request packet and send it to the server.&lt;br /&gt;
 on *:SOCKOPEN:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Initialize the request ID for the connection.&lt;br /&gt;
   [[set]] %srcon.id. [[DollarPlus|$+]] [[$sockname]] 0&lt;br /&gt;
  &lt;br /&gt;
   ; Constructed auth request to send to the server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ], $srcon.req.auth, [[$sock]]([[$sockname]]).mark, &amp;amp;srcon.auth)&lt;br /&gt;
  &lt;br /&gt;
   ; Send the authentication packet.&lt;br /&gt;
   [[sockwrite]] [[$sockname]] &amp;amp;srcon.auth&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Read data from the game server.&lt;br /&gt;
 on *:SOCKREAD:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If there were errors, $sockerr will tell us so.&lt;br /&gt;
   ; Write the error message to the window and clear the connection.&lt;br /&gt;
   [[If-Then-Else|if]] ($sockerr) {&lt;br /&gt;
     [[aline]] 04 %srcon.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     srcon.clear [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If a prior packet didn&#039;t finish receiving, continue reading it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$sockname]])) {&lt;br /&gt;
     ; Set the packet size.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$hget]]([[$sockname]], size)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = [[$hget]]([[$sockname]], left)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the request id.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$hget]]([[$sockname]], id)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the command response type.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$hget]]([[$sockname]], cmd)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the cut string1.&lt;br /&gt;
     [[noop]] [[$hget]]([[$sockname]], string1, &amp;amp;srcon.pckt.string1)&lt;br /&gt;
  &lt;br /&gt;
     ; Read the rest of string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.rest&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Append the rest of string1 to the already received string1.&lt;br /&gt;
     [[bcopy]] &amp;amp;srcon.pckt.string1 [[$calc]]([[$bvar]](&amp;amp;srcon.pckt.string1, 0) + 1) &amp;amp;srcon.pckt.rest 1 -1&lt;br /&gt;
  &lt;br /&gt;
     ; Clear the un-needed variables.&lt;br /&gt;
     [[hfree]] [[$sockname]]&lt;br /&gt;
   }&lt;br /&gt;
   ; Else, if the packet wasn&#039;t splitted.&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     ; Read the packet size.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.size&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$bvar]](&amp;amp;srcon.pckt.size, 1).long&lt;br /&gt;
  &lt;br /&gt;
     ; Initialize the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = %srcon.pckt.size&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet id.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.id&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$bvar]](&amp;amp;srcon.pckt.id, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; If the request id is an error, stop processing, display an error and clear the connection.&lt;br /&gt;
     [[If-Then-Else|if]] ($srcon.inttobytes(%srcon.pckt.id) == 255 255 255 255) {&lt;br /&gt;
       [[aline]] 04 %srcon.window * Error: Failed authentication (probably wrong password).&lt;br /&gt;
       srcon.clear [[$sockname]]&lt;br /&gt;
       [[return]]&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet command response type.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.cmd&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$bvar]](&amp;amp;srcon.pckt.cmd, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Read string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.string1&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If the number of bytes left to read is still positive, the packet was splitted.&lt;br /&gt;
   ; This means that we&#039;ll save the variables to globals so it can be used in the next read.&lt;br /&gt;
   [[If-Then-Else|if]] (%srcon.pckt.left &amp;gt; 0) {&lt;br /&gt;
     [[hmake]] [[$sockname]]&lt;br /&gt;
     [[hadd]] [[$sockname]] size %srcon.pckt.size&lt;br /&gt;
     [[hadd]] [[$sockname]] left %srcon.pckt.left&lt;br /&gt;
     [[hadd]] [[$sockname]] id %srcon.pckt.id&lt;br /&gt;
     [[hadd]] [[$sockname]] cmd %srcon.pckt.cmd&lt;br /&gt;
     [[hadd]] -b [[$sockname]] string1 &amp;amp;srcon.pckt.string1&lt;br /&gt;
   }&lt;br /&gt;
   ; Only if we&#039;ve finished reading all the packet and the response type was a command response, display it.&lt;br /&gt;
   ; NOTE: At this point, string1 also contains string2 (the one 0x00 byte), however it doesn&#039;t matter to us&lt;br /&gt;
   ; since we&#039;re only reading the text which is terminated in string1 by a 0x00 byte.&lt;br /&gt;
   [[If-Then-Else|elseif]] ((%srcon.pckt.left == 0) &amp;amp;&amp;amp; (%srcon.pckt.cmd == $srcon.res.cmd)) {&lt;br /&gt;
     ; Convert the binary string1 to a usable variable.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.string1 = [[$bvar]](&amp;amp;srcon.pckt.string1, 1, [[$bvar]](&amp;amp;srcon.pckt.string1, 0)).text&lt;br /&gt;
  &lt;br /&gt;
     ; Tokenize the lines to be printed and print them.&lt;br /&gt;
     [[tokenize]] [[$asc]]([[$lf]]) %srcon.pckt.string1&lt;br /&gt;
     [[aline]] %srcon.window [[$$|$*]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sockets may close on their own if not kept alive.&lt;br /&gt;
 ; In case that happens when the window is still open, the socket will be reopened.&lt;br /&gt;
 on *:SOCKCLOSE:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If the window and the current request id still exists, reopen the socket.&lt;br /&gt;
   [[If-Then-Else|if]] (([[$window_(remote)|$window(]]%srcon.window)) &amp;amp;&amp;amp; (%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ])) {&lt;br /&gt;
     ; Save the socket details before terminating it.&lt;br /&gt;
     %srcon.name = [[$sockname]]&lt;br /&gt;
     %srcon.ip = [[$sock]]([[$sockname]]).ip&lt;br /&gt;
     %srcon.port = [[$sock]]([[$sockname]]).port&lt;br /&gt;
     %srcon.pass = [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
     ; Terminate the socket so it could be reopened.&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
  &lt;br /&gt;
     ; Reopen the socket to the server.&lt;br /&gt;
     [[sockopen]] %srcon.name %srcon.ip %srcon.port&lt;br /&gt;
  &lt;br /&gt;
     ; Mark the socket with the Rcon password.&lt;br /&gt;
     [[sockmark]] %srcon.name %srcon.pass&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sends user input to the server as is.&lt;br /&gt;
 ; NOTE: Commands like exit or quit will close the server!&lt;br /&gt;
 on *:INPUT:@: {&lt;br /&gt;
   ; Get the socket name.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.socket = [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
  &lt;br /&gt;
   ; Check if the socket is still alive.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$sock]](%srcon.socket)) {&lt;br /&gt;
     [[aline]] 04 $target * Error: Socket is dead. Close the window and try again.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Build the execute command request packet and send it to the server.&lt;br /&gt;
  &lt;br /&gt;
   ; Increment the current request id.&lt;br /&gt;
   [[inc]] %srcon.id. [[DollarPlus|$+]] %srcon.socket&lt;br /&gt;
  &lt;br /&gt;
   ; Construct the request to send to the game server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ %srcon.socket ] ], $srcon.req.execcmd, [[$1-|$1-]], &amp;amp;srcon.cmd)&lt;br /&gt;
  &lt;br /&gt;
   [[aline]] $target -&amp;gt; [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Send the command request.&lt;br /&gt;
   [[sockwrite]] %srcon.socket &amp;amp;srcon.cmd&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; If the user has closed the rcon window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   srcon.clear [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Constructs a request with the given parameters:&lt;br /&gt;
 ; $1 = Request ID&lt;br /&gt;
 ; $2 = Request type&lt;br /&gt;
 ; $3 = Request data (password/command)&lt;br /&gt;
 ; $4 = Bvar to store the request&lt;br /&gt;
 [[alias]] -l srcon.getrequest {&lt;br /&gt;
   ; Clear the given bvar to make sure it doesn&#039;t contain any preset values.&lt;br /&gt;
   [[bunset]] [[$1-|$4]]&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request ID in the request.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 5 $srcon.inttobytes([[$1-|$1]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request type.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 9 $srcon.inttobytes([[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set string1 the request data.&lt;br /&gt;
   [[bset]] -t [[$1-|$4]] 13 [[$1-|$3]]&lt;br /&gt;
  &lt;br /&gt;
   ; Terminate string1 with 0x00 and set string2 to 0x00.&lt;br /&gt;
   [[bset]] [[$1-|$4]] [[$calc]]([[$bvar]]([[$1-|$4]],0) + 1) 00 00&lt;br /&gt;
  &lt;br /&gt;
   ; Set the packet size.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 1 $srcon.inttobytes([[$calc]]([[$bvar]]([[$1-|$4]], 0) - 4))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Clears the socket and the request id.&lt;br /&gt;
 [[alias]] -l srcon.clear {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[$1-|$1]])) {&lt;br /&gt;
     [[sockclose]] [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Clear the id var.&lt;br /&gt;
   [[Unset|unset]] %srcon.id. [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5531</id>
		<title>How to query a CS Server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5531"/>
		<updated>2011-02-11T12:51:31Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: Undo revision 5530 by Vliedel (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you want to e.g. get the number and names of all player who are currently playing on a CS-server, you have to send a so-called &amp;quot;query&amp;quot; to this server (using UDP) and handle everything the server sends back to you. This isn&#039;t as easy as it sounds. At first, you would have to &#039;learn&#039;, or, at least, understand the protocol a CS-server uses (e.g. what do I have to send to the server to get a &#039;good&#039; reply and what&#039;s the structure of this reply). If you want to learn more about these protocols, take a look at http://dev.kquery.com/ or http://www.valve-erc.com/srcsdk/Code/Networking/serverqueries.html or http://developer.valvesoftware.com/wiki/Server_Queries .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following script &#039;&#039;&#039;echo&#039;&#039;&#039;s the output to your active window. You will have to modify it to be able to use it as &#039;bot&#039;. It&#039;s a more complex script and you don&#039;t need to understand it (completely) to be able to use it.&lt;br /&gt;
&lt;br /&gt;
 ; HL server query snippet by Saturn&lt;br /&gt;
 ;&lt;br /&gt;
 ; 16-04-2009: update to protocol version 48 by NaNg&lt;br /&gt;
 ; 29-01-2011: update to fix UTF8 problem in mIRC 7.* and fixed name problems if last char is space by NaNg&lt;br /&gt;
 ;&lt;br /&gt;
 ; usage:&lt;br /&gt;
 ; /hlinfo &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlinfo &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
 ; /hlplay &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt;&lt;br /&gt;
 ; or: /hlplay &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens a new socket if you want to get general information about a running CS-server&lt;br /&gt;
 [[alias]] hlinfo {&lt;br /&gt;
   [[If-Then-Else|if]] (!$2) [[tokenize]] 58 [[$1-|$1]]&lt;br /&gt;
  &lt;br /&gt;
   ; using a dynamic socket name so we can use multiple instances at once&lt;br /&gt;
   [[var]] %sock = [[DollarPlus|$+]](hlinfo-,[[$ticks]])&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   [[bset]] &amp;amp;t 1 255 255 255 255&lt;br /&gt;
   bset -t &amp;amp;t 5 TSource Engine Query&lt;br /&gt;
   bset &amp;amp;t 25 0&lt;br /&gt;
   ; actually open the socket, and send the query&lt;br /&gt;
   [[sockudp]] -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; closing the socket after 60seconds if there is no response (else it will be closed by another event (see below))&lt;br /&gt;
   .[[timer]] $+ %sock 1 60 [[sockclose]] %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will get all data sent back from the server&lt;br /&gt;
 [[on_udpread|on *:UDPREAD]]:hlinfo-*:{&lt;br /&gt;
   ; save it in a binary variable&lt;br /&gt;
   [[sockread]] -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables that we will use below&lt;br /&gt;
   var %offset, %name, %map, %game, %num, %max, %ip, %dir&lt;br /&gt;
  &lt;br /&gt;
   ; following the protocol, this &amp;quot;m&amp;quot; shows us that we queried a Half-Life 1 server&lt;br /&gt;
   if ([[$chr]]([[$bvar]](&amp;amp;reply,5)) == m) {&lt;br /&gt;
     ; Half-Life 1 info reply&lt;br /&gt;
  &lt;br /&gt;
     %offset = 6&lt;br /&gt;
  &lt;br /&gt;
     ; save the ip&lt;br /&gt;
     %ip = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     [[inc]] %offset [[$calc]]([[$len]]($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the same&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the current map&lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the game directory&lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the name of the game&lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; current and maximum players&lt;br /&gt;
     %num = $bvar(&amp;amp;reply,%offset)&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 1))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; else we get data for a CS:Source game&lt;br /&gt;
   else {&lt;br /&gt;
     ; Source info reply&lt;br /&gt;
     ; we do the same as above&lt;br /&gt;
     %offset = 7&lt;br /&gt;
  &lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %map = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %dir = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %game = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     %num = $bvar(&amp;amp;reply,$calc(%offset + 2))&lt;br /&gt;
     %max = $bvar(&amp;amp;reply,$calc(%offset + 3))&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; now we echo all stored details to the active window&lt;br /&gt;
   [[echo]] -a Info for [[$sock]]([[$sockname]]).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
   echo -a Name: %name&lt;br /&gt;
   echo -a Map: %map&lt;br /&gt;
   echo -a Game: %game&lt;br /&gt;
   echo -a Players: %num $+ / $+ %max&lt;br /&gt;
  &lt;br /&gt;
   ; and turn off the timer closing the socket&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; as we can close it now manually&lt;br /&gt;
   [[sockclose]] $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 ; this is the alias that will be called from hlplay to open the socket&lt;br /&gt;
 alias hlchal {&lt;br /&gt;
   ; $1 = ip, $2 = port, $3- = what to call when received&lt;br /&gt;
   ; use dynamic socket name as above&lt;br /&gt;
   var %sock = $+(hlchal-,$ticks)&lt;br /&gt;
   ; construct the query to send to the server&lt;br /&gt;
   bset &amp;amp;t 1 255 255 255 255 85 255 255 255 255&lt;br /&gt;
   ; open the socket, and ask for a player challenge number&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;t&lt;br /&gt;
   ; mark it with the ip and port (and the query we want to call when we&#039;ve received something from the server)&lt;br /&gt;
   [[sockmark]] %sock $3- $1-2&lt;br /&gt;
   ; and make a new timer to close it after 60 seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; read everything that comes back from the hlchal-* query&lt;br /&gt;
 on *:UDPREAD:hlchal-*:{&lt;br /&gt;
   ; and save it in the binary variable called &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
   ; actually call the alias saved in the sockmark (hlplay_query)&lt;br /&gt;
   $sock($sockname).mark $bvar(&amp;amp;reply,6,4)&lt;br /&gt;
   ; and turn the timer off because we can close it manually&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias we can call to make everything easier&lt;br /&gt;
 ; it will call other aliases to open sockets etc.&lt;br /&gt;
 alias hlplay {&lt;br /&gt;
   if (!$2) tokenize 58 $1&lt;br /&gt;
   hlchal $1-2 hlplay_query&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; the alias that opens the _real_ socket to receive data (everything before was just to challenge the server (read the website mentioned above))&lt;br /&gt;
 alias hlplay_query {&lt;br /&gt;
   ; set a binary variable&lt;br /&gt;
   bset &amp;amp;query 1 255 255 255 255 85 $3-&lt;br /&gt;
   ; use dynamic socket names again&lt;br /&gt;
   var %sock = $+(hlplay-,$ticks)&lt;br /&gt;
   ; open the socket&lt;br /&gt;
   sockudp -k %sock $1-2 &amp;amp;query&lt;br /&gt;
   ; and turn on the timer closing the socket after 60seconds&lt;br /&gt;
   .timer $+ %sock 1 60 sockclose %sock&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; this event will receive all data from the server as response to our query&lt;br /&gt;
 on *:UDPREAD:hlplay-*:{&lt;br /&gt;
   ; we save it in &amp;amp;reply&lt;br /&gt;
   sockread -f &amp;amp;reply&lt;br /&gt;
  &lt;br /&gt;
   ; set some local variables we will use later&lt;br /&gt;
   var %i = 1, %num = $bvar(&amp;amp;reply,6), %offset = 7&lt;br /&gt;
   var %count = 0, %name, %kills&lt;br /&gt;
  &lt;br /&gt;
   ; and echo the number of players&lt;br /&gt;
   echo -a Players on $sock($sockname).saddr $+ : $+ $sock($sockname).sport&lt;br /&gt;
  &lt;br /&gt;
   ; now we can loop through all player and save some details about them&lt;br /&gt;
   [[while]] (%i &amp;lt;= %num) {&lt;br /&gt;
     inc %offset&lt;br /&gt;
  &lt;br /&gt;
     ; the name&lt;br /&gt;
     %name = $bvar(&amp;amp;reply,%offset,128).text&lt;br /&gt;
     inc %offset $calc($len($bvar(&amp;amp;reply,%offset,128).text) + 1)&lt;br /&gt;
  &lt;br /&gt;
     ; the kills&lt;br /&gt;
     %kills = $bvar(&amp;amp;reply,%offset).long&lt;br /&gt;
     if ($isbit(%kills,32)) dec %kills $calc(2^32)&lt;br /&gt;
     inc %offset 8&lt;br /&gt;
  &lt;br /&gt;
     ; and if there was a player&lt;br /&gt;
     if (%name != $null) {&lt;br /&gt;
       ; increase the variable that shows us the number of the player&lt;br /&gt;
       inc %count&lt;br /&gt;
       ; and echo it to the active window with the kills saved above&lt;br /&gt;
       echo -a %count $+ . %name - %kills&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; increase %i so we go on with the next player&lt;br /&gt;
     inc %i&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; if there are no players online, echo it aswell&lt;br /&gt;
   if (%count == 0) echo -a No players found!&lt;br /&gt;
  &lt;br /&gt;
   ; turn off the timer&lt;br /&gt;
   .timer $+ $sockname off&lt;br /&gt;
   ; and close the socket manually&lt;br /&gt;
   sockclose $sockname&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5530</id>
		<title>How to query a CS Server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5530"/>
		<updated>2011-02-11T11:40:10Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: nang update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you want to e.g. get the number and names of all player who are currently playing on a CS-server, you have to send a so-called &amp;quot;query&amp;quot; to this server (using UDP) and handle everything the server sends back to you. This isn&#039;t as easy as it sounds. At first, you would have to &#039;learn&#039;, or, at least, understand the protocol a CS-server uses (e.g. what do I have to send to the server to get a &#039;good&#039; reply and what&#039;s the structure of this reply). If you want to learn more about these protocols, take a look at http://dev.kquery.com/ or http://www.valve-erc.com/srcsdk/Code/Networking/serverqueries.html or http://developer.valvesoftware.com/wiki/Server_Queries .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following script &#039;&#039;&#039;echo&#039;&#039;&#039;s the output to your active window. You will have to modify it to be able to use it as &#039;bot&#039;. It&#039;s a more complex script and you don&#039;t need to understand it (completely) to be able to use it.&lt;br /&gt;
&lt;br /&gt;
 ; Source RCON control snippet by NaNg&lt;br /&gt;
 ; Date: 10-02-2011&lt;br /&gt;
 ;&lt;br /&gt;
 ; Remote control window for Source engine based games (e.g. HL2, OrangeBox, CS:S, CSP etc.),&lt;br /&gt;
 ; based on the Source RCON Protocol found at http://developer.valvesoftware.com/wiki/Source_RCON_Protocol&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /sourcercon &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;pass&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
 ; Define a prefix for sockent names.&lt;br /&gt;
 [[alias]] -l srcon.prefix { [[return]] SRcon }&lt;br /&gt;
  &lt;br /&gt;
 ; Set the command requests and response types.&lt;br /&gt;
 [[alias]] -l srcon.req.execcmd { [[return]] 2 }&lt;br /&gt;
 [[alias]] -l srcon.req.auth { [[return]] 3 }&lt;br /&gt;
 [[alias]] -l srcon.res.cmd { [[return]] 0 }&lt;br /&gt;
 [[alias]] -l srcon.res.auth { [[return]] 2 }&lt;br /&gt;
  &lt;br /&gt;
 ; Turn the given number to a 4-byte number.&lt;br /&gt;
 [[alias]] -l srcon.inttobytes {&lt;br /&gt;
   [[tokenize]] 46 [[$longip]]([[$1-|$1]])&lt;br /&gt;
   [[return]] [[$1-|$4]] [[$1-|$3]] [[$1-|$2]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Validates arguments and tries to open the socket to the game server for authentication.&lt;br /&gt;
 [[alias]] sourcercon {&lt;br /&gt;
   ; Validate arguments (simple, no need for full validation).&lt;br /&gt;
   [[If-Then-Else|if]] ((![[$longip]]([[$1-|$1]])) || ([[$1-|$2]] !isnum 1-65536) || (![[$1-|$3]])) {&lt;br /&gt;
     [[echo]] -ag Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Save the server&#039;s address.&lt;br /&gt;
   [[Local_Variables|var]] %server.addr = [[DollarPlus|$+]]([[$1-|$1]],:,[[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Check that the user has not opened a Rcon window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a Rcon step over another Rcon for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag Rcon window for [[$1-|$1]] is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Open the Rcon window whilst activating it, with an editbox, hide the @ prefix and maximize it.&lt;br /&gt;
   window -aek0x @ [[DollarPlus|$+]] %server.addr sourcercon.execcmd&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Source RCON window. If there&#039;s no error, you&#039;re connected!&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Type a command\cvar to send to the server, responses will be displayed here.&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr Warning! commands like exit or quit will close the server! avoid using them!&lt;br /&gt;
  &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($srcon.prefix,%server.addr)&lt;br /&gt;
  &lt;br /&gt;
   ; Open the socket to the server.&lt;br /&gt;
   [[sockopen]] %sockname [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
  &lt;br /&gt;
   ; Mark the socket with the Rcon password.&lt;br /&gt;
   [[sockmark]] %sockname [[$1-|$3]]&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Catch all sockopens with the Source Rcon sockets prefix.&lt;br /&gt;
 ; Build the authentication request packet and send it to the server.&lt;br /&gt;
 on *:SOCKOPEN:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Initialize the request ID for the connection.&lt;br /&gt;
   [[set]] %srcon.id. [[DollarPlus|$+]] [[$sockname]] 0&lt;br /&gt;
  &lt;br /&gt;
   ; Constructed auth request to send to the server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ], $srcon.req.auth, [[$sock]]([[$sockname]]).mark, &amp;amp;srcon.auth)&lt;br /&gt;
  &lt;br /&gt;
   ; Send the authentication packet.&lt;br /&gt;
   [[sockwrite]] [[$sockname]] &amp;amp;srcon.auth&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Read data from the game server.&lt;br /&gt;
 on *:SOCKREAD:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If there were errors, $sockerr will tell us so.&lt;br /&gt;
   ; Write the error message to the window and clear the connection.&lt;br /&gt;
   [[If-Then-Else|if]] ($sockerr) {&lt;br /&gt;
     [[aline]] 04 %srcon.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     srcon.clear [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If a prior packet didn&#039;t finish receiving, continue reading it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]]([[$sockname]])) {&lt;br /&gt;
     ; Set the packet size.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$hget]]([[$sockname]], size)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = [[$hget]]([[$sockname]], left)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the request id.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$hget]]([[$sockname]], id)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the command response type.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$hget]]([[$sockname]], cmd)&lt;br /&gt;
  &lt;br /&gt;
     ; Set the cut string1.&lt;br /&gt;
     [[noop]] [[$hget]]([[$sockname]], string1, &amp;amp;srcon.pckt.string1)&lt;br /&gt;
  &lt;br /&gt;
     ; Read the rest of string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.rest&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Append the rest of string1 to the already received string1.&lt;br /&gt;
     [[bcopy]] &amp;amp;srcon.pckt.string1 [[$calc]]([[$bvar]](&amp;amp;srcon.pckt.string1, 0) + 1) &amp;amp;srcon.pckt.rest 1 -1&lt;br /&gt;
  &lt;br /&gt;
     ; Clear the un-needed variables.&lt;br /&gt;
     [[hfree]] [[$sockname]]&lt;br /&gt;
   }&lt;br /&gt;
   ; Else, if the packet wasn&#039;t splitted.&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     ; Read the packet size.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.size&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.size = [[$bvar]](&amp;amp;srcon.pckt.size, 1).long&lt;br /&gt;
  &lt;br /&gt;
     ; Initialize the number of bytes left to read.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.left = %srcon.pckt.size&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet id.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.id&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.id = [[$bvar]](&amp;amp;srcon.pckt.id, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; If the request id is an error, stop processing, display an error and clear the connection.&lt;br /&gt;
     [[If-Then-Else|if]] ($srcon.inttobytes(%srcon.pckt.id) == 255 255 255 255) {&lt;br /&gt;
       [[aline]] 04 %srcon.window * Error: Failed authentication (probably wrong password).&lt;br /&gt;
       srcon.clear [[$sockname]]&lt;br /&gt;
       [[return]]&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ; Read the packet command response type.&lt;br /&gt;
     [[Sockread|sockread]] 4 &amp;amp;srcon.pckt.cmd&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.cmd = [[$bvar]](&amp;amp;srcon.pckt.cmd, 1).long&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
  &lt;br /&gt;
     ; Read string1.&lt;br /&gt;
     [[Sockread|sockread]] %srcon.pckt.left &amp;amp;srcon.pckt.string1&lt;br /&gt;
     [[dec]] %srcon.pckt.left $sockbr&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; If the number of bytes left to read is still positive, the packet was splitted.&lt;br /&gt;
   ; This means that we&#039;ll save the variables to globals so it can be used in the next read.&lt;br /&gt;
   [[If-Then-Else|if]] (%srcon.pckt.left &amp;gt; 0) {&lt;br /&gt;
     [[hmake]] [[$sockname]]&lt;br /&gt;
     [[hadd]] [[$sockname]] size %srcon.pckt.size&lt;br /&gt;
     [[hadd]] [[$sockname]] left %srcon.pckt.left&lt;br /&gt;
     [[hadd]] [[$sockname]] id %srcon.pckt.id&lt;br /&gt;
     [[hadd]] [[$sockname]] cmd %srcon.pckt.cmd&lt;br /&gt;
     [[hadd]] -b [[$sockname]] string1 &amp;amp;srcon.pckt.string1&lt;br /&gt;
   }&lt;br /&gt;
   ; Only if we&#039;ve finished reading all the packet and the response type was a command response, display it.&lt;br /&gt;
   ; NOTE: At this point, string1 also contains string2 (the one 0x00 byte), however it doesn&#039;t matter to us&lt;br /&gt;
   ; since we&#039;re only reading the text which is terminated in string1 by a 0x00 byte.&lt;br /&gt;
   [[If-Then-Else|elseif]] ((%srcon.pckt.left == 0) &amp;amp;&amp;amp; (%srcon.pckt.cmd == $srcon.res.cmd)) {&lt;br /&gt;
     ; Convert the binary string1 to a usable variable.&lt;br /&gt;
     [[Local_Variables|var]] %srcon.pckt.string1 = [[$bvar]](&amp;amp;srcon.pckt.string1, 1, [[$bvar]](&amp;amp;srcon.pckt.string1, 0)).text&lt;br /&gt;
  &lt;br /&gt;
     ; Tokenize the lines to be printed and print them.&lt;br /&gt;
     [[tokenize]] [[$asc]]([[$lf]]) %srcon.pckt.string1&lt;br /&gt;
     [[aline]] %srcon.window [[$$|$*]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sockets may close on their own if not kept alive.&lt;br /&gt;
 ; In case that happens when the window is still open, the socket will be reopened.&lt;br /&gt;
 on *:SOCKCLOSE:$([[DollarPlus|$+]]($srcon.prefix,*)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $srcon.prefix))&lt;br /&gt;
  &lt;br /&gt;
   ; If the window and the current request id still exists, reopen the socket.&lt;br /&gt;
   [[If-Then-Else|if]] (([[$window_(remote)|$window(]]%srcon.window)) &amp;amp;&amp;amp; (%srcon.id. [ [[DollarPlus|$+]] [ [[$sockname]] ] ])) {&lt;br /&gt;
     ; Save the socket details before terminating it.&lt;br /&gt;
     %srcon.name = [[$sockname]]&lt;br /&gt;
     %srcon.ip = [[$sock]]([[$sockname]]).ip&lt;br /&gt;
     %srcon.port = [[$sock]]([[$sockname]]).port&lt;br /&gt;
     %srcon.pass = [[$sock]]([[$sockname]]).mark&lt;br /&gt;
  &lt;br /&gt;
     ; Terminate the socket so it could be reopened.&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
  &lt;br /&gt;
     ; Reopen the socket to the server.&lt;br /&gt;
     [[sockopen]] %srcon.name %srcon.ip %srcon.port&lt;br /&gt;
  &lt;br /&gt;
     ; Mark the socket with the Rcon password.&lt;br /&gt;
     [[sockmark]] %srcon.name %srcon.pass&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Sends user input to the server as is.&lt;br /&gt;
 ; NOTE: Commands like exit or quit will close the server!&lt;br /&gt;
 on *:INPUT:@: {&lt;br /&gt;
   ; Get the socket name.&lt;br /&gt;
   [[Local_Variables|var]] %srcon.socket = [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
  &lt;br /&gt;
   ; Check if the socket is still alive.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$sock]](%srcon.socket)) {&lt;br /&gt;
     [[aline]] 04 $target * Error: Socket is dead. Close the window and try again.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Build the execute command request packet and send it to the server.&lt;br /&gt;
  &lt;br /&gt;
   ; Increment the current request id.&lt;br /&gt;
   [[inc]] %srcon.id. [[DollarPlus|$+]] %srcon.socket&lt;br /&gt;
  &lt;br /&gt;
   ; Construct the request to send to the game server.&lt;br /&gt;
   [[noop]] $srcon.getrequest(%srcon.id. [ [[DollarPlus|$+]] [ %srcon.socket ] ], $srcon.req.execcmd, [[$1-|$1-]], &amp;amp;srcon.cmd)&lt;br /&gt;
  &lt;br /&gt;
   [[aline]] $target -&amp;gt; [[$1-|$1-]]&lt;br /&gt;
  &lt;br /&gt;
   ; Send the command request.&lt;br /&gt;
   [[sockwrite]] %srcon.socket &amp;amp;srcon.cmd&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; If the user has closed the rcon window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   srcon.clear [[DollarPlus|$+]]($srcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Constructs a request with the given parameters:&lt;br /&gt;
 ; $1 = Request ID&lt;br /&gt;
 ; $2 = Request type&lt;br /&gt;
 ; $3 = Request data (password/command)&lt;br /&gt;
 ; $4 = Bvar to store the request&lt;br /&gt;
 [[alias]] -l srcon.getrequest {&lt;br /&gt;
   ; Clear the given bvar to make sure it doesn&#039;t contain any preset values.&lt;br /&gt;
   [[bunset]] [[$1-|$4]]&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request ID in the request.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 5 $srcon.inttobytes([[$1-|$1]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set the given request type.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 9 $srcon.inttobytes([[$1-|$2]])&lt;br /&gt;
  &lt;br /&gt;
   ; Set string1 the request data.&lt;br /&gt;
   [[bset]] -t [[$1-|$4]] 13 [[$1-|$3]]&lt;br /&gt;
  &lt;br /&gt;
   ; Terminate string1 with 0x00 and set string2 to 0x00.&lt;br /&gt;
   [[bset]] [[$1-|$4]] [[$calc]]([[$bvar]]([[$1-|$4]],0) + 1) 00 00&lt;br /&gt;
  &lt;br /&gt;
   ; Set the packet size.&lt;br /&gt;
   [[bset]] [[$1-|$4]] 1 $srcon.inttobytes([[$calc]]([[$bvar]]([[$1-|$4]], 0) - 4))&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 ; Clears the socket and the request id.&lt;br /&gt;
 [[alias]] -l srcon.clear {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[$1-|$1]])) {&lt;br /&gt;
     [[sockclose]] [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
  &lt;br /&gt;
   ; Clear the id var.&lt;br /&gt;
   [[Unset|unset]] %srcon.id. [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Wikify&amp;diff=4950</id>
		<title>Wikify</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Wikify&amp;diff=4950"/>
		<updated>2011-02-03T13:38:27Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: script fucked up itsself&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Script to add links to a script for this wiki.&lt;br /&gt;
&lt;br /&gt;
 ; $1 = file&lt;br /&gt;
 [[alias]] wikify {&lt;br /&gt;
   [[If-Then-Else|if]] ($fopen(in)) { .[[fclose]] in }&lt;br /&gt;
   [[If-Then-Else|if]] ($fopen(out)) { .[[fclose]] out }&lt;br /&gt;
   .[[fopen]] in [[$1-|$1]]&lt;br /&gt;
   [[If-Then-Else|if]] ($ferr) { [[echo]] -ag Couldn&#039;t open [[$1-|$1]] | [[return]] }&lt;br /&gt;
   .[[fopen]] -no out wiki.txt&lt;br /&gt;
   [[If-Then-Else|if]] ($ferr) { [[echo]] -ag Couldn&#039;t open wiki.txt | [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %comment&lt;br /&gt;
   [[while]] (!$fopen(in).eof) {&lt;br /&gt;
     [[bunset]] &amp;amp;line&lt;br /&gt;
     [[set]] -l %r $fread(in)&lt;br /&gt;
     [[If-Then-Else|if]] ([[$len]](%r)) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$left]]([[$strip]](%r),2) == /*) { [[Local_Variables|var]] %comment = 1 }&lt;br /&gt;
       [[If-Then-Else|elseif]] ([[$left]]([[$strip]](%r),2) == */) { [[Local_Variables|var]] %comment = 0 }&lt;br /&gt;
       [[If-Then-Else|if]] ([[$left]]([[$strip]](%r),1) != ;) &amp;amp;&amp;amp; (!%comment) {&lt;br /&gt;
         [[set]] -l %r [[$regsubex]](two,[[$regsubex]](one,%r,/((?:^\s*|\x7B\s+|\x7C\s+)[.!]*(?:while|(?:else\s*)?if)\s+)(\((?&amp;gt;[^()]|(?2))*\))(\s+)(\S+)/g,\1\2\3 [[DollarPlus|$+]] $makelink(\4)),/(^\s*|\x7B\s+|\x7C\s+)((?:[.!]*else\s+|[.!]*timer\S*\s+(?:-\w+\s+)?(?:\d\d?:\d\d(?::\d\d)?\s+)?\d+\s+\d+\s+)?[^\s\x7B]+)/g,\1 [[DollarPlus|$+]] $makelink(\2))&lt;br /&gt;
         [[set]] -l %r [[$regsubex]](%r,/(?&amp;lt;=^|\s|\x28|!|\x2C)(\$[^\s\(\)\x2C]+\x28?|\$\x28)/g,$makelink2(\1))&lt;br /&gt;
       }&lt;br /&gt;
       [[bset]] &amp;amp;line 2 [[$regsubex]](%r,/(.)/g,[[$asc]](\1) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
     }&lt;br /&gt;
     [[bset]] &amp;amp;line 1 32&lt;br /&gt;
     .[[fwrite]] -bn out &amp;amp;line&lt;br /&gt;
   }&lt;br /&gt;
   .[[fclose]] in&lt;br /&gt;
   .[[fclose]] out&lt;br /&gt;
   [[run]] wiki.txt&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = command&lt;br /&gt;
 [[alias]] -l makelink {&lt;br /&gt;
   [[Local_Variables|var]] %c = [[$regsubex]]([[$1-|$1]],/^([.!]+)(.+),\2) , %dot = [[$regml]](1)&lt;br /&gt;
   [[If-Then-Else|if]] ([[$read]](commands.txt,nw,%c *)) { [[return]] [[DollarPlus|$+]](%dot,[[$chr]](91),[[$chr]](91),[[$iif]]([[$gettok]]([[$v1]],2,32) == %c,%c,[[DollarPlus|$+]]([[$v1]],[[$chr]](124),%c)),[[$chr]](93),[[$chr]](93)) }&lt;br /&gt;
   [[return]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = $identifier(&lt;br /&gt;
 [[alias]] -l makelink2 {&lt;br /&gt;
   ;  echo -ag id: $1&lt;br /&gt;
   ; check for $!bla and $$bla and $$!bla&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] , %ex , %dbl , %br , %ret , %link , %n&lt;br /&gt;
   [[If-Then-Else|if]] ([[$mid]](%id,2,1) == $) { [[Local_Variables|var]] %id = $ [[DollarPlus|$+]] [[$right]](%id,-2) , %dbl = 1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$mid]](%id,2,1) == !) { [[Local_Variables|var]] %id = $ [[DollarPlus|$+]] [[$right]](%id,-2) , %ex = 1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$mid]](%id,2,1) isnum 1-) { [[Local_Variables|var]] %n = %id , %id = [[$!]][[$1-|1]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$read]](identifiers.txt,nw,%id *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$right]](%id,1) == [[$chr]](40)) {&lt;br /&gt;
     [[Local_Variables|var]] %id = [[$left]](%id,-1) , %br = 1&lt;br /&gt;
     [[If-Then-Else|if]] ([[$read]](identifiers.txt,nw,%id *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$read]](identifiers.txt,nw,%id [[DollarPlus|$+]] *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$read]](identifiers.txt,nw,%id [[DollarPlus|$+]] *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
   [[If-Then-Else|if]] (%link == [[$null]]) { [[return]] [[$1-|$1]] }&lt;br /&gt;
   [[Local_Variables|var]] %link = [[$iif]]((%link != %id) || (%n),%link [[DollarPlus|$+]] [[$chr]](124)) , %id = [[$iif]](%n,%n,%id)&lt;br /&gt;
   [[If-Then-Else|if]] (%dbl) { [[Local_Variables|var]] %ret = [[DollarPlus|$+]]([[$chr]](91),[[$chr]](91),[[$$]],[[$chr]](93),[[$chr]](93),[[$iif]](%ex,[[DollarPlus|$+]]([[$chr]](91),[[$chr]](91),!,[[$chr]](93),[[$chr]](93)))) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%ex) { [[Local_Variables|var]] %ret = [[DollarPlus|$+]]([[$chr]](91),[[$chr]](91),$,!,[[$chr]](93),[[$chr]](93)) }&lt;br /&gt;
   ;  echo -ag return: $+(%ret,$chr(91),$chr(91),%link,$iif(%dbl || %ex,$right(%id,-1),%id),$chr(93),$chr(93),$iif(%br,$chr(40)))&lt;br /&gt;
   [[return]] [[DollarPlus|$+]](%ret,[[$chr]](91),[[$chr]](91),%link,[[$iif]](%dbl || %ex,[[$right]](%id,-1),%id),[[$chr]](93),[[$chr]](93),[[$iif]](%br,[[$chr]](40)))&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
commands.txt&lt;br /&gt;
 Abook          Abook&lt;br /&gt;
 Ajinvite       Ajinvite&lt;br /&gt;
 Alias          Alias&lt;br /&gt;
 Aline          Aline&lt;br /&gt;
 Ame            Ame&lt;br /&gt;
 Amsg           Amsg&lt;br /&gt;
 Anick          Anick&lt;br /&gt;
 Aop            Aop&lt;br /&gt;
 Auser          Auser&lt;br /&gt;
 Autojoin       Autojoin&lt;br /&gt;
 Avoice         Avoice&lt;br /&gt;
 Background     Background&lt;br /&gt;
 Ban            Ban&lt;br /&gt;
 Bcopy          Bcopy&lt;br /&gt;
 Beep           Beep&lt;br /&gt;
 Bread          Bread&lt;br /&gt;
 Break          Break&lt;br /&gt;
 Breplace       Breplace&lt;br /&gt;
 Bset           Bset&lt;br /&gt;
 Btrunc         Btrunc&lt;br /&gt;
 Bunset         Bunset&lt;br /&gt;
 Bwrite         Bwrite&lt;br /&gt;
 Channel        Channel&lt;br /&gt;
 Clear          Clear&lt;br /&gt;
 Clearall       Clearall&lt;br /&gt;
 Clipboard      Clipboard&lt;br /&gt;
 Close          Close&lt;br /&gt;
 Cnick          Cnick&lt;br /&gt;
 Color          Color&lt;br /&gt;
 Continue       Continue&lt;br /&gt;
 Copy           Copy&lt;br /&gt;
 Ctcp           Ctcp&lt;br /&gt;
 Ctcpreply      Ctcpreply&lt;br /&gt;
 Ctcps          Ctcps&lt;br /&gt;
 Dde            Dde&lt;br /&gt;
 Ddeserver      Ddeserver&lt;br /&gt;
 Debug          Debug&lt;br /&gt;
 Dec            Dec&lt;br /&gt;
 Describe       Describe&lt;br /&gt;
 Did            Did&lt;br /&gt;
 Disconnect     Disconnect&lt;br /&gt;
 Dlevel         Dlevel&lt;br /&gt;
 Dns            Dns&lt;br /&gt;
 Dqwindow       Dqwindow&lt;br /&gt;
 Ebeeps         Ebeeps&lt;br /&gt;
 Echo           Echo&lt;br /&gt;
 Editbox        Editbox&lt;br /&gt;
 Else           If-Then-Else&lt;br /&gt;
 Elseif         If-Then-Else&lt;br /&gt;
 Emailaddr      Emailaddr&lt;br /&gt;
 Enable         Enable&lt;br /&gt;
 Events         Events&lt;br /&gt;
 Exit           Exit&lt;br /&gt;
 Fclose         Fclose&lt;br /&gt;
 Filter         Filter&lt;br /&gt;
 Findtext       Findtext&lt;br /&gt;
 Firewall       Firewall&lt;br /&gt;
 Flash          Flash&lt;br /&gt;
 Flist          Flist&lt;br /&gt;
 Flood          Flood&lt;br /&gt;
 Flush          Flush&lt;br /&gt;
 Flushini       Flushini&lt;br /&gt;
 Fopen          Fopen&lt;br /&gt;
 Fseek          Fseek&lt;br /&gt;
 Fullname       Fullname&lt;br /&gt;
 Fwrite         Fwrite&lt;br /&gt;
 Goto           Goto&lt;br /&gt;
 Groups         Groups&lt;br /&gt;
 Guser          Guser&lt;br /&gt;
 Hadd           Hadd&lt;br /&gt;
 Haltdef        Haltdef&lt;br /&gt;
 Hdec           Hdec&lt;br /&gt;
 Hdel           Hdel&lt;br /&gt;
 Help           Help&lt;br /&gt;
 Hfree          Hfree&lt;br /&gt;
 Hinc           Hinc&lt;br /&gt;
 Hload          Hload&lt;br /&gt;
 Hmake          Hmake&lt;br /&gt;
 Hop            Hop&lt;br /&gt;
 Hsave          Hsave&lt;br /&gt;
 Ial            Ial&lt;br /&gt;
 Ialclear       Ialclear&lt;br /&gt;
 Ialmark        Ialmark&lt;br /&gt;
 If             If-Then-Else&lt;br /&gt;
 Ignore         Ignore&lt;br /&gt;
 Inc            Inc&lt;br /&gt;
 Iuser          Iuser&lt;br /&gt;
 Join           Join&lt;br /&gt;
 Linesep        Linesep&lt;br /&gt;
 Load           Load&lt;br /&gt;
 Loadbuf        Loadbuf&lt;br /&gt;
 Localinfo      Localinfo&lt;br /&gt;
 Log            Log&lt;br /&gt;
 Menubar        Menubar&lt;br /&gt;
 Mkdir          Mkdir&lt;br /&gt;
 Mnick          Mnick&lt;br /&gt;
 Msg            Msg&lt;br /&gt;
 Noop           Noop&lt;br /&gt;
 Notify         Notify&lt;br /&gt;
 Omsg           Omsg&lt;br /&gt;
 Onotice        Onotice&lt;br /&gt;
 Partall        Partall&lt;br /&gt;
 Play           Play&lt;br /&gt;
 Pop            Pop&lt;br /&gt;
 Protect        Protect&lt;br /&gt;
 Pvoice         Pvoice&lt;br /&gt;
 Qme            Qme&lt;br /&gt;
 Qmsg           Qmsg&lt;br /&gt;
 Query          Query&lt;br /&gt;
 Queryrn        Queryrn&lt;br /&gt;
 Remini         Remini&lt;br /&gt;
 Remote         Remote&lt;br /&gt;
 Remove         Remove&lt;br /&gt;
 Rename         Rename&lt;br /&gt;
 Resetidle      Resetidle&lt;br /&gt;
 Return         Return&lt;br /&gt;
 Rlevel         Rlevel&lt;br /&gt;
 Rmdir          Rmdir&lt;br /&gt;
 Run            Run&lt;br /&gt;
 Ruser          Ruser&lt;br /&gt;
 Save           Save&lt;br /&gt;
 Saveini        Saveini&lt;br /&gt;
 Say            Say&lt;br /&gt;
 Server         Server&lt;br /&gt;
 Set            Set&lt;br /&gt;
 Setlayer       Setlayer&lt;br /&gt;
 Signal         Signal&lt;br /&gt;
 Sockaccept     Sockaccept&lt;br /&gt;
 Sockclose      Sockclose&lt;br /&gt;
 Socklist       Socklist&lt;br /&gt;
 Socklisten     Socklisten&lt;br /&gt;
 Sockmark       Sockmark&lt;br /&gt;
 Sockopen       Sockopen&lt;br /&gt;
 Sockread       Sockread&lt;br /&gt;
 Sockrename     Sockrename&lt;br /&gt;
 Sockudp        Sockudp&lt;br /&gt;
 Sockwrite      Sockwrite&lt;br /&gt;
 Speak          Speak&lt;br /&gt;
 Switchbar      Switchbar&lt;br /&gt;
 Timer          Timer&lt;br /&gt;
 Timers         Timers&lt;br /&gt;
 Timestamp      Timestamp&lt;br /&gt;
 Titlebar       Titlebar&lt;br /&gt;
 Tnick          Tnick&lt;br /&gt;
 Tokenize       Tokenize&lt;br /&gt;
 Toolbar        Toolbar&lt;br /&gt;
 Treebar        Treebar&lt;br /&gt;
 Ulist          Ulist&lt;br /&gt;
 Unset          Unset&lt;br /&gt;
 Unsetall       Unsetall&lt;br /&gt;
 Updatenl       Updatenl&lt;br /&gt;
 Userhost       Userhost&lt;br /&gt;
 Uwho           Uwho&lt;br /&gt;
 Var            Local_Variables&lt;br /&gt;
 Vol            Vol&lt;br /&gt;
 While          While loops&lt;br /&gt;
 Winhelp        Winhelp&lt;br /&gt;
 Write          Write&lt;br /&gt;
 Writeini       Writeini&lt;br /&gt;
&lt;br /&gt;
identifiers.txt&lt;br /&gt;
 $$                   $$&lt;br /&gt;
 $&amp;amp;                   $&amp;amp;&lt;br /&gt;
 $*                   $*&lt;br /&gt;
 $0                   $0&lt;br /&gt;
 $1                   $1-&lt;br /&gt;
 $abook               $abook&lt;br /&gt;
 $abs                 $abs&lt;br /&gt;
 $acos                $acos&lt;br /&gt;
 $active              $active&lt;br /&gt;
 $activecid           $activecid&lt;br /&gt;
 $activewid           $activewid&lt;br /&gt;
 $adate               $adate&lt;br /&gt;
 $address(            $address_(nick)&lt;br /&gt;
 $address             $address_(remote)&lt;br /&gt;
 $addtok              $addtok&lt;br /&gt;
 $addtokcs            $addtokcs&lt;br /&gt;
 $agent               $agent&lt;br /&gt;
 $agentname           $agentname&lt;br /&gt;
 $agentstat           $agentstat&lt;br /&gt;
 $agentver            $agentver&lt;br /&gt;
 $alias               $alias&lt;br /&gt;
 $and                 $and&lt;br /&gt;
 $anick               $anick&lt;br /&gt;
 $aop                 $aop&lt;br /&gt;
 $appactive           $appactive&lt;br /&gt;
 $appstate            $appstate&lt;br /&gt;
 $asc                 $asc&lt;br /&gt;
 $asctime             $asctime&lt;br /&gt;
 $asin                $asin&lt;br /&gt;
 $atan                $atan&lt;br /&gt;
 $avoice              $avoice&lt;br /&gt;
 $away                $away&lt;br /&gt;
 $awaymsg             $awaymsg&lt;br /&gt;
 $awaytime            $awaytime&lt;br /&gt;
 $base                $base&lt;br /&gt;
 $beta                $beta&lt;br /&gt;
 $bfind               $bfind&lt;br /&gt;
 $bitoff              $bitoff&lt;br /&gt;
 $biton               $biton&lt;br /&gt;
 $bits                $bits&lt;br /&gt;
 $bvar                $bvar&lt;br /&gt;
 $bytes               $bytes&lt;br /&gt;
 $calc                $calc&lt;br /&gt;
 $cb                  $cb&lt;br /&gt;
 $cd                  $cd&lt;br /&gt;
 $ceil                $ceil&lt;br /&gt;
 $chan(               $chan_(window)&lt;br /&gt;
 $chan                $chan_(remote)&lt;br /&gt;
 $chanmodes           $chanmodes&lt;br /&gt;
 $chantypes           $chantypes&lt;br /&gt;
 $chat                $chat&lt;br /&gt;
 $chr                 $chr&lt;br /&gt;
 $cid                 $cid&lt;br /&gt;
 $clevel              $clevel&lt;br /&gt;
 $click               $click&lt;br /&gt;
 $cmdbox              $cmdbox&lt;br /&gt;
 $cmdline             $cmdline&lt;br /&gt;
 $cnick               $cnick&lt;br /&gt;
 $color               $color&lt;br /&gt;
 $comchan             $comchan&lt;br /&gt;
 $compact             $compact&lt;br /&gt;
 $cos                 $cos&lt;br /&gt;
 $count               $count&lt;br /&gt;
 $cr                  $cr&lt;br /&gt;
 $crc                 $crc&lt;br /&gt;
 $crlf                $crlf&lt;br /&gt;
 $ctime               $ctime&lt;br /&gt;
 $ctrlenter           $ctrlenter&lt;br /&gt;
 $date                $date&lt;br /&gt;
 $day                 $day&lt;br /&gt;
 $daylight            $daylight&lt;br /&gt;
 $dde                 $dde&lt;br /&gt;
 $ddename             $ddename&lt;br /&gt;
 $decode              $decode&lt;br /&gt;
 $deltok              $deltok&lt;br /&gt;
 $devent              $devent&lt;br /&gt;
 $dialog              $dialog&lt;br /&gt;
 $did                 $did&lt;br /&gt;
 $disk                $disk&lt;br /&gt;
 $dlevel              $dlevel&lt;br /&gt;
 $dname               $dname&lt;br /&gt;
 $duration            $duration&lt;br /&gt;
 $ebeeps              $ebeeps&lt;br /&gt;
 $editbox             $editbox&lt;br /&gt;
 $encode              $encode&lt;br /&gt;
 $error               $error&lt;br /&gt;
 $eval                $eval&lt;br /&gt;
 $evalnext            $evalnext&lt;br /&gt;
 $exists              $exists&lt;br /&gt;
 $file                $file&lt;br /&gt;
 $filename            $filename&lt;br /&gt;
 $filtered            $filtered&lt;br /&gt;
 $finddir             $finddir&lt;br /&gt;
 $finddirn            $finddirn&lt;br /&gt;
 $findfile            $findfile&lt;br /&gt;
 $findfilen           $findfilen&lt;br /&gt;
 $findtok             $findtok&lt;br /&gt;
 $findtokcs           $findtokcs&lt;br /&gt;
 $fline               $fline&lt;br /&gt;
 $floor               $floor&lt;br /&gt;
 $fserve              $fserve&lt;br /&gt;
 $fulldate            $fulldate&lt;br /&gt;
 $fullname            $fullname&lt;br /&gt;
 $fullscreen          $fullscreen&lt;br /&gt;
 $getdir              $getdir&lt;br /&gt;
 $getdot              $getdot&lt;br /&gt;
 $gettok              $gettok&lt;br /&gt;
 $gmt                 $gmt&lt;br /&gt;
 $hfind               $hfind&lt;br /&gt;
 $hget                $hget&lt;br /&gt;
 $highlight           $highlight&lt;br /&gt;
 $hnick               $hnick&lt;br /&gt;
 $host                $host&lt;br /&gt;
 $hotline             $hotline&lt;br /&gt;
 $hotlinepos          $hotlinepos&lt;br /&gt;
 $ial                 $ial&lt;br /&gt;
 $ibl                 $ibl&lt;br /&gt;
 $idle                $idle&lt;br /&gt;
 $iel                 $iel&lt;br /&gt;
 $ifmatch             $ifmatch&lt;br /&gt;
 $ignore              $ignore&lt;br /&gt;
 $iif                 $iif&lt;br /&gt;
 $iil                 $iil&lt;br /&gt;
 $inellipse           $inellipse&lt;br /&gt;
 $ini                 $ini&lt;br /&gt;
 $inpoly              $inpoly&lt;br /&gt;
 $inrect              $inrect&lt;br /&gt;
 $inroundrect         $inroundrect&lt;br /&gt;
 $insong              $insong&lt;br /&gt;
 $instok              $instok&lt;br /&gt;
 $int                 $int&lt;br /&gt;
 $ip                  $ip&lt;br /&gt;
 $isalias             $isalias&lt;br /&gt;
 $isbit               $isbit&lt;br /&gt;
 $isdde               $isdde&lt;br /&gt;
 $isdir               $isdir&lt;br /&gt;
 $isfile              $isfile&lt;br /&gt;
 $isid                $isid&lt;br /&gt;
 $islower             $islower&lt;br /&gt;
 $istok               $istok&lt;br /&gt;
 $istokcs             $istokcs&lt;br /&gt;
 $isupper             $isupper&lt;br /&gt;
 $lactivecid          $lactivecid&lt;br /&gt;
 $left                $left&lt;br /&gt;
 $len                 $len&lt;br /&gt;
 $level               $level&lt;br /&gt;
 $lf                  $lf&lt;br /&gt;
 $line                $line&lt;br /&gt;
 $lines               $lines&lt;br /&gt;
 $lock                $lock&lt;br /&gt;
 $locked              $locked&lt;br /&gt;
 $log                 $log&lt;br /&gt;
 $logdir              $logdir&lt;br /&gt;
 $logstamp            $logstamp&lt;br /&gt;
 $logstampfmt         $logstampfmt&lt;br /&gt;
 $longfn              $longfn&lt;br /&gt;
 $longip              $longip&lt;br /&gt;
 $lower               $lower&lt;br /&gt;
 $maddress            $maddress&lt;br /&gt;
 $mask                $mask&lt;br /&gt;
 $matchtok            $matchtok&lt;br /&gt;
 $matchtokcs          $matchtokcs&lt;br /&gt;
 $md5                 $md5&lt;br /&gt;
 $me                  $me&lt;br /&gt;
 $menubar             $menubar&lt;br /&gt;
 $mid                 $mid&lt;br /&gt;
 $mircdir             $mircdir&lt;br /&gt;
 $mircexe             $mircexe&lt;br /&gt;
 $mircini             $mircini&lt;br /&gt;
 $mklogfn             $mklogfn&lt;br /&gt;
 $mklogfn             $mklogfn&lt;br /&gt;
 $mnick               $mnick&lt;br /&gt;
 $mode                $mode&lt;br /&gt;
 $modespl             $modespl&lt;br /&gt;
 $mouse               $mouse&lt;br /&gt;
 $msfile              $msfile&lt;br /&gt;
 $network             $network&lt;br /&gt;
 $nick(               $nick_(nick)&lt;br /&gt;
 $nick                $nick_(remote)&lt;br /&gt;
 $nofile              $nofile&lt;br /&gt;
 $nopath              $nopath&lt;br /&gt;
 $not                 $not&lt;br /&gt;
 $notags              $notags&lt;br /&gt;
 $notify              $notify&lt;br /&gt;
 $null                $null&lt;br /&gt;
 $numtok              $numtok&lt;br /&gt;
 $online              $online&lt;br /&gt;
 $onpoly              $onpoly&lt;br /&gt;
 $opnick              $opnick&lt;br /&gt;
 $or                  $or&lt;br /&gt;
 $ord                 $ord&lt;br /&gt;
 $os                  $os&lt;br /&gt;
 $pi                  $pi&lt;br /&gt;
 $pi                  $pi&lt;br /&gt;
 $pic                 $pic&lt;br /&gt;
 $play                $play&lt;br /&gt;
 $port                $port&lt;br /&gt;
 $portable            $portable&lt;br /&gt;
 $portfree            $portfree&lt;br /&gt;
 $pos                 $pos&lt;br /&gt;
 $prefix              $prefix&lt;br /&gt;
 $prop                $prop&lt;br /&gt;
 $protect             $protect&lt;br /&gt;
 $puttok              $puttok&lt;br /&gt;
 $qt                  $qt&lt;br /&gt;
 $rand                $rand&lt;br /&gt;
 $rawmsg              $rawmsg&lt;br /&gt;
 $read                $read&lt;br /&gt;
 $readini             $readini&lt;br /&gt;
 $readn               $readn&lt;br /&gt;
 $regex               $regex&lt;br /&gt;
 $regml               $regml&lt;br /&gt;
 $regsub              $regsub&lt;br /&gt;
 $regsubex            $regsubex&lt;br /&gt;
 $remote              $remote&lt;br /&gt;
 $remove              $remove&lt;br /&gt;
 $remtok              $remtok&lt;br /&gt;
 $remtokcs            $remtokcs&lt;br /&gt;
 $replace             $replace&lt;br /&gt;
 $replacecs           $replacecs&lt;br /&gt;
 $replacex            $replacex&lt;br /&gt;
 $replacexcs          $replacexcs&lt;br /&gt;
 $reptok              $reptok&lt;br /&gt;
 $reptokcs            $reptokcs&lt;br /&gt;
 $result              $result&lt;br /&gt;
 $rgb                 $rgb&lt;br /&gt;
 $right               $right&lt;br /&gt;
 $round               $round&lt;br /&gt;
 $scid                $scid&lt;br /&gt;
 $scon                $scon&lt;br /&gt;
 $scriptdir           $scriptdir&lt;br /&gt;
 $sdir                $sdir&lt;br /&gt;
 $server              $server&lt;br /&gt;
 $serverip            $serverip&lt;br /&gt;
 $sfile               $sfile&lt;br /&gt;
 $sha1                $sha1&lt;br /&gt;
 $shortfn             $shortfn&lt;br /&gt;
 $show                $show&lt;br /&gt;
 $signal              $signal&lt;br /&gt;
 $sin                 $sin&lt;br /&gt;
 $sline               $sline&lt;br /&gt;
 $snick               $snick&lt;br /&gt;
 $snicks              $snicks&lt;br /&gt;
 $snotify             $snotify&lt;br /&gt;
 $sock                $sock&lt;br /&gt;
 $sockname            $sockname&lt;br /&gt;
 $sorttok             $sorttok&lt;br /&gt;
 $sorttokcs           $sorttokcs&lt;br /&gt;
 $sqrt                $sqrt&lt;br /&gt;
 $ssl                 $ssl&lt;br /&gt;
 $sslready            $sslready&lt;br /&gt;
 $status              $status&lt;br /&gt;
 $str                 $str&lt;br /&gt;
 $strip               $strip&lt;br /&gt;
 $style               $style&lt;br /&gt;
 $submenu             $submenu&lt;br /&gt;
 $switchbar           $switchbar&lt;br /&gt;
 $tan                 $tan&lt;br /&gt;
 $ticks               $ticks&lt;br /&gt;
 $time                $time&lt;br /&gt;
 $timestamp           $timestamp&lt;br /&gt;
 $timestampfmt        $timestampfmt&lt;br /&gt;
 $timezone            $timezone&lt;br /&gt;
 $tip                 $tip&lt;br /&gt;
 $toolbar             $toolbar&lt;br /&gt;
 $treebar             $treebar&lt;br /&gt;
 $true                $true&lt;br /&gt;
 $trust               $trust&lt;br /&gt;
 $ulevel              $ulevel&lt;br /&gt;
 $ulist               $ulist&lt;br /&gt;
 $upper               $upper&lt;br /&gt;
 $uptime              $uptime&lt;br /&gt;
 $v1                  $v1&lt;br /&gt;
 $v2                  $v1&lt;br /&gt;
 $version             $version&lt;br /&gt;
 $vnick               $vnick&lt;br /&gt;
 $vol                 $vol&lt;br /&gt;
 $width               $width&lt;br /&gt;
 $wildtok             $wildtok&lt;br /&gt;
 $wildtokcs           $wildtokcs&lt;br /&gt;
 $window(             $window_(remote)&lt;br /&gt;
 $window              $window_(picwin)&lt;br /&gt;
 $wrap                $wrap&lt;br /&gt;
 $xor                 $xor&lt;br /&gt;
 $+                   DollarPlus&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Wikify&amp;diff=2835</id>
		<title>Wikify</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Wikify&amp;diff=2835"/>
		<updated>2011-02-03T13:31:33Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Script to add links to a script for this wiki.&lt;br /&gt;
&lt;br /&gt;
 ; $1 = file&lt;br /&gt;
 [[alias]] wikify {&lt;br /&gt;
   [[If-Then-Else|if]] ($fopen(in)) { .[[fclose]] in }&lt;br /&gt;
   [[If-Then-Else|if]] ($fopen(out)) { .[[fclose]] out }&lt;br /&gt;
   .[[fopen]] in [[$1-|$1]]&lt;br /&gt;
   [[If-Then-Else|if]] ($ferr) { [[echo]] -ag Couldn&#039;t open [[$1-|$1]] | [[return]] }&lt;br /&gt;
   .[[fopen]] -no out wiki.txt&lt;br /&gt;
   [[If-Then-Else|if]] ($ferr) { [[echo]] -ag Couldn&#039;t open wiki.txt | [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %comment&lt;br /&gt;
   [[while]] (!$fopen(in).eof) {&lt;br /&gt;
     [[bunset]] &amp;amp;line&lt;br /&gt;
     [[set]] -l %r $fread(in)&lt;br /&gt;
     [[If-Then-Else|if]] ([[$len]](%r)) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$left]]([[$strip]](%r),2) == /*) { [[Local_Variables|var]] %comment = 1 }&lt;br /&gt;
       [[If-Then-Else|elseif]] ([[$left]]([[$strip]](%r),2) == */) { [[Local_Variables|var]] %comment = 0 }&lt;br /&gt;
       [[If-Then-Else|if]] ([[$left]]([[$strip]](%r),1) != ;) &amp;amp;&amp;amp; (!%comment) {&lt;br /&gt;
         [[set]] -l %r [[$regsubex]](two,[[$regsubex]](one,%r,/((?:^\s*|\x7B\s+|\x7C\s+)[.!]*(?:while|(?:else\s*)?if)\s+)(\((?&amp;gt;[^()]|(?2))*\))(\s+)(\S+)/g,\1\2\3 [[DollarPlus|$+]] $makelink(\4)),/(^\s*|\x7B\s+|\x7C\s+)((?:[.!]*else\s+|[.!]*timer\S*\s+(?:-\w+\s+)?(?:\d\d?:\d\d(?::\d\d)?\s+)?\d+\s+\d+\s+)?[^\s\x7B]+)/g,\1 [[DollarPlus|$+]] $makelink(\2))&lt;br /&gt;
         [[set]] -l %r [[$regsubex]](%r,/(?&amp;lt;=^|\s|\x28|!|\x2C)(\$[^\s\(\)\x2C]+\x28?|\$\x28)/g,$makelink2(\1))&lt;br /&gt;
 &lt;br /&gt;
       }&lt;br /&gt;
       [[bset]] &amp;amp;line 2 [[$regsubex]](%r,/(.)/g,[[$asc]](\1) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
     }&lt;br /&gt;
     [[bset]] &amp;amp;line 1 32&lt;br /&gt;
     .[[fwrite]] -bn out &amp;amp;line&lt;br /&gt;
   }&lt;br /&gt;
   .[[fclose]] in&lt;br /&gt;
   .[[fclose]] out&lt;br /&gt;
   [[run]] wiki.txt&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = command&lt;br /&gt;
 [[alias]] -l makelink {&lt;br /&gt;
   [[Local_Variables|var]] %c = [[$regsubex]]([[$1-|$1]],/^([.!]+)(.+),\2) , %dot = [[$regml]](1)&lt;br /&gt;
   [[If-Then-Else|if]] ([[$read]](commands.txt,nw,%c *)) { [[return]] [[DollarPlus|$+]](%dot,[[$chr]](91),[[$chr]](91),[[$iif]]([[$gettok]]([[$v1]],2,32) == %c,%c,[[DollarPlus|$+]]([[$v1]],[[$chr]](124),%c)),[[$chr]](93),[[$chr]](93)) }&lt;br /&gt;
   [[return]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = $identifier(&lt;br /&gt;
 [[alias]] -l makelink2 {&lt;br /&gt;
   ;  echo -ag id: $1&lt;br /&gt;
   ; check for $!bla and $$bla and $$!bla&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] , %ex , %dbl , %br , %ret , %link , %n&lt;br /&gt;
   [[If-Then-Else|if]] ([[$mid]](%id,2,1) == $) { [[Local_Variables|var]] %id = $ [[DollarPlus|$+]] [[$right]](%id,-2) , %dbl = 1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$mid]](%id,2,1) == !) { [[Local_Variables|var]] %id = $ [[DollarPlus|$+]] [[$right]](%id,-2) , %ex = 1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$mid]](%id,2,1) isnum 1-) { [[Local_Variables|var]] %n = %id , %id = [[$!]][[$1-|1]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$read]](identifiers.txt,nw,%id *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$right]](%id,1) == [[$chr]](40)) {&lt;br /&gt;
     [[Local_Variables|var]] %id = [[$left]](%id,-1) , %br = 1&lt;br /&gt;
     [[If-Then-Else|if]] ([[$read]](identifiers.txt,nw,%id *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$read]](identifiers.txt,nw,%id [[DollarPlus|$+]] *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$read]](identifiers.txt,nw,%id [[DollarPlus|$+]] *)) { [[Local_Variables|var]] %link = [[$gettok]]([[$v1]],2,32) }&lt;br /&gt;
   [[If-Then-Else|if]] (%link == [[$null]]) { [[return]] [[$1-|$1]] }&lt;br /&gt;
   [[Local_Variables|var]] %link = [[$iif]]((%link != %id) || (%n),%link [[DollarPlus|$+]] [[$chr]](124)) , %id = [[$iif]](%n,%n,%id)&lt;br /&gt;
   [[If-Then-Else|if]] (%dbl) { [[Local_Variables|var]] %ret = [[DollarPlus|$+]]([[$chr]](91),[[$chr]](91),[[$$]][[$$|]],[[$chr]](93),[[$chr]](93),[[$iif]](%ex,[[DollarPlus|$+]]([[$chr]](91),[[$chr]](91),!,[[$chr]](93),[[$chr]](93)))) }&lt;br /&gt;
   [[If-Then-Else|elseif]] (%ex) { [[Local_Variables|var]] %ret = [[DollarPlus|$+]]([[$chr]](91),[[$chr]](91),$,!,[[$chr]](93),[[$chr]](93)) }&lt;br /&gt;
   ;  echo -ag return: $+(%ret,$chr(91),$chr(91),%link,$iif(%dbl || %ex,$right(%id,-1),%id),$chr(93),$chr(93),$iif(%br,$chr(40)))&lt;br /&gt;
   [[return]] [[DollarPlus|$+]](%ret,[[$chr]](91),[[$chr]](91),%link,[[$iif]](%dbl || %ex,[[$right]](%id,-1),%id),[[$chr]](93),[[$chr]](93),[[$iif]](%br,[[$chr]](40)))&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
commands.txt&lt;br /&gt;
 Abook          Abook&lt;br /&gt;
 Ajinvite       Ajinvite&lt;br /&gt;
 Alias          Alias&lt;br /&gt;
 Aline          Aline&lt;br /&gt;
 Ame            Ame&lt;br /&gt;
 Amsg           Amsg&lt;br /&gt;
 Anick          Anick&lt;br /&gt;
 Aop            Aop&lt;br /&gt;
 Auser          Auser&lt;br /&gt;
 Autojoin       Autojoin&lt;br /&gt;
 Avoice         Avoice&lt;br /&gt;
 Background     Background&lt;br /&gt;
 Ban            Ban&lt;br /&gt;
 Bcopy          Bcopy&lt;br /&gt;
 Beep           Beep&lt;br /&gt;
 Bread          Bread&lt;br /&gt;
 Break          Break&lt;br /&gt;
 Breplace       Breplace&lt;br /&gt;
 Bset           Bset&lt;br /&gt;
 Btrunc         Btrunc&lt;br /&gt;
 Bunset         Bunset&lt;br /&gt;
 Bwrite         Bwrite&lt;br /&gt;
 Channel        Channel&lt;br /&gt;
 Clear          Clear&lt;br /&gt;
 Clearall       Clearall&lt;br /&gt;
 Clipboard      Clipboard&lt;br /&gt;
 Close          Close&lt;br /&gt;
 Cnick          Cnick&lt;br /&gt;
 Color          Color&lt;br /&gt;
 Continue       Continue&lt;br /&gt;
 Copy           Copy&lt;br /&gt;
 Ctcp           Ctcp&lt;br /&gt;
 Ctcpreply      Ctcpreply&lt;br /&gt;
 Ctcps          Ctcps&lt;br /&gt;
 Dde            Dde&lt;br /&gt;
 Ddeserver      Ddeserver&lt;br /&gt;
 Debug          Debug&lt;br /&gt;
 Dec            Dec&lt;br /&gt;
 Describe       Describe&lt;br /&gt;
 Did            Did&lt;br /&gt;
 Disconnect     Disconnect&lt;br /&gt;
 Dlevel         Dlevel&lt;br /&gt;
 Dns            Dns&lt;br /&gt;
 Dqwindow       Dqwindow&lt;br /&gt;
 Ebeeps         Ebeeps&lt;br /&gt;
 Echo           Echo&lt;br /&gt;
 Editbox        Editbox&lt;br /&gt;
 Else           If-Then-Else&lt;br /&gt;
 Elseif         If-Then-Else&lt;br /&gt;
 Emailaddr      Emailaddr&lt;br /&gt;
 Enable         Enable&lt;br /&gt;
 Events         Events&lt;br /&gt;
 Exit           Exit&lt;br /&gt;
 Fclose         Fclose&lt;br /&gt;
 Filter         Filter&lt;br /&gt;
 Findtext       Findtext&lt;br /&gt;
 Firewall       Firewall&lt;br /&gt;
 Flash          Flash&lt;br /&gt;
 Flist          Flist&lt;br /&gt;
 Flood          Flood&lt;br /&gt;
 Flush          Flush&lt;br /&gt;
 Flushini       Flushini&lt;br /&gt;
 Fopen          Fopen&lt;br /&gt;
 Fseek          Fseek&lt;br /&gt;
 Fullname       Fullname&lt;br /&gt;
 Fwrite         Fwrite&lt;br /&gt;
 Goto           Goto&lt;br /&gt;
 Groups         Groups&lt;br /&gt;
 Guser          Guser&lt;br /&gt;
 Hadd           Hadd&lt;br /&gt;
 Haltdef        Haltdef&lt;br /&gt;
 Hdec           Hdec&lt;br /&gt;
 Hdel           Hdel&lt;br /&gt;
 Help           Help&lt;br /&gt;
 Hfree          Hfree&lt;br /&gt;
 Hinc           Hinc&lt;br /&gt;
 Hload          Hload&lt;br /&gt;
 Hmake          Hmake&lt;br /&gt;
 Hop            Hop&lt;br /&gt;
 Hsave          Hsave&lt;br /&gt;
 Ial            Ial&lt;br /&gt;
 Ialclear       Ialclear&lt;br /&gt;
 Ialmark        Ialmark&lt;br /&gt;
 If             If-Then-Else&lt;br /&gt;
 Ignore         Ignore&lt;br /&gt;
 Inc            Inc&lt;br /&gt;
 Iuser          Iuser&lt;br /&gt;
 Join           Join&lt;br /&gt;
 Linesep        Linesep&lt;br /&gt;
 Load           Load&lt;br /&gt;
 Loadbuf        Loadbuf&lt;br /&gt;
 Localinfo      Localinfo&lt;br /&gt;
 Log            Log&lt;br /&gt;
 Menubar        Menubar&lt;br /&gt;
 Mkdir          Mkdir&lt;br /&gt;
 Mnick          Mnick&lt;br /&gt;
 Msg            Msg&lt;br /&gt;
 Noop           Noop&lt;br /&gt;
 Notify         Notify&lt;br /&gt;
 Omsg           Omsg&lt;br /&gt;
 Onotice        Onotice&lt;br /&gt;
 Partall        Partall&lt;br /&gt;
 Play           Play&lt;br /&gt;
 Pop            Pop&lt;br /&gt;
 Protect        Protect&lt;br /&gt;
 Pvoice         Pvoice&lt;br /&gt;
 Qme            Qme&lt;br /&gt;
 Qmsg           Qmsg&lt;br /&gt;
 Query          Query&lt;br /&gt;
 Queryrn        Queryrn&lt;br /&gt;
 Remini         Remini&lt;br /&gt;
 Remote         Remote&lt;br /&gt;
 Remove         Remove&lt;br /&gt;
 Rename         Rename&lt;br /&gt;
 Resetidle      Resetidle&lt;br /&gt;
 Return         Return&lt;br /&gt;
 Rlevel         Rlevel&lt;br /&gt;
 Rmdir          Rmdir&lt;br /&gt;
 Run            Run&lt;br /&gt;
 Ruser          Ruser&lt;br /&gt;
 Save           Save&lt;br /&gt;
 Saveini        Saveini&lt;br /&gt;
 Say            Say&lt;br /&gt;
 Server         Server&lt;br /&gt;
 Set            Set&lt;br /&gt;
 Setlayer       Setlayer&lt;br /&gt;
 Signal         Signal&lt;br /&gt;
 Sockaccept     Sockaccept&lt;br /&gt;
 Sockclose      Sockclose&lt;br /&gt;
 Socklist       Socklist&lt;br /&gt;
 Socklisten     Socklisten&lt;br /&gt;
 Sockmark       Sockmark&lt;br /&gt;
 Sockopen       Sockopen&lt;br /&gt;
 Sockread       Sockread&lt;br /&gt;
 Sockrename     Sockrename&lt;br /&gt;
 Sockudp        Sockudp&lt;br /&gt;
 Sockwrite      Sockwrite&lt;br /&gt;
 Speak          Speak&lt;br /&gt;
 Switchbar      Switchbar&lt;br /&gt;
 Timer          Timer&lt;br /&gt;
 Timers         Timers&lt;br /&gt;
 Timestamp      Timestamp&lt;br /&gt;
 Titlebar       Titlebar&lt;br /&gt;
 Tnick          Tnick&lt;br /&gt;
 Tokenize       Tokenize&lt;br /&gt;
 Toolbar        Toolbar&lt;br /&gt;
 Treebar        Treebar&lt;br /&gt;
 Ulist          Ulist&lt;br /&gt;
 Unset          Unset&lt;br /&gt;
 Unsetall       Unsetall&lt;br /&gt;
 Updatenl       Updatenl&lt;br /&gt;
 Userhost       Userhost&lt;br /&gt;
 Uwho           Uwho&lt;br /&gt;
 Var            Local_Variables&lt;br /&gt;
 Vol            Vol&lt;br /&gt;
 While          While loops&lt;br /&gt;
 Winhelp        Winhelp&lt;br /&gt;
 Write          Write&lt;br /&gt;
 Writeini       Writeini&lt;br /&gt;
&lt;br /&gt;
identifiers.txt&lt;br /&gt;
 $$                   $$&lt;br /&gt;
 $&amp;amp;                   $&amp;amp;&lt;br /&gt;
 $*                   $*&lt;br /&gt;
 $0                   $0&lt;br /&gt;
 $1                   $1-&lt;br /&gt;
 $abook               $abook&lt;br /&gt;
 $abs                 $abs&lt;br /&gt;
 $acos                $acos&lt;br /&gt;
 $active              $active&lt;br /&gt;
 $activecid           $activecid&lt;br /&gt;
 $activewid           $activewid&lt;br /&gt;
 $adate               $adate&lt;br /&gt;
 $address(            $address_(nick)&lt;br /&gt;
 $address             $address_(remote)&lt;br /&gt;
 $addtok              $addtok&lt;br /&gt;
 $addtokcs            $addtokcs&lt;br /&gt;
 $agent               $agent&lt;br /&gt;
 $agentname           $agentname&lt;br /&gt;
 $agentstat           $agentstat&lt;br /&gt;
 $agentver            $agentver&lt;br /&gt;
 $alias               $alias&lt;br /&gt;
 $and                 $and&lt;br /&gt;
 $anick               $anick&lt;br /&gt;
 $aop                 $aop&lt;br /&gt;
 $appactive           $appactive&lt;br /&gt;
 $appstate            $appstate&lt;br /&gt;
 $asc                 $asc&lt;br /&gt;
 $asctime             $asctime&lt;br /&gt;
 $asin                $asin&lt;br /&gt;
 $atan                $atan&lt;br /&gt;
 $avoice              $avoice&lt;br /&gt;
 $away                $away&lt;br /&gt;
 $awaymsg             $awaymsg&lt;br /&gt;
 $awaytime            $awaytime&lt;br /&gt;
 $base                $base&lt;br /&gt;
 $beta                $beta&lt;br /&gt;
 $bfind               $bfind&lt;br /&gt;
 $bitoff              $bitoff&lt;br /&gt;
 $biton               $biton&lt;br /&gt;
 $bits                $bits&lt;br /&gt;
 $bvar                $bvar&lt;br /&gt;
 $bytes               $bytes&lt;br /&gt;
 $calc                $calc&lt;br /&gt;
 $cb                  $cb&lt;br /&gt;
 $cd                  $cd&lt;br /&gt;
 $ceil                $ceil&lt;br /&gt;
 $chan(               $chan_(window)&lt;br /&gt;
 $chan                $chan_(remote)&lt;br /&gt;
 $chanmodes           $chanmodes&lt;br /&gt;
 $chantypes           $chantypes&lt;br /&gt;
 $chat                $chat&lt;br /&gt;
 $chr                 $chr&lt;br /&gt;
 $cid                 $cid&lt;br /&gt;
 $clevel              $clevel&lt;br /&gt;
 $click               $click&lt;br /&gt;
 $cmdbox              $cmdbox&lt;br /&gt;
 $cmdline             $cmdline&lt;br /&gt;
 $cnick               $cnick&lt;br /&gt;
 $color               $color&lt;br /&gt;
 $comchan             $comchan&lt;br /&gt;
 $compact             $compact&lt;br /&gt;
 $cos                 $cos&lt;br /&gt;
 $count               $count&lt;br /&gt;
 $cr                  $cr&lt;br /&gt;
 $crc                 $crc&lt;br /&gt;
 $crlf                $crlf&lt;br /&gt;
 $ctime               $ctime&lt;br /&gt;
 $ctrlenter           $ctrlenter&lt;br /&gt;
 $date                $date&lt;br /&gt;
 $day                 $day&lt;br /&gt;
 $daylight            $daylight&lt;br /&gt;
 $dde                 $dde&lt;br /&gt;
 $ddename             $ddename&lt;br /&gt;
 $decode              $decode&lt;br /&gt;
 $deltok              $deltok&lt;br /&gt;
 $devent              $devent&lt;br /&gt;
 $dialog              $dialog&lt;br /&gt;
 $did                 $did&lt;br /&gt;
 $disk                $disk&lt;br /&gt;
 $dlevel              $dlevel&lt;br /&gt;
 $dname               $dname&lt;br /&gt;
 $duration            $duration&lt;br /&gt;
 $ebeeps              $ebeeps&lt;br /&gt;
 $editbox             $editbox&lt;br /&gt;
 $encode              $encode&lt;br /&gt;
 $error               $error&lt;br /&gt;
 $eval                $eval&lt;br /&gt;
 $evalnext            $evalnext&lt;br /&gt;
 $exists              $exists&lt;br /&gt;
 $file                $file&lt;br /&gt;
 $filename            $filename&lt;br /&gt;
 $filtered            $filtered&lt;br /&gt;
 $finddir             $finddir&lt;br /&gt;
 $finddirn            $finddirn&lt;br /&gt;
 $findfile            $findfile&lt;br /&gt;
 $findfilen           $findfilen&lt;br /&gt;
 $findtok             $findtok&lt;br /&gt;
 $findtokcs           $findtokcs&lt;br /&gt;
 $fline               $fline&lt;br /&gt;
 $floor               $floor&lt;br /&gt;
 $fserve              $fserve&lt;br /&gt;
 $fulldate            $fulldate&lt;br /&gt;
 $fullname            $fullname&lt;br /&gt;
 $fullscreen          $fullscreen&lt;br /&gt;
 $getdir              $getdir&lt;br /&gt;
 $getdot              $getdot&lt;br /&gt;
 $gettok              $gettok&lt;br /&gt;
 $gmt                 $gmt&lt;br /&gt;
 $hfind               $hfind&lt;br /&gt;
 $hget                $hget&lt;br /&gt;
 $highlight           $highlight&lt;br /&gt;
 $hnick               $hnick&lt;br /&gt;
 $host                $host&lt;br /&gt;
 $hotline             $hotline&lt;br /&gt;
 $hotlinepos          $hotlinepos&lt;br /&gt;
 $ial                 $ial&lt;br /&gt;
 $ibl                 $ibl&lt;br /&gt;
 $idle                $idle&lt;br /&gt;
 $iel                 $iel&lt;br /&gt;
 $ifmatch             $ifmatch&lt;br /&gt;
 $ignore              $ignore&lt;br /&gt;
 $iif                 $iif&lt;br /&gt;
 $iil                 $iil&lt;br /&gt;
 $inellipse           $inellipse&lt;br /&gt;
 $ini                 $ini&lt;br /&gt;
 $inpoly              $inpoly&lt;br /&gt;
 $inrect              $inrect&lt;br /&gt;
 $inroundrect         $inroundrect&lt;br /&gt;
 $insong              $insong&lt;br /&gt;
 $instok              $instok&lt;br /&gt;
 $int                 $int&lt;br /&gt;
 $ip                  $ip&lt;br /&gt;
 $isalias             $isalias&lt;br /&gt;
 $isbit               $isbit&lt;br /&gt;
 $isdde               $isdde&lt;br /&gt;
 $isdir               $isdir&lt;br /&gt;
 $isfile              $isfile&lt;br /&gt;
 $isid                $isid&lt;br /&gt;
 $islower             $islower&lt;br /&gt;
 $istok               $istok&lt;br /&gt;
 $istokcs             $istokcs&lt;br /&gt;
 $isupper             $isupper&lt;br /&gt;
 $lactivecid          $lactivecid&lt;br /&gt;
 $left                $left&lt;br /&gt;
 $len                 $len&lt;br /&gt;
 $level               $level&lt;br /&gt;
 $lf                  $lf&lt;br /&gt;
 $line                $line&lt;br /&gt;
 $lines               $lines&lt;br /&gt;
 $lock                $lock&lt;br /&gt;
 $locked              $locked&lt;br /&gt;
 $log                 $log&lt;br /&gt;
 $logdir              $logdir&lt;br /&gt;
 $logstamp            $logstamp&lt;br /&gt;
 $logstampfmt         $logstampfmt&lt;br /&gt;
 $longfn              $longfn&lt;br /&gt;
 $longip              $longip&lt;br /&gt;
 $lower               $lower&lt;br /&gt;
 $maddress            $maddress&lt;br /&gt;
 $mask                $mask&lt;br /&gt;
 $matchtok            $matchtok&lt;br /&gt;
 $matchtokcs          $matchtokcs&lt;br /&gt;
 $md5                 $md5&lt;br /&gt;
 $me                  $me&lt;br /&gt;
 $menubar             $menubar&lt;br /&gt;
 $mid                 $mid&lt;br /&gt;
 $mircdir             $mircdir&lt;br /&gt;
 $mircexe             $mircexe&lt;br /&gt;
 $mircini             $mircini&lt;br /&gt;
 $mklogfn             $mklogfn&lt;br /&gt;
 $mklogfn             $mklogfn&lt;br /&gt;
 $mnick               $mnick&lt;br /&gt;
 $mode                $mode&lt;br /&gt;
 $modespl             $modespl&lt;br /&gt;
 $mouse               $mouse&lt;br /&gt;
 $msfile              $msfile&lt;br /&gt;
 $network             $network&lt;br /&gt;
 $nick(               $nick_(nick)&lt;br /&gt;
 $nick                $nick_(remote)&lt;br /&gt;
 $nofile              $nofile&lt;br /&gt;
 $nopath              $nopath&lt;br /&gt;
 $not                 $not&lt;br /&gt;
 $notags              $notags&lt;br /&gt;
 $notify              $notify&lt;br /&gt;
 $null                $null&lt;br /&gt;
 $numtok              $numtok&lt;br /&gt;
 $online              $online&lt;br /&gt;
 $onpoly              $onpoly&lt;br /&gt;
 $opnick              $opnick&lt;br /&gt;
 $or                  $or&lt;br /&gt;
 $ord                 $ord&lt;br /&gt;
 $os                  $os&lt;br /&gt;
 $pi                  $pi&lt;br /&gt;
 $pi                  $pi&lt;br /&gt;
 $pic                 $pic&lt;br /&gt;
 $play                $play&lt;br /&gt;
 $port                $port&lt;br /&gt;
 $portable            $portable&lt;br /&gt;
 $portfree            $portfree&lt;br /&gt;
 $pos                 $pos&lt;br /&gt;
 $prefix              $prefix&lt;br /&gt;
 $prop                $prop&lt;br /&gt;
 $protect             $protect&lt;br /&gt;
 $puttok              $puttok&lt;br /&gt;
 $qt                  $qt&lt;br /&gt;
 $rand                $rand&lt;br /&gt;
 $rawmsg              $rawmsg&lt;br /&gt;
 $read                $read&lt;br /&gt;
 $readini             $readini&lt;br /&gt;
 $readn               $readn&lt;br /&gt;
 $regex               $regex&lt;br /&gt;
 $regml               $regml&lt;br /&gt;
 $regsub              $regsub&lt;br /&gt;
 $regsubex            $regsubex&lt;br /&gt;
 $remote              $remote&lt;br /&gt;
 $remove              $remove&lt;br /&gt;
 $remtok              $remtok&lt;br /&gt;
 $remtokcs            $remtokcs&lt;br /&gt;
 $replace             $replace&lt;br /&gt;
 $replacecs           $replacecs&lt;br /&gt;
 $replacex            $replacex&lt;br /&gt;
 $replacexcs          $replacexcs&lt;br /&gt;
 $reptok              $reptok&lt;br /&gt;
 $reptokcs            $reptokcs&lt;br /&gt;
 $result              $result&lt;br /&gt;
 $rgb                 $rgb&lt;br /&gt;
 $right               $right&lt;br /&gt;
 $round               $round&lt;br /&gt;
 $scid                $scid&lt;br /&gt;
 $scon                $scon&lt;br /&gt;
 $scriptdir           $scriptdir&lt;br /&gt;
 $sdir                $sdir&lt;br /&gt;
 $server              $server&lt;br /&gt;
 $serverip            $serverip&lt;br /&gt;
 $sfile               $sfile&lt;br /&gt;
 $sha1                $sha1&lt;br /&gt;
 $shortfn             $shortfn&lt;br /&gt;
 $show                $show&lt;br /&gt;
 $signal              $signal&lt;br /&gt;
 $sin                 $sin&lt;br /&gt;
 $sline               $sline&lt;br /&gt;
 $snick               $snick&lt;br /&gt;
 $snicks              $snicks&lt;br /&gt;
 $snotify             $snotify&lt;br /&gt;
 $sock                $sock&lt;br /&gt;
 $sockname            $sockname&lt;br /&gt;
 $sorttok             $sorttok&lt;br /&gt;
 $sorttokcs           $sorttokcs&lt;br /&gt;
 $sqrt                $sqrt&lt;br /&gt;
 $ssl                 $ssl&lt;br /&gt;
 $sslready            $sslready&lt;br /&gt;
 $status              $status&lt;br /&gt;
 $str                 $str&lt;br /&gt;
 $strip               $strip&lt;br /&gt;
 $style               $style&lt;br /&gt;
 $submenu             $submenu&lt;br /&gt;
 $switchbar           $switchbar&lt;br /&gt;
 $tan                 $tan&lt;br /&gt;
 $ticks               $ticks&lt;br /&gt;
 $time                $time&lt;br /&gt;
 $timestamp           $timestamp&lt;br /&gt;
 $timestampfmt        $timestampfmt&lt;br /&gt;
 $timezone            $timezone&lt;br /&gt;
 $tip                 $tip&lt;br /&gt;
 $toolbar             $toolbar&lt;br /&gt;
 $treebar             $treebar&lt;br /&gt;
 $true                $true&lt;br /&gt;
 $trust               $trust&lt;br /&gt;
 $ulevel              $ulevel&lt;br /&gt;
 $ulist               $ulist&lt;br /&gt;
 $upper               $upper&lt;br /&gt;
 $uptime              $uptime&lt;br /&gt;
 $v1                  $v1&lt;br /&gt;
 $v2                  $v1&lt;br /&gt;
 $version             $version&lt;br /&gt;
 $vnick               $vnick&lt;br /&gt;
 $vol                 $vol&lt;br /&gt;
 $width               $width&lt;br /&gt;
 $wildtok             $wildtok&lt;br /&gt;
 $wildtokcs           $wildtokcs&lt;br /&gt;
 $window(             $window_(remote)&lt;br /&gt;
 $window              $window_(picwin)&lt;br /&gt;
 $wrap                $wrap&lt;br /&gt;
 $xor                 $xor&lt;br /&gt;
 $+                   DollarPlus&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Test2&amp;diff=4949</id>
		<title>Test2</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Test2&amp;diff=4949"/>
		<updated>2011-02-03T13:07:40Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTH_UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;&lt;br /&gt;
 ;  by Vliedel -- #vliedel @ QuakeNet&lt;br /&gt;
 ;  version 1.1  (written and tested on mIRC 6.2)&lt;br /&gt;
 ;  made for networks supporting WHOX&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;What does this script do?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - updates the auths of nicks and stores them in a hash table&lt;br /&gt;
 ;  - if a channel is too big, /who nick1,nick2,nick3 etc is done untill the auths for the channel is updated&lt;br /&gt;
 ;  - users who have a site with the auth in it will be saved without a /who&lt;br /&gt;
 ;    ie: &amp;quot;Vliedel&amp;quot; in &amp;quot;Vliedel.users.quakenet.org&amp;quot; will be treated as auth on the QuakeNet network&lt;br /&gt;
 ;  - users who are not authed (auth 0) will be checked every x time to see if they are authed yet&lt;br /&gt;
 ;  - script updates from largest to the smallest channel&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;How to use this script?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - config the options below&lt;br /&gt;
 ;  - /load -rs auth_update.mrc to load the script&lt;br /&gt;
 ;  - script starts on load or on connect&lt;br /&gt;
 ;  - to get a nicks auth use: $auth(nick) or $auth(nick,cid)&lt;br /&gt;
 ;  - /authupdate.next &amp;lt;nick&amp;gt; [nick] [nick] ... can be used to get auths of those nicks as soon as possible&lt;br /&gt;
 ;    please note that this will use a bit less efficient way to get the auths.&lt;br /&gt;
 ;    You can use the following script to see when such a requested nick is updated&lt;br /&gt;
 ;      on *:SIGNAL:authupdate:{&lt;br /&gt;
 ;        if ($2 == $null) { echo -a Requested: $1 is not on a common channel }&lt;br /&gt;
 ;        elseif ($2 == 0) { echo -a Requested: $1 is not authed }&lt;br /&gt;
 ;        else { echo -a Requested: $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;    Note that this signal returns $2 == $null when someone isn&#039;t on a common channel.&lt;br /&gt;
 ;    This may occur for example when someone parted a channel between the /who and the who reply.&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - /authupdate can be used to make the script update the auths without waiting for the timer to trigger it&lt;br /&gt;
 ;  - You can use the following script to see when a nick is updated&lt;br /&gt;
 ;      on *:SIGNAL:authupdate.new:{&lt;br /&gt;
 ;        if ($2 == 0) { echo -a $1 is not authed }&lt;br /&gt;
 ;        else { echo -a $1 is authed as $2 }&lt;br /&gt;
 ;      }&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Why is this script good?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  - sending /who chan for every channel is not needed and goes slow (lag)&lt;br /&gt;
 ;  - sending /who chan on join may cause Excess Flood or Max sendQ exceeded&lt;br /&gt;
 ;  - sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results (Max sendQ exceeded)&lt;br /&gt;
 ;  - unauthed users can auth without you knowing, so you need to check if they&#039;re authed every so many time.&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETTINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l max.who {&lt;br /&gt;
   ; maximum number of replies in a WHO, too high may cause &#039;Max sendQ exceeded&#039; disconnection&lt;br /&gt;
   ; too low may take the script a long time to update the auths, 1000 should be fine for most situations&lt;br /&gt;
   [[return]] 1000&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l len.who {&lt;br /&gt;
   ; maximum length of the /who &amp;lt;string&amp;gt;, too long may cause the server to ignore the command&lt;br /&gt;
   ; too low may slow things down, 400 should be fine in most cases&lt;br /&gt;
   [[return]] 400&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l delay.who {&lt;br /&gt;
   ; N seconds after your first join, the script starts to update the auths&lt;br /&gt;
   [[return]] 10&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l repeat.who {&lt;br /&gt;
   ; wait N seconds after doing /who to do the next check and /who&lt;br /&gt;
   [[return]] 20&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l minnicks.who {&lt;br /&gt;
   ; minimum nr of nicks with unknown auth in a channel to do /who #channel rather then /who nick,nick,&lt;br /&gt;
   [[return]] 3&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l minratio.who {&lt;br /&gt;
   ; minimum ratio of (nicks with unknown auth) / (total nicks) in a channel to do /who #channel rather then /who nick,nick,&lt;br /&gt;
   [[return]] 0.04&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l queue.repeat.who {&lt;br /&gt;
   ; number of seconds to do the next /who to check if someone who wasn&#039;t authed is now authed&lt;br /&gt;
   [[return]] 600&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l next.wait {&lt;br /&gt;
   ; wait N seconds to do the next /who check triggered by authupdate.next after the last /who&lt;br /&gt;
   [[return]] 10&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l used.network {&lt;br /&gt;
   ; The networks the script is supposed to work on (case sensitive).&lt;br /&gt;
   ; NOTE that the script ONLY works on networks supporting WHOX (ircu 2.10.* should work)&lt;br /&gt;
   ; $1 is the network&lt;br /&gt;
   [[return]] [[$istokcs]](QuakeNet UnderNet GameSurge HanIRC NetGamers OGameNet,[[$1-|$1]],32)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l auth.site {&lt;br /&gt;
   ; For every network a check to see if a user has a site where his authname is in&lt;br /&gt;
   ; $1 is the network, $2 is the site&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] === QuakeNet) { [[return]] [[$iif]](*.users.quakenet.org iswm [[$1-|$2]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === UnderNet) { [[return]] [[$iif]](*.users.undernet.org iswm [[$1-|$2]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === GameSurge) { [[return]] [[$iif]](*.*.GameSurge iswm [[$1-|$2]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === HanIRC) { [[return]] [[$iif]](*.users.HanIRC.org iswm [[$1-|$2]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === NetGamers) { [[return]] [[$iif]](*.users.netgamers.org iswm [[$1-|$2]],[[$true]]) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === OGameNet) { [[return]] [[$iif]](*.user.OGameNet iswm [[$1-|$2]],[[$true]]) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l auth.from.site {&lt;br /&gt;
   ; For every network the method to return the auth from the site&lt;br /&gt;
   ; $1 is the network, $2 is the site&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] === QuakeNet) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === UnderNet) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === GameSurge) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === HanIRC) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === NetGamers) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] === OGameNet) { [[return]] [[$gettok]]([[$1-|$2]],1,46) }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] auth {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$isid]]) { [[$iif]]([[$show]],.auth,auth) [[$1-|$1-]] | [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) || (([[$1-|$2]] !== [[$null]]) &amp;amp;&amp;amp; ((![[$scid]]([[$1-|$2]])) || (![[$1-|$2]]))) { [[return]] }&lt;br /&gt;
   [[return]] [[$hget]](auths. [[DollarPlus|$+]] [[$iif]]([[$1-|$2]] !== [[$null]],[[$1-|$2]],[[$cid]]),[[$1-|$1]])&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTHUPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] authupdate { [[echo]] -a Auth update: $auth_update.update }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTHUPDATE.NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] authupdate.next {&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$0]]&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %n = [[$gettok]]([[$1-|$1-]],%i,32)&lt;br /&gt;
     [[If-Then-Else|if]] (![[$comchan]](%n,1)) { .[[signal]] authupdate %n }&lt;br /&gt;
     [[If-Then-Else|else]] { auth.n.add %n }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] (!$timer([[$cid]] [[DollarPlus|$+]] .auth_update.update)) { auth_update.update n }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     [[Local_Variables|var]] %d = $timer([[$cid]] [[DollarPlus|$+]] .auth_update.update).delay , %l = $timer([[$cid]] [[DollarPlus|$+]] .auth_update.update).secs&lt;br /&gt;
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 [[$iif]]([[$calc]](%d - %l) &amp;lt; $next.wait,[[$calc]]($v2 - $v1),0) auth_update.update n&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LOAD EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:LOAD:{ scon -at1 auth_load }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_LOAD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l auth_load {&lt;br /&gt;
   .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 $delay.who auth_update.update&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[hmake]] auths. [[DollarPlus|$+]] [[$cid]] 200&lt;br /&gt;
   [[hmake]] auths.l. [[DollarPlus|$+]] [[$cid]] 200&lt;br /&gt;
   [[hmake]] auths.q. [[DollarPlus|$+]] [[$cid]] 200&lt;br /&gt;
   [[hmake]] auths.n. [[DollarPlus|$+]] [[$cid]] 100&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %chan = [[$comchan]]([[$me]],%i)&lt;br /&gt;
     [[Local_Variables|var]] %j = [[$nick_(nick)|$nick(]]%chan,0)&lt;br /&gt;
     [[while]] (%j) {&lt;br /&gt;
       auth.l.add.wid [[$chan_(window)|$chan(]]%chan).wid [[$nick_(nick)|$nick(]]%chan,%j)&lt;br /&gt;
       [[dec]] %j&lt;br /&gt;
     }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l auth_update.update {&lt;br /&gt;
   [[Local_Variables|var]] %who&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]])) {&lt;br /&gt;
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update off&lt;br /&gt;
     [[hmake]] auths.u. [[DollarPlus|$+]] [[$cid]] 200&lt;br /&gt;
     [[Local_Variables|var]] %who = $auth_update.who&lt;br /&gt;
     [[If-Then-Else|if]] (%who) {&lt;br /&gt;
       [[hadd]] auths.u. [[DollarPlus|$+]] [[$cid]] -mask %who [[DollarPlus|$+]] ,,, [[DollarPlus|$+]] 273&lt;br /&gt;
       .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.timeout 1 [[$calc]]($repeat.who * 2) auth_update.timeout&lt;br /&gt;
       .quote WHO [[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]],-mask) % [[DollarPlus|$+]] nat,273&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[hfree]] auths.u. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
       .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 $$repeat.who auth_update.update&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] (%who) { [[return]] updating }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]])) { [[return]] already in progress }&lt;br /&gt;
   [[If-Then-Else|else]] { [[return]] nothing to update }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.TIMEOUT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l auth_update.timeout {&lt;br /&gt;
   [[hfree]] auths.u. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   auth_update.update&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.SORT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; sorts channels by number of nicks in channel&lt;br /&gt;
 ; &amp;lt;number of nicks&amp;gt;.&amp;lt;channel number&amp;gt;&lt;br /&gt;
 ; returns 127.1 23.2 &amp;lt;= means 127 nicks on comchan 1&lt;br /&gt;
 [[alias]] -l auth_update.sort {&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0) , %chans&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %chans = %chans [[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%i),0) [[DollarPlus|$+]] . [[DollarPlus|$+]] %i&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[return]] [[$sorttok]](%chans,32,n)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $auth_update.who(N,L)&lt;br /&gt;
 ; returns #chan,#chan,nick,nick&lt;br /&gt;
 [[alias]] -l auth_update.who {&lt;br /&gt;
   [[Local_Variables|var]] %t = auths.u. [[DollarPlus|$+]] [[$cid]] , %t.l = auths.l. [[DollarPlus|$+]] [[$cid]] , %t.q = auths.q. [[DollarPlus|$+]] [[$cid]] , %t.n = auths.n. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[Local_Variables|var]] %n.max = $max.who , %l.max = $len.who , %n.min = $minnicks.who , %ratio = $minratio.who&lt;br /&gt;
   [[Local_Variables|var]] %len , %n.nr , %chans , %nicks , %chans.go&lt;br /&gt;
   [[If-Then-Else|if]] [[$hget]](auths.n.temp) { [[hfree]] auths.n.temp }&lt;br /&gt;
   [[hmake]] auths.n.temp&lt;br /&gt;
   [[Local_Variables|var]] %n = [[$hget]](%t.n,-firstnick)&lt;br /&gt;
   [[while]] (%n) {&lt;br /&gt;
     [[inc]] %len [[$calc]]([[$len]](%n) + 1)&lt;br /&gt;
     [[inc]] %n.nr&lt;br /&gt;
     [[If-Then-Else|if]] (%n.nr &amp;gt; %n.max) || (%len &amp;gt; %l.max) { [[dec]] %n.nr | [[dec]] %len [[$calc]]([[$len]](%n) + 1) | [[break]] }&lt;br /&gt;
     [[hadd]] auths.n.temp %n 1&lt;br /&gt;
     [[hadd]] %t %n 1&lt;br /&gt;
     [[Local_Variables|var]] %nicks = [[$addtok]](%nicks,%n,44) , %n = [[$gettok]]([[$hget]](%t.n,%n),2,32)&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   [[Local_Variables|var]] %sorted = $auth_update.sort , %i = [[$numtok]](%sorted,32) , %time = [[$calc]]([[$ctime]] - $queue.repeat.who)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %comchan = [[$gettok]]([[$gettok]](%sorted,%i,32),2,46) , %chan = [[$comchan]]([[$me]],%comchan) , %id = [[$chan_(window)|$chan(]]%chan).wid [[DollarPlus|$+]] .&lt;br /&gt;
     [[Local_Variables|var]] %n.c = [[$nick_(nick)|$nick(]]%chan,0) , %left , %go&lt;br /&gt;
     [[If-Then-Else|if]] (%n.c &amp;gt; %n.max) { [[break]] }&lt;br /&gt;
     [[If-Then-Else|if]] [[$hget]](auths.temp) { [[hfree]] auths.temp }&lt;br /&gt;
     [[hmake]] auths.temp&lt;br /&gt;
     [[Local_Variables|var]] %n = [[$hget]](%t.n,%id [[DollarPlus|$+]] -firstnick)&lt;br /&gt;
     [[while]] (%n) {&lt;br /&gt;
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) || ([[$hget]](auths.n.temp,%n)) { [[hadd]] auths.temp %n 1 | [[inc]] %left }&lt;br /&gt;
       [[If-Then-Else|if]] (((%left &amp;gt;= %n.min) &amp;amp;&amp;amp; ([[$calc]](%left / %n.c) &amp;gt;= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }&lt;br /&gt;
       [[Local_Variables|var]] %n = [[$gettok]]([[$hget]](%t.n,%id [[DollarPlus|$+]] %n),2,32)&lt;br /&gt;
     }&lt;br /&gt;
     [[Local_Variables|var]] %n = [[$hget]](%t.l,%id [[DollarPlus|$+]] -firstnick)&lt;br /&gt;
     [[while]] (%n) {&lt;br /&gt;
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) &amp;amp;&amp;amp; (![[$hget]](auths.temp,%n)) { [[inc]] %left }&lt;br /&gt;
       [[If-Then-Else|if]] (((%left &amp;gt;= %n.min) &amp;amp;&amp;amp; ([[$calc]](%left / %n.c) &amp;gt;= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }&lt;br /&gt;
       [[Local_Variables|var]] %n = [[$gettok]]([[$hget]](%t.l,%id [[DollarPlus|$+]] %n),2,32)&lt;br /&gt;
     }&lt;br /&gt;
     [[Local_Variables|var]] %n = [[$hget]](%t.q,%id [[DollarPlus|$+]] -firstnick)&lt;br /&gt;
     [[while]] (%n) {&lt;br /&gt;
       [[tokenize]] 32 [[$hget]](%t.q,%id [[DollarPlus|$+]] %n)&lt;br /&gt;
       [[If-Then-Else|if]] ([[$1-|$1]] &amp;gt; %time) { [[break]] }&lt;br /&gt;
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) &amp;amp;&amp;amp; (![[$hget]](auths.temp,%n)) { [[inc]] %left }&lt;br /&gt;
       [[If-Then-Else|if]] (((%left &amp;gt;= %n.min) &amp;amp;&amp;amp; ([[$calc]](%left / %n.c) &amp;gt;= %ratio)) || (%left == %n.c)) { [[Local_Variables|var]] %go = 1 | [[break]] }&lt;br /&gt;
       [[Local_Variables|var]] %n = [[$1-|$3]]&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|if]] (!%go) { [[dec]] %i | [[continue]] }&lt;br /&gt;
     [[Local_Variables|var]] %j = %n.c , %n.tmp = %n.nr , %l.tmp = %len , %chans.go = %chans.go %comchan&lt;br /&gt;
     [[inc]] %l.tmp [[$calc]]([[$len]](%chan) + 1)&lt;br /&gt;
     [[while]] (%j) {&lt;br /&gt;
       [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]]%chan,%j)&lt;br /&gt;
       [[If-Then-Else|if]] (![[$hget]](%t,%n)) { [[inc]] %n.tmp }&lt;br /&gt;
       [[If-Then-Else|if]] ([[$hget]](auths.n.temp,%n)) { [[dec]] %l.tmp [[$calc]]([[$len]](%n) + 1) }&lt;br /&gt;
       [[dec]] %j&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|if]] (%l.tmp &amp;gt; %l.max) || (%n.tmp &amp;gt; %n.max) { [[dec]] %i | [[continue]] }&lt;br /&gt;
     [[Local_Variables|var]] %j = [[$nick_(nick)|$nick(]]%chan,0)&lt;br /&gt;
     [[while]] (%j) {&lt;br /&gt;
       [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]]%chan,%j)&lt;br /&gt;
       [[hadd]] %t %n 1&lt;br /&gt;
       [[hdel]] auths.n.temp %n&lt;br /&gt;
       [[Local_Variables|var]] %nicks = [[$remtok]](%nicks,%n,1,44)&lt;br /&gt;
       [[dec]] %j&lt;br /&gt;
     }&lt;br /&gt;
     [[Local_Variables|var]] %len = %l.tmp , %n.nr = %n.tmp , %chans = [[$addtok]](%chans,%chan,44)&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$me]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %chan = [[$comchan]]([[$me]],%i)&lt;br /&gt;
     [[If-Then-Else|if]] (([[$nick_(nick)|$nick(]]%chan,0) &amp;gt; %n.max) || (![[$istok]](%chans.go,%i,32))) {&lt;br /&gt;
       [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]]%chan).wid [[DollarPlus|$+]] . , %n = [[$hget]](%t.l,%id [[DollarPlus|$+]] -firstnick)&lt;br /&gt;
       [[while]] (%n) {&lt;br /&gt;
         [[If-Then-Else|if]] (![[$hget]](%t,%n)) {&lt;br /&gt;
           [[inc]] %len [[$calc]]([[$len]](%n) + 1)&lt;br /&gt;
           [[inc]] %n.nr&lt;br /&gt;
           [[If-Then-Else|if]] (%n.nr &amp;gt; %n.max) || (%len &amp;gt; %l.max) { [[break]] }&lt;br /&gt;
           [[hadd]] %t %n 1&lt;br /&gt;
           [[Local_Variables|var]] %nicks = [[$addtok]](%nicks,%n,44)&lt;br /&gt;
         }&lt;br /&gt;
         [[Local_Variables|var]] %n = [[$gettok]]([[$hget]](%t.l,%id [[DollarPlus|$+]] %n),2,32)&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|if]] (%n.nr &amp;gt; %n.max) || (%len &amp;gt; %l.max) { [[break]] }&lt;br /&gt;
       [[Local_Variables|var]] %n = [[$hget]](%t.q,%id [[DollarPlus|$+]] -firstnick)&lt;br /&gt;
       [[while]] (%n) {&lt;br /&gt;
         [[tokenize]] 32 [[$hget]](%t.q,%id [[DollarPlus|$+]] %n)&lt;br /&gt;
         [[If-Then-Else|if]] ([[$1-|$1]] &amp;gt; %time) { [[break]] }&lt;br /&gt;
         [[If-Then-Else|if]] (![[$hget]](%t,%n)) {&lt;br /&gt;
           [[inc]] %len [[$calc]]([[$len]](%n) + 1)&lt;br /&gt;
           [[inc]] %n.nr&lt;br /&gt;
           [[If-Then-Else|if]] (%n.nr &amp;gt; %n.max) || (%len &amp;gt; %l.max) { [[break]] }&lt;br /&gt;
           [[hadd]] %t %n 1&lt;br /&gt;
           [[Local_Variables|var]] %nicks = [[$addtok]](%nicks,%n,44)&lt;br /&gt;
         }&lt;br /&gt;
         [[Local_Variables|var]] %n = [[$1-|$3]]&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|if]] (%n.nr &amp;gt; %n.max) || (%len &amp;gt; %l.max) { [[break]] }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] [[$hget]](auths.temp) { [[hfree]] auths.temp }&lt;br /&gt;
   [[If-Then-Else|if]] [[$hget]](auths.n.temp) { [[hfree]] auths.n.temp }&lt;br /&gt;
   [[return]] [[$addtok]](%chans,%nicks,44)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 354 SPECIAL WHO REPLY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; 354 &amp;lt;you&amp;gt;   &amp;lt;nr&amp;gt;  &amp;lt;nick&amp;gt;  &amp;lt;auth&amp;gt;&lt;br /&gt;
 ; 354 Vliedel 273   L       0&lt;br /&gt;
 RAW 354:&amp;amp; 273 &amp;amp; &amp;amp;:{&lt;br /&gt;
   [[If-Then-Else|if]] ([[$comchan]]([[$1-|$3]],1)) { auth_update.nick [[$1-|$3]] [[$1-|$4]] }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],[[$1-|$3]])) { auth.n.rem [[$1-|$3]] | .[[signal]] authupdate [[$1-|$3]] }&lt;br /&gt;
   [[haltdef]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 315 WHO END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; 315 &amp;lt;you&amp;gt;    &amp;lt;requested&amp;gt;              :End of /who list.&lt;br /&gt;
 ; 315 Vliedel  #vliedel,Rutix,fishbot   :End of /WHO list.&lt;br /&gt;
 RAW 315:&amp;amp; &amp;amp; end of /WHO list.: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.u. [[DollarPlus|$+]] [[$cid]],-mask) == [[$1-|$2]]) {&lt;br /&gt;
     [[hfree]] auths.u. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.timeout off&lt;br /&gt;
     .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 [[$iif]]([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],1).item,$next.wait,$repeat.who) auth_update.update&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH_UPDATE.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick    $2 = auth&lt;br /&gt;
 [[alias]] -l auth_update.nick {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$1-|$1]]) != [[$1-|$2]]) {&lt;br /&gt;
     .[[signal]] authupdate.new [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
     auth.add [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
   }&lt;br /&gt;
   auth.l.rem [[$1-|$1]]&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$2]] == 0) { auth.q.add [[$1-|$1]] }&lt;br /&gt;
   [[If-Then-Else|else]] { auth.q.rem [[$1-|$1]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],[[$1-|$1]])) { auth.n.rem [[$1-|$1]] | .[[signal]] authupdate [[$1-|$1]] [[$1-|$2]] }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:JOIN:#:{&lt;br /&gt;
   [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == [[$me]]) &amp;amp;&amp;amp; ($used.network([[$network]])) {&lt;br /&gt;
     [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths. [[DollarPlus|$+]] [[$cid]] 200 }&lt;br /&gt;
     [[If-Then-Else|if]] (![[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths.l. [[DollarPlus|$+]] [[$cid]] 200 }&lt;br /&gt;
     [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths.q. [[DollarPlus|$+]] [[$cid]] 200 }&lt;br /&gt;
     [[If-Then-Else|if]] (![[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[hmake]] auths.n. [[DollarPlus|$+]] [[$cid]] 100 }&lt;br /&gt;
     [[If-Then-Else|if]] (!$timer([[$cid]] [[DollarPlus|$+]] .auth_update.update)) { .[[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .auth_update.update 1 $delay.who auth_update.update }&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] ($auth.site([[$network]],$site)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) | [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$nick_(remote)|$nick]]) == [[$null]]) { auth.l.add.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]] }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$nick_(remote)|$nick]]) == 0) {&lt;br /&gt;
     auth.q.add.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]&lt;br /&gt;
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(remote)|$nick]],2)) { auth.q.add.main [[$nick_(remote)|$nick]] }&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],[[$nick_(remote)|$nick]])) { auth.n.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid [[$nick_(remote)|$nick]] }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 366 - END OF NAMES LIST ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; 366 Vliedel #vliedel :End of /NAMES list.&lt;br /&gt;
 366 Vliedel #Help :End of /NAMES list&lt;br /&gt;
 RAW 366:&amp;amp; &amp;amp; end of /names list.:{&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$2]],0) , %t = auths. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %n = [[$nick_(nick)|$nick(]][[$1-|$2]],%i)&lt;br /&gt;
     [[If-Then-Else|if]] ([[$hget]](%t,%n) == [[$null]]) { auth.l.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid %n }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$hget]](%t,%n) == 0) {&lt;br /&gt;
       auth.q.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid %n&lt;br /&gt;
       [[If-Then-Else|if]] (![[$comchan]](%n,2)) { auth.q.add.main %n }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]],%n)) { auth.n.add.wid [[$chan_(window)|$chan(]][[$1-|$2]]).wid %n }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PART EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:PART:#:{&lt;br /&gt;
   [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == [[$me]]) {&lt;br /&gt;
     auth.rem.chan [[$chan_(remote)|$chan]]&lt;br /&gt;
     auth.l.rem.chan.all [[$chan_(remote)|$chan]]&lt;br /&gt;
     auth.q.rem.chan.all [[$chan_(remote)|$chan]]&lt;br /&gt;
     auth.n.rem.chan.all [[$chan_(remote)|$chan]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     auth.l.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]&lt;br /&gt;
     auth.q.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]&lt;br /&gt;
     auth.n.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid [[$nick_(remote)|$nick]]&lt;br /&gt;
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(remote)|$nick]],2)) {&lt;br /&gt;
       auth.rem [[$nick_(remote)|$nick]]&lt;br /&gt;
       auth.q.rem.main [[$nick_(remote)|$nick]]&lt;br /&gt;
       auth.n.rem.main [[$nick_(remote)|$nick]]&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ($auth.site([[$network]],$site)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; KICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:KICK:#:{&lt;br /&gt;
   [[If-Then-Else|if]] ($knick == [[$me]]) {&lt;br /&gt;
     auth.rem.chan [[$chan_(remote)|$chan]]&lt;br /&gt;
     auth.l.rem.chan.all [[$chan_(remote)|$chan]]&lt;br /&gt;
     auth.q.rem.chan.all [[$chan_(remote)|$chan]]&lt;br /&gt;
     auth.n.rem.chan.all [[$chan_(remote)|$chan]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     auth.l.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid $knick&lt;br /&gt;
     auth.q.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid $knick&lt;br /&gt;
     auth.n.rem.wid [[$chan_(window)|$chan(]][[$chan_(remote)|$chan]]).wid $knick&lt;br /&gt;
     [[If-Then-Else|if]] (![[$comchan]]($knick,2)) {&lt;br /&gt;
       auth.rem $knick&lt;br /&gt;
       auth.q.rem.main $knick&lt;br /&gt;
       auth.n.rem.main $knick&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QUIT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:QUIT:{&lt;br /&gt;
   auth.rem [[$nick_(remote)|$nick]]&lt;br /&gt;
   auth.l.rem [[$nick_(remote)|$nick]]&lt;br /&gt;
   auth.q.rem [[$nick_(remote)|$nick]]&lt;br /&gt;
   auth.n.rem [[$nick_(remote)|$nick]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:NICK:{&lt;br /&gt;
   auth.nick [[$nick_(remote)|$nick]] $newnick&lt;br /&gt;
   auth.l.nick [[$nick_(remote)|$nick]] $newnick&lt;br /&gt;
   auth.q.nick [[$nick_(remote)|$nick]] $newnick&lt;br /&gt;
   auth.n.nick [[$nick_(remote)|$nick]] $newnick&lt;br /&gt;
   [[If-Then-Else|if]] ($auth.site([[$network]],$site)) { auth_update.nick $newnick $auth.from.site([[$network]],$site) }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATING EVENTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:TEXT:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }&lt;br /&gt;
 on *:ACTION:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }&lt;br /&gt;
 on *:NOTICE:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }&lt;br /&gt;
 on *:RAWMODE:#:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }&lt;br /&gt;
 on *:TOPIC:#:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }&lt;br /&gt;
 on *:INVITE:#:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }&lt;br /&gt;
 [[CTCP]] *:*:*:{ [[If-Then-Else|if]] ($auth.site([[$network]],$site)) &amp;amp;&amp;amp; ([[$comchan]]([[$nick_(remote)|$nick]],1)) { auth_update.nick [[$nick_(remote)|$nick]] $auth.from.site([[$network]],$site) } }&lt;br /&gt;
 RAW 352:&amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; *: { [[If-Then-Else|if]] ($auth.site([[$network]],[[$1-|$4]])) &amp;amp;&amp;amp; ([[$comchan]]([[$1-|$6]],1)) { auth_update.nick [[$1-|$6]] $auth.from.site([[$network]],[[$1-|$4]]) } }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:DISCONNECT:{&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.u [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[hfree]] $v1 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; 200&lt;br /&gt;
 ; auths.cid  nick --&amp;gt; auth&lt;br /&gt;
 &lt;br /&gt;
 ; 200&lt;br /&gt;
 ; auths.l.cid  chanwid.nick --&amp;gt; lnick rnick&lt;br /&gt;
 ; auths.l.cid  chanwid.-firstnick --&amp;gt; first_nick_in_list&lt;br /&gt;
 ; auths.l.cid  chanwid.-lastnick --&amp;gt; last_nick_in_list&lt;br /&gt;
 &lt;br /&gt;
 ; 200&lt;br /&gt;
 ; auths.q.cid  chanwid.nick --&amp;gt; ctime lnick rnick&lt;br /&gt;
 ; auths.q.cid  chanwid.-firstnick --&amp;gt; first_nick_in_queue&lt;br /&gt;
 ; auths.q.cid  chanwid.-lastnick --&amp;gt; last_nick_in_queue&lt;br /&gt;
 ; auths.q.cid  nick --&amp;gt; ctime&lt;br /&gt;
 &lt;br /&gt;
 ; 100&lt;br /&gt;
 ; auths.n.cid  chanwid.nick --&amp;gt; lnick rnick&lt;br /&gt;
 ; auths.n.cid  chanwid.-firstnick --&amp;gt; first_nick_in_list&lt;br /&gt;
 ; auths.n.cid  chanwid.-lastnick --&amp;gt; last_nick_in_list&lt;br /&gt;
 ; auths.n.cid  nick --&amp;gt; lnick rnick&lt;br /&gt;
 ; auths.n.cid  -firstnick --&amp;gt; first_nick_in_list&lt;br /&gt;
 ; auths.n.cid  -lastnick --&amp;gt; last_nick_in_list&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; ---------------------------------------------------------------------------------------------&lt;br /&gt;
 ; --------------------------------------- AUTHS - TABLE ---------------------------------------&lt;br /&gt;
 ; ---------------------------------------------------------------------------------------------&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.ADD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick   $2 = auth&lt;br /&gt;
 [[alias]] -l auth.add {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[hadd]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.rem {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[hdel]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.REM.CHAN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = chan&lt;br /&gt;
 [[alias]] -l auth.rem.chan {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(nick)|$nick(]][[$1-|$1]],%i),2)) { [[hdel]] auths. [[DollarPlus|$+]] [[$cid]] [[$nick_(nick)|$nick(]][[$1-|$1]],%i) }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick   $2 = newnick&lt;br /&gt;
 [[alias]] -l auth.nick {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](auths. [[DollarPlus|$+]] [[$cid]],[[$1-|$1]]) !== [[$null]]) { [[hdel]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]] | [[hadd]] auths. [[DollarPlus|$+]] [[$cid]] [[$1-|$2]] $v1 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; ----------------------------------------------------------------------------------------------------&lt;br /&gt;
 ; --------------------------------------- AUTHS - LEFT - TABLE ---------------------------------------&lt;br /&gt;
 ; ----------------------------------------------------------------------------------------------------&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.ADD.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = wid   $2 = nick&lt;br /&gt;
 [[alias]] -l auth.l.add.wid {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.l. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . ,  %lastnick = [[$hget]](%table,%id [[DollarPlus|$+]] -lastnick)&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (%lastnick) {&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %lastnick 0&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] %lastnick [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %lastnick),1,32) [[$1-|$2]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] 0 0&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]]&lt;br /&gt;
   }&lt;br /&gt;
   [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.l.rem {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     auth.l.rem.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.REM.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = wid   $2 = nick&lt;br /&gt;
 [[alias]] -l auth.l.rem.wid {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.l. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])&lt;br /&gt;
   [[If-Then-Else|if]] (!%val) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)&lt;br /&gt;
   [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$2]]&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l == 0) &amp;amp;&amp;amp; (%nick.r == 0) { [[hdel]] %table %id [[DollarPlus|$+]] -lastnick | [[hdel]] %table %id [[DollarPlus|$+]] -firstnick | [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) %nick.r }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick.r }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick %nick.l }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.REM.CHAN.ALL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = chan&lt;br /&gt;
 [[alias]] -l auth.l.rem.chan.all {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.l. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[hdel]] -w auths.l. [[DollarPlus|$+]] [[$cid]] [[$chan_(window)|$chan(]][[$1-|$1]]).wid [[DollarPlus|$+]] .*&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.L.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick   $2 = newnick&lt;br /&gt;
 [[alias]] -l auth.l.nick {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$1-|$2]]) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.l. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$2]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$2]],%i)).wid [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$1]])&lt;br /&gt;
     [[If-Then-Else|if]] (%val) {&lt;br /&gt;
       [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
       [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %val&lt;br /&gt;
       [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)&lt;br /&gt;
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) [[$1-|$2]] }&lt;br /&gt;
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]] }&lt;br /&gt;
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }&lt;br /&gt;
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]] }&lt;br /&gt;
     }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; -----------------------------------------------------------------------------------------------------&lt;br /&gt;
 ; --------------------------------------- AUTHS - QUEUE - TABLE ---------------------------------------&lt;br /&gt;
 ; -----------------------------------------------------------------------------------------------------&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.ADD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.q.add {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   auth.q.add.main [[$1-|$1]]&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     auth.q.add.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.ADD.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = wid   $2 = nick&lt;br /&gt;
 [[alias]] -l auth.q.add.wid {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %ctime = [[$iif]]([[$hget]](%table,[[$1-|$2]]) == [[$null]],[[$ctime]],$v1)&lt;br /&gt;
   auth.q.rem.wid [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
   [[Local_Variables|var]] %lastnick = [[$hget]](%table,%id [[DollarPlus|$+]] -lastnick)&lt;br /&gt;
   [[If-Then-Else|if]] (!%lastnick) {&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %ctime 0 0&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]]&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] (%ctime &amp;gt;= [[$hget]](%table,%lastnick)) {&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %ctime %lastnick 0&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] %lastnick [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %lastnick),1-2,32) [[$1-|$2]]&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
   [[Local_Variables|var]] %n = [[$hget]](%table,%id [[DollarPlus|$+]] -firstnick) , %nick = [[$1-|$2]]&lt;br /&gt;
   [[while]] (%n) {&lt;br /&gt;
     [[tokenize]] 32 [[$hget]](%table,%id [[DollarPlus|$+]] %n)&lt;br /&gt;
     [[If-Then-Else|if]] (%ctime &amp;lt;= [[$1-|$1]]) {&lt;br /&gt;
       [[hadd]] %table %id [[DollarPlus|$+]] %n [[$1-|$1]] %nick [[$1-|$3]]&lt;br /&gt;
       [[If-Then-Else|if]] ([[$1-|$2]] == 0) {&lt;br /&gt;
         [[hadd]] %table %id [[DollarPlus|$+]] %nick %ctime 0 %n&lt;br /&gt;
         [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[hadd]] %table %id [[DollarPlus|$+]] %nick %ctime [[$1-|$2]] %n&lt;br /&gt;
         [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]]),1-2,32) %nick&lt;br /&gt;
       }&lt;br /&gt;
       [[break]]&lt;br /&gt;
     }&lt;br /&gt;
     [[Local_Variables|var]] %n = [[$1-|$3]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.ADD.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.q.add.main {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[hadd]] auths.q. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]] [[$ctime]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.q.rem {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     auth.q.rem.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   auth.q.rem.main [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = wid   $2 = nick&lt;br /&gt;
 [[alias]] -l auth.q.rem.wid {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])&lt;br /&gt;
   [[If-Then-Else|if]] (!%val) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,2,32) , %nick.r = [[$gettok]](%val,3,32)&lt;br /&gt;
   [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$2]]&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l == 0) &amp;amp;&amp;amp; (%nick.r == 0) { [[hdel]] %table %id [[DollarPlus|$+]] -lastnick | [[hdel]] %table %id [[DollarPlus|$+]] -firstnick | [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1-2,32) %nick.r }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick.r }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),1,32) %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),3,32) }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick %nick.l }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.q.rem.main {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.q. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[hdel]] auths.q. [[DollarPlus|$+]] [[$cid]] [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.REM.CHAN.ALL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = chan&lt;br /&gt;
 [[alias]] -l auth.q.rem.chan.all {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[hdel]] -w %table [[$chan_(window)|$chan(]][[$1-|$1]]).wid [[DollarPlus|$+]] .*&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(nick)|$nick(]][[$1-|$1]],%i),2)) { [[hdel]] %table [[$nick_(nick)|$nick(]][[$1-|$1]],%i) }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.Q.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick   $2 = newnick&lt;br /&gt;
 [[alias]] -l auth.q.nick {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$1-|$2]]) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.q. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$2]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$2]],%i)).wid [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$1]])&lt;br /&gt;
     [[If-Then-Else|if]] (%val) {&lt;br /&gt;
       [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
       [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %val&lt;br /&gt;
       [[Local_Variables|var]] %nick.l = [[$gettok]](%val,2,32) , %nick.r = [[$gettok]](%val,3,32)&lt;br /&gt;
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1-2,32) [[$1-|$2]] }&lt;br /&gt;
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]] }&lt;br /&gt;
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),1,32) [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),3,32) }&lt;br /&gt;
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]] }&lt;br /&gt;
     }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%table,[[$1-|$1]]) !== [[$null]]) { [[hdel]] %table [[$1-|$1]] | [[hadd]] %table [[$1-|$2]] $v1 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; ----------------------------------------------------------------------------------------------------&lt;br /&gt;
 ; --------------------------------------- AUTHS - NEXT - TABLE ---------------------------------------&lt;br /&gt;
 ; ----------------------------------------------------------------------------------------------------&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.ADD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.n.add {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   auth.n.add.main [[$1-|$1]]&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     auth.n.add.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.ADD.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = wid   $2 = nick&lt;br /&gt;
 [[alias]] -l auth.n.add.wid {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . ,  %lastnick = [[$hget]](%table,%id [[DollarPlus|$+]] -lastnick)&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (%lastnick) {&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %lastnick 0&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] %lastnick [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %lastnick),1,32) [[$1-|$2]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] 0 0&lt;br /&gt;
     [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]]&lt;br /&gt;
   }&lt;br /&gt;
   [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.ADD.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.n.add.main {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %lastnick = [[$hget]](%table,-lastnick)&lt;br /&gt;
   [[If-Then-Else|if]] ([[$hget]](%table,[[$1-|$1]])) { [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (%lastnick) {&lt;br /&gt;
     [[hadd]] %table [[$1-|$1]] %lastnick 0&lt;br /&gt;
     [[hadd]] %table %lastnick [[$gettok]]([[$hget]](%table,%lastnick),1,32) [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     [[hadd]] %table [[$1-|$1]] 0 0&lt;br /&gt;
     [[hadd]] %table -firstnick [[$1-|$1]]&lt;br /&gt;
   }&lt;br /&gt;
   [[hadd]] %table -lastnick [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.n.rem {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](auths.n. [[DollarPlus|$+]] [[$cid]])) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     auth.n.rem.wid [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$1]],%i)).wid [[$1-|$1]]&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   auth.n.rem.main [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM.WID ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = wid   $2 = nick&lt;br /&gt;
 [[alias]] -l auth.n.rem.wid {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %id = [[$1-|$1]] [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$2]])&lt;br /&gt;
   [[If-Then-Else|if]] (!%val) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)&lt;br /&gt;
   [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$2]]&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l == 0) &amp;amp;&amp;amp; (%nick.r == 0) { [[hdel]] %table %id [[DollarPlus|$+]] -lastnick | [[hdel]] %table %id [[DollarPlus|$+]] -firstnick | [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) %nick.r }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick %nick.r }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick %nick.l }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM.MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick&lt;br /&gt;
 [[alias]] -l auth.n.rem.main {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %val = [[$hget]](%table,[[$1-|$1]])&lt;br /&gt;
   [[If-Then-Else|if]] (!%val) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)&lt;br /&gt;
   [[hdel]] %table [[$1-|$1]]&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l == 0) &amp;amp;&amp;amp; (%nick.r == 0) { [[hdel]] %table -lastnick | [[hdel]] %table -firstnick | [[return]] }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %nick.l [[$gettok]]([[$hget]](%table,%nick.l),1,32) %nick.r }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table -firstnick %nick.r }&lt;br /&gt;
   [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %nick.r %nick.l [[$gettok]]([[$hget]](%table,%nick.r),2,32) }&lt;br /&gt;
   [[If-Then-Else|else]] { [[hadd]] %table -lastnick %nick.l }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.REM.CHAN.ALL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = chan&lt;br /&gt;
 [[alias]] -l auth.n.rem.chan.all {&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[hdel]] -w %table [[$chan_(window)|$chan(]][[$1-|$1]]).wid [[DollarPlus|$+]] .*&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$nick_(nick)|$nick(]][[$1-|$1]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[If-Then-Else|if]] (![[$comchan]]([[$nick_(nick)|$nick(]][[$1-|$1]],%i),2)) { auth.n.rem.main [[$nick_(nick)|$nick(]][[$1-|$1]],%i) }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS AUTH.N.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $1 = nick   $2 = newnick&lt;br /&gt;
 [[alias]] -l auth.n.nick {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$1-|$2]]) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %table = auths.n. [[DollarPlus|$+]] [[$cid]]&lt;br /&gt;
   [[If-Then-Else|if]] (![[$hget]](%table)) { [[return]] }&lt;br /&gt;
   [[Local_Variables|var]] %i = [[$comchan]]([[$1-|$2]],0)&lt;br /&gt;
   [[while]] (%i) {&lt;br /&gt;
     [[Local_Variables|var]] %id = [[$chan_(window)|$chan(]][[$comchan]]([[$1-|$2]],%i)).wid [[DollarPlus|$+]] . , %val = [[$hget]](%table,%id [[DollarPlus|$+]] [[$1-|$1]])&lt;br /&gt;
     [[If-Then-Else|if]] (%val) {&lt;br /&gt;
       [[hdel]] %table %id [[DollarPlus|$+]] [[$1-|$1]]&lt;br /&gt;
       [[hadd]] %table %id [[DollarPlus|$+]] [[$1-|$2]] %val&lt;br /&gt;
       [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)&lt;br /&gt;
       [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.l [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.l),1,32) [[$1-|$2]] }&lt;br /&gt;
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -firstnick [[$1-|$2]] }&lt;br /&gt;
       [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %id [[DollarPlus|$+]] %nick.r [[$1-|$2]] [[$gettok]]([[$hget]](%table,%id [[DollarPlus|$+]] %nick.r),2,32) }&lt;br /&gt;
       [[If-Then-Else|else]] { [[hadd]] %table %id [[DollarPlus|$+]] -lastnick [[$1-|$2]] }&lt;br /&gt;
     }&lt;br /&gt;
     [[dec]] %i&lt;br /&gt;
   }&lt;br /&gt;
   [[Local_Variables|var]] %val = [[$hget]](%table,[[$1-|$1]])&lt;br /&gt;
   [[If-Then-Else|if]] (%val) {&lt;br /&gt;
     [[hdel]] %table [[$1-|$1]]&lt;br /&gt;
     [[hadd]] %table [[$1-|$2]] %val&lt;br /&gt;
     [[Local_Variables|var]] %nick.l = [[$gettok]](%val,1,32) , %nick.r = [[$gettok]](%val,2,32)&lt;br /&gt;
     [[If-Then-Else|if]] (%nick.l !== 0) { [[hadd]] %table %nick.l [[$gettok]]([[$hget]](%table,%nick.l),1,32) [[$1-|$2]] }&lt;br /&gt;
     [[If-Then-Else|else]] { [[hadd]] %table -firstnick [[$1-|$2]] }&lt;br /&gt;
     [[If-Then-Else|if]] (%nick.r !== 0) { [[hadd]] %table %nick.r [[$1-|$2]] [[$gettok]]([[$hget]](%table,%nick.r),2,32) }&lt;br /&gt;
     [[If-Then-Else|else]] { [[hadd]] %table -lastnick [[$1-|$2]] }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$hget&amp;diff=4319</id>
		<title>$hget</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$hget&amp;diff=4319"/>
		<updated>2011-02-03T13:06:07Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;As you can give $hget different parameters, they will be listed one by one:&lt;br /&gt;
&lt;br /&gt;
*Returns name of a hash table if it exists, or returns the name of the Nth hash table.&lt;br /&gt;
 $hget(name/N)[.size]&lt;br /&gt;
&lt;br /&gt;
The size property returns the N size of table, as specified in [[Hmake|/hmake]].&lt;br /&gt;
&lt;br /&gt;
*Returns the data associated with an item in the specified hash table.&lt;br /&gt;
 $hget(name/N, item)[.unset]&lt;br /&gt;
The unset property returns the time remaining before an item is unset.&lt;br /&gt;
&lt;br /&gt;
*Assigns the contents of an item to a &amp;amp;binvar.&lt;br /&gt;
 $hget(name/N, item, &amp;amp;binvar)&lt;br /&gt;
&lt;br /&gt;
*This allows you to reference the table as an index from 0 to N, in order to look up the Nth item in the table.&lt;br /&gt;
 $hget(name/N, N).item&lt;br /&gt;
&lt;br /&gt;
If N is zero, it returns the total number of items in the table.&lt;br /&gt;
&lt;br /&gt;
You can also reference the Nth data value directly with $hget().data, but note, that this method is provided as a convenience, it is not an efficient way to use the hash table.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
At first, we need a hashtable for all examples, so lets make one:&lt;br /&gt;
 ; have a nice alias called &#039;&#039;makehash&#039;&#039; for it&lt;br /&gt;
 [[alias]] makehash {&lt;br /&gt;
  ; here we actually &#039;&#039;make&#039;&#039; the hashtable&lt;br /&gt;
  [[hmake]] testhash 100&lt;br /&gt;
  ; now lets put data in it&lt;br /&gt;
  [[hadd]] testhash Dana Dana@staff.quakenet.org&lt;br /&gt;
  hadd testhash user1 user1@random.host&lt;br /&gt;
  hadd testhash user2 user2@another.host&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 [[echo]] -a $hget(testhash) has the size: $hget(testhash).size&lt;br /&gt;
This example will echo &#039;&#039;makehash has the size: 100&#039;&#039;.&lt;br /&gt;
 echo -a $hget(testhash,user1)&lt;br /&gt;
This one will echo &#039;&#039;user1@random.host&#039;&#039; as it&#039;s the data connected to &#039;&#039;user1&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
The following, more complex example will loop through the entire table and echo everything:&lt;br /&gt;
 ; lets make a little alias called &#039;&#039;showhash&#039;&#039;. At the end, it will look like &#039;&#039;/showhash &amp;lt;name&amp;gt;&#039;&#039;&lt;br /&gt;
 alias showhash {&lt;br /&gt;
  ; echo the name and a kind of &amp;quot;table header&amp;quot;&lt;br /&gt;
  echo -a $1&lt;br /&gt;
  echo -a item =&amp;gt; data&lt;br /&gt;
  [[var]] %i = 1&lt;br /&gt;
  ; lets loop through all items. $hget($1,0).item will return the total amount of items.&lt;br /&gt;
  [[while]] (%i &amp;lt;= $hget($1,0).item) {&lt;br /&gt;
   echo -a $hget($1,%i).item =&amp;gt; $hget($1,%i).data&lt;br /&gt;
   ; increase looping-variable&lt;br /&gt;
   inc %i&lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
Using &#039;&#039;/showhash testhash&#039;&#039; will echo:&lt;br /&gt;
 user1 =&amp;gt; user1@random.host&lt;br /&gt;
 user2 =&amp;gt; user2@another.host&lt;br /&gt;
 Dana =&amp;gt; Dana@staff.quakenet.org&lt;br /&gt;
&lt;br /&gt;
[[Category:Hash Table]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$hfind&amp;diff=4318</id>
		<title>$hfind</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$hfind&amp;diff=4318"/>
		<updated>2011-02-03T13:05:51Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Searches table for the Nth item name which matches text. Returns item name.&lt;br /&gt;
 $hfind(name/N, text, N, M)[.data]&lt;br /&gt;
&lt;br /&gt;
If you specify the .data property, it searches for a matching data value.&lt;br /&gt;
&lt;br /&gt;
M is optional, and can be:&lt;br /&gt;
&amp;lt;table width=&amp;quot;50%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;10%&amp;quot;&amp;gt;&amp;lt;b&amp;gt;M&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Explanation&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;n&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;normal text comparison (default if M isn&#039;t specified)&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;w&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;text is wildcard text&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;W&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;hash table item/data is wildcard text&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;r&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;text is regular expression&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;R&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;hash table item/data is regular expression&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that if you specify N = 0, it will return the total amount of matching items (see the second example below).&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
At first, we need a hashtable for all examples, so lets make one:&lt;br /&gt;
 ; have a nice alias called &#039;&#039;makehash&#039;&#039; for it&lt;br /&gt;
 [[alias]] makehash {&lt;br /&gt;
  ; here we actually &#039;&#039;make&#039;&#039; the hashtable&lt;br /&gt;
  [[hmake]] testhash 100&lt;br /&gt;
  ; now lets put data in it&lt;br /&gt;
  [[hadd]] testhash Dana Dana@staff.quakenet.org&lt;br /&gt;
  hadd testhash user1 user1@random.host&lt;br /&gt;
  hadd testhash user2 user2@another.host&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The first example will just search for user1@random.host and returns the item (&#039;&#039;user1&#039;&#039;):&lt;br /&gt;
 [[echo]] -a $hfind(testhash,Dana@staff.quakenet.org,1).data&lt;br /&gt;
&lt;br /&gt;
The next example will loop through all data&#039;s containing *user* and return the item and data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;user1 =&amp;gt; user1@random.host&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;user2 =&amp;gt; user2@another.host&#039;&#039;&lt;br /&gt;
 [[var]] %i = 1&lt;br /&gt;
 ; let&#039;s start the looping. $find(testhash,*user*,0,w).data returns the total amount of found items.&lt;br /&gt;
 [[while]] (%i &amp;lt;= $hfind(testhash,*user*,0,w).data) {&lt;br /&gt;
  ; this echos it to the active window. $hget(testhash,$hfind(testhash,*user*,%i,w)) returns&lt;br /&gt;
  ; the data of the found item.&lt;br /&gt;
  echo -a $hfind(testhash,*user*,%i,w) =&amp;gt; [[$hget]](testhash,$hfind(testhash,*user*,%i,w))&lt;br /&gt;
  ; increase the looping-variable&lt;br /&gt;
  [[inc]] %i&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Hash Table]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Test2&amp;diff=2834</id>
		<title>Test2</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Test2&amp;diff=2834"/>
		<updated>2011-02-03T12:56:32Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;info:&lt;br /&gt;
 ;&lt;br /&gt;
 ;  by wiebe @ QuakeNet&lt;br /&gt;
 ;  version 1.0  (written and tested on mIRC 6.15)&lt;br /&gt;
 ;&lt;br /&gt;
 ;  last edit: Sun Jun 06 2004&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;What does this script do?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  updates the IAL by doing /who chan1,chan2,chan3 etc&lt;br /&gt;
 ;  if a channel is too big, /who nick1,nick2,nick3 etc is done untill the IAL for the channel is   updated&lt;br /&gt;
 ;  script updates from smallest to the biggest channel&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;How to use this script?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  config the options below&lt;br /&gt;
 ;  /ialupdate can be used to make the script update the IAL without waiting for the timer to  trigger it&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Why is this script good?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  sending /who chan for every channel is not needed and goes slow (lag)&lt;br /&gt;
 ;  sending /who chan on join may cause Excess Flood or Max sendQ exceeded&lt;br /&gt;
 ;  sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results  (Max sendQ exceeded)&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS MAX.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l max.who {&lt;br /&gt;
  ; maximum number of replies in a WHO, too big may cause &#039;Max sendQ exceeded&#039; disconnection&lt;br /&gt;
  ; too low may take the script a long time to update the IAL, 500 or 400 should be fine for most situations&lt;br /&gt;
  ![[return]] 700&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS LEN.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l len.who {&lt;br /&gt;
  ; maximum length of the /who &amp;lt;string&amp;gt;, too long may cause the server to ignore the command&lt;br /&gt;
  ; too low may slow things down, 400 should be fine in most cases&lt;br /&gt;
  ![[return]] 400&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS DELAY.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l delay.who {&lt;br /&gt;
  ; N seconds after the first join, the script starts to update the IAL&lt;br /&gt;
  ![[return]] 120&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS REPEAT.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l repeat.who {&lt;br /&gt;
  ; wait N seconds after doing /who to do the next check and /who&lt;br /&gt;
  ![[return]] 30&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS SHOW ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l show.who {&lt;br /&gt;
  ; set this to 1 if you want the script to echo when the IAL is updated&lt;br /&gt;
  ; shows number of opers, number of users that are away, number of users that are deaf (+d),&lt;br /&gt;
  ; number of users that have fake host (+x)&lt;br /&gt;
  ; may slow things down, needs some checks / loops etc&lt;br /&gt;
  ; only shows when a whole channel is being who&#039;d&lt;br /&gt;
  ![[return]] 1&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:join:#:{&lt;br /&gt;
  ; we join, IAL not updated, timer does not run, start a timer&lt;br /&gt;
  [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == [[$me]]) &amp;amp;&amp;amp; (![[|$timer]]([[DollarPlus|$+]]([[$cid]],.ial-update.update))) {&lt;br /&gt;
    .![[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .ial-update.update 1 $$delay.who ial-update.update&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LOAD EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:load:{ !scon -at1 .!timer [[$!]][[DollarPlus|+]] [[$!]][[cid]] [[$!]][[DollarPlus|+]] .ial-update.update 1 $$delay.who ial-update.update }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IALUPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] ialupdate { ![[echo]] -a IAL-update: $ial-update.update }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.UPDATE   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l ial-update.update {&lt;br /&gt;
  ![[Local_Variables|var]] %c, %n&lt;br /&gt;
  ; IAL is set on&lt;br /&gt;
  [[If-Then-Else|if]] ([[$ial]]) {&lt;br /&gt;
    ; hash table does not exist, set a var with the channels we need to who&lt;br /&gt;
    [[If-Then-Else|if]] (![[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[Local_Variables|var]] %c = [[|$ial-update.chan]]($max.who,$len.who)&lt;br /&gt;
      ; something is in there, send it to the hash alias, send the who request&lt;br /&gt;
      [[If-Then-Else|if]] (%c) { ial-update.hash %c | .!quote WHO %c }&lt;br /&gt;
      ; else no channels to who, set a var with the nicks we need to who&lt;br /&gt;
      [[If-Then-Else|else]] { ![[Local_Variables|var]] %n = [[|$ial-update.nick]]($max.who,$len.who)&lt;br /&gt;
        ; something is in there, send it to the hash alias, send the who request&lt;br /&gt;
        [[If-Then-Else|if]] (%n) { ial-update.hash %n | .!quote WHO %n  }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    ; we did a who or the hash table was not empty, start a timer to run this alias again&lt;br /&gt;
    [[If-Then-Else|if]] (%c) || (%n) || ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) {&lt;br /&gt;
      .![[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .ial-update.update 1 $$repeat.who ial-update.update&lt;br /&gt;
    }&lt;br /&gt;
    ; return some info&lt;br /&gt;
    [[If-Then-Else|if]] (%c) || (%n) { ![[return]] updating }&lt;br /&gt;
    [[If-Then-Else|elseif]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[return]] already in progress }&lt;br /&gt;
    [[If-Then-Else|else]] { ![[return]] nothing to update }&lt;br /&gt;
  }&lt;br /&gt;
  ; ial is off return some info&lt;br /&gt;
  [[If-Then-Else|else]] { ![[return]] ERROR, IAL is turned off, /IAL on to enable }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.SORT  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.sort&lt;br /&gt;
 ; sorts channels where the IAL is not updated&lt;br /&gt;
 ; &amp;lt;number of nicks&amp;gt;.&amp;lt;channel number&amp;gt;&lt;br /&gt;
 ; 127.1 &amp;lt;= means 127 users on channel 1&lt;br /&gt;
 [[alias]] -l ial-update.sort {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1, %c&lt;br /&gt;
   ; loop through all common channels that we have with ourself&lt;br /&gt;
  ; $chan(0) returns the number of open channel windows,&lt;br /&gt;
  ; which does not mean you are on it (&amp;quot;keep channels open&amp;quot; option)&lt;br /&gt;
  [[while]] (%x &amp;lt;= [[$comchan]]([[$me]],0)) {&lt;br /&gt;
    ; check if the ial is not updated or busy, add it to a var&lt;br /&gt;
    [[If-Then-Else|if]] ([[$chan_(window)|$chan(]][[$comchan]]([[$me]],%x)).ial == $false) { ![[Local_Variables|var]] %c =  [[$addtok]](%c,[[DollarPlus|$+]]([[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),0),.,%x),32) }&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ; return it sorted&lt;br /&gt;
  ![[return]] [[$sorttok]](%c,32,n)&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.MAX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.max(N)&lt;br /&gt;
 ; N maximum number of nicks to request at once&lt;br /&gt;
 ; this alias returns the channels to ial based on the info provided by $ial-update.sort&lt;br /&gt;
 ; #chan1,#chan2,#chan3&lt;br /&gt;
 [[alias]] -l ial-update.max {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1, %t = 0, %c = $ial-update.sort, %w&lt;br /&gt;
  ; loop through the channels and as long as %t smaller then $1, increase %t&lt;br /&gt;
  [[while]] (%x &amp;lt;= [[$numtok]](%c,32)) &amp;amp;&amp;amp; (%t &amp;lt; [[$1-|$1]]) {&lt;br /&gt;
    ![[inc]] %t [[$gettok]]([[$gettok]](%c,%x,32),1,46)&lt;br /&gt;
    ; if %t is greater then $1, stop the loop&lt;br /&gt;
    [[If-Then-Else|if]] (%t &amp;gt; [[$1-|$1]]) { ![[break]] }&lt;br /&gt;
    ; add it to a var&lt;br /&gt;
    ![[Local_Variables|var]] %w = [[$addtok]](%w,[[$gettok]]([[$gettok]](%c,%x,32),2,46),32)&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ![[return]] %w&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.CHAN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.chan(N,L)&lt;br /&gt;
 ; N maximum number of nicks to request at once&lt;br /&gt;
 ; L maximum length of the WHO request&lt;br /&gt;
 ; this alias is used to WHO channels&lt;br /&gt;
 [[alias]] -l ial-update.chan {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1, %l = 0, %c = [[|$ial-update.max]]([[$1-|$1]]), %w&lt;br /&gt;
  ; loop through the channels, as long as %l smaller then $2, increase %l for the length of the  channel&lt;br /&gt;
  [[while]] (%x &amp;lt;= [[$numtok]](%c,32)) &amp;amp;&amp;amp; (%l &amp;lt; [[$1-|$2]]) {&lt;br /&gt;
    ![[inc]] %l [[$len]]([[$comchan]]([[$me]],[[$gettok]](%c,%x,32)))&lt;br /&gt;
    ; %l greater then $2, stop the loop&lt;br /&gt;
    [[If-Then-Else|if]] (%l &amp;gt; [[$1-|$2]]) { ![[break]] }&lt;br /&gt;
    ; add it to the var&lt;br /&gt;
    ![[Local_Variables|var]] %w = [[$addtok]](%w,[[$comchan]]([[$me]],[[$gettok]](%c,%x,32)),44)&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ![[return]] %w&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.nick(N,L)&lt;br /&gt;
 ; N maximum number of nicks to request at once&lt;br /&gt;
 ; L maximum length of the WHO request&lt;br /&gt;
 ; this alias is used to WHO nicks&lt;br /&gt;
 [[alias]] -l ial-update.nick {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1&lt;br /&gt;
  ; loop through the channels untill we found one where the IAL isnt updated&lt;br /&gt;
  [[while]] ([[$chan_(window)|$chan(]][[$comchan]]([[$me]],%x)).ial != $false) &amp;amp;&amp;amp; (%x &amp;lt;= [[$comchan]]([[$me]],0)) {&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ; ial is not updated, set vars&lt;br /&gt;
  [[If-Then-Else|if]] ([[$chan_(window)|$chan(]][[$comchan]]([[$me]],%x)).ial == $false) { ![[Local_Variables|var]] %y = 1, %t = 0, %l = 0, %w&lt;br /&gt;
    ; loop&lt;br /&gt;
    [[while]] (%t &amp;lt;= [[$1-|$1]]) &amp;amp;&amp;amp; (%l &amp;lt; [[$1-|$2]]) &amp;amp;&amp;amp; (%y &amp;lt;= [[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),0)) {&lt;br /&gt;
      ; ial for that nick isnt updated, increase %l&lt;br /&gt;
      [[If-Then-Else|if]] (![[$ial]]([[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),%y))) {&lt;br /&gt;
        ![[inc]] %l [[$len]]([[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),%y))&lt;br /&gt;
        ; if greater then $2, stop the loop&lt;br /&gt;
        [[If-Then-Else|if]] (%l &amp;gt; [[$1-|$2]]) { ![[break]] }&lt;br /&gt;
        ; add it to the var&lt;br /&gt;
        ![[Local_Variables|var]] %w = [[$addtok]](%w,[[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),%y),44)&lt;br /&gt;
      }&lt;br /&gt;
      ![[inc]] %y&lt;br /&gt;
    }&lt;br /&gt;
    ![[return]] %w&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.HASH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; /ial-update.hash &amp;lt;things&amp;gt; -remove&lt;br /&gt;
 [[alias]] -l ial-update.hash {&lt;br /&gt;
  ; $2 is not there, set a var&lt;br /&gt;
  [[If-Then-Else|if]] ([[$1-|$2]] == [[$null]]) { ![[Local_Variables|var]] %x = [[$numtok]]([[$1-|$1]],44)&lt;br /&gt;
    ; loop through each part seperated with a comma, add it to a hash table&lt;br /&gt;
    [[while]] (%x) { ![[hadd]] -m [[DollarPlus|$+]](ial-update.,[[$cid]]) [[$gettok]]([[$1-|$1]],%x,44) 1 | ![[dec]] %x }&lt;br /&gt;
    ; add mask&lt;br /&gt;
    ![[hadd]] -m [[DollarPlus|$+]](ial-update.,[[$cid]]) -mask [[$1-|$1]]&lt;br /&gt;
  }&lt;br /&gt;
  ; $2 is -remove, set a var&lt;br /&gt;
  [[If-Then-Else|elseif]] ([[$1-|$2]] == -remove) { ![[Local_Variables|var]] %x = [[$numtok]]([[$1-|$1]],44)&lt;br /&gt;
    ; loop through each part seperated with a comma, remove it from the hash table&lt;br /&gt;
    [[while]] (%x) { [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[$gettok]]([[$1-|$1]],%x,44) } | ![[dec]] %x }&lt;br /&gt;
    ; del mask&lt;br /&gt;
    ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) -mask&lt;br /&gt;
    ; check hash table, free hash table&lt;br /&gt;
    [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),0).item == 0) &amp;amp;&amp;amp; ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[hfree]] [[DollarPlus|$+]](ial-update.,[[$cid]]) }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 352 WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; 352 &amp;lt;you&amp;gt; &amp;lt;channel&amp;gt; &amp;lt;user&amp;gt; &amp;lt;host&amp;gt; &amp;lt;server&amp;gt; &amp;lt;nick&amp;gt; &amp;lt;flags&amp;gt; :&amp;lt;distance&amp;gt; &amp;lt;realname&amp;gt;&lt;br /&gt;
 raw 352:&amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; *: {&lt;br /&gt;
  ; chan or nick are in the hash table&lt;br /&gt;
  [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[$1-|$2]])) || ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[$1-|$6]])) {&lt;br /&gt;
    ; check setting, set a var&lt;br /&gt;
    [[If-Then-Else|if]] ($show.who == 1) &amp;amp;&amp;amp; ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[$1-|$2]])) &amp;amp;&amp;amp; ([[$comchan]]([[$1-|$6]],0)) { ![[Local_Variables|var]] %x = [[$comchan]]([[$1-|$6]],0)&lt;br /&gt;
      ; loop, set a var&lt;br /&gt;
      [[while]] (%x) { ![[Local_Variables|var]] %c = [[$comchan]]([[$1-|$6]],%x)&lt;br /&gt;
        ; check has table&lt;br /&gt;
        [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),%c)) {&lt;br /&gt;
          ; * meaning oper isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (* isin [[$1-|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),oper) }&lt;br /&gt;
          ; G meaning Gone isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (G isincs [[$1-|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),away) }&lt;br /&gt;
          ; d meaning deaf isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (d isincs [[$1-|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),deaf) }&lt;br /&gt;
          ; x meaning fake host isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (x isincs [[$1-|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),xhost) }&lt;br /&gt;
        }&lt;br /&gt;
        ![[dec]] %x&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    ; stop mirc from showing this raw&lt;br /&gt;
    ![[haltdef]]&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 315 WHO END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; raw 315 &amp;lt;you&amp;gt; &amp;lt;requested&amp;gt; :End of /who list.&lt;br /&gt;
 raw 315:&amp;amp; &amp;amp; end of /WHO list.: {&lt;br /&gt;
  ; check -mask in hash table&lt;br /&gt;
  [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),-mask) == [[$1-|$2]]) {&lt;br /&gt;
    ; check setting, set a var&lt;br /&gt;
    [[If-Then-Else|if]] ($show.who == 1) { ![[Local_Variables|var]] %x = [[$numtok]]([[$1-|$2]],44)&lt;br /&gt;
      ; loop, we are on the channel, set var&lt;br /&gt;
      [[while]] (%x) { [[If-Then-Else|if]] ([[$me]] ison [[$gettok]]([[$1-|$2]],%x,44)) { ![[Local_Variables|var]] %c = [[$gettok]]([[$1-|$2]],%x,44)&lt;br /&gt;
          ; oper info&lt;br /&gt;
          ![[Local_Variables|var]] %oper = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),oper)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %oper = %oper / [[$round]]([[$calc]](%oper / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % Oper&lt;br /&gt;
          ; away info&lt;br /&gt;
          ![[Local_Variables|var]] %away = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),away)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %away = %away / [[$round]]([[$calc]](%away / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % Away&lt;br /&gt;
          ; deaf info&lt;br /&gt;
          ![[Local_Variables|var]] %deaf = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),deaf)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %deaf = %deaf / [[$round]]([[$calc]](%deaf / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % deaf&lt;br /&gt;
          ; xhost info&lt;br /&gt;
          ![[Local_Variables|var]] %xhost = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),xhost)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %xhost = %xhost / [[$round]]([[$calc]](%xhost / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % x-host&lt;br /&gt;
          ; echo&lt;br /&gt;
          ![[echo]] -t [[$gettok]]([[$1-|$2]],%x,44) * IAL updated ( [[DollarPlus|$+]] %oper ---- %away ---- %deaf ---- %xhost [[DollarPlus|$+]] )&lt;br /&gt;
        }&lt;br /&gt;
        ; remove from hash table&lt;br /&gt;
        ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),oper) | ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),away)&lt;br /&gt;
        ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),deaf) | ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),xhost)&lt;br /&gt;
        ![[dec]] %x&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    ; remove the items from the hash table&lt;br /&gt;
    ial-update.hash [[$1-|$2]] -remove&lt;br /&gt;
    ![[haltdef]]&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:disconnect:{ [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[hfree]] [[DollarPlus|$+]](ial-update.,[[$cid]]) } }&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Test2&amp;diff=2831</id>
		<title>Test2</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Test2&amp;diff=2831"/>
		<updated>2011-02-03T12:55:07Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IAL-UPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;info:&lt;br /&gt;
 ;&lt;br /&gt;
 ;  by wiebe @ QuakeNet&lt;br /&gt;
 ;  version 1.0  (written and tested on mIRC 6.15)&lt;br /&gt;
 ;&lt;br /&gt;
 ;  last edit: Sun Jun 06 2004&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;What does this script do?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  updates the IAL by doing /who chan1,chan2,chan3 etc&lt;br /&gt;
 ;  if a channel is too big, /who nick1,nick2,nick3 etc is done untill the IAL for the channel is   updated&lt;br /&gt;
 ;  script updates from smallest to the biggest channel&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;How to use this script?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  config the options below&lt;br /&gt;
 ;  /ialupdate can be used to make the script update the IAL without waiting for the timer to  trigger it&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;Why is this script good?&lt;br /&gt;
 ;&lt;br /&gt;
 ;  sending /who chan for every channel is not needed and goes slow (lag)&lt;br /&gt;
 ;  sending /who chan on join may cause Excess Flood or Max sendQ exceeded&lt;br /&gt;
 ;  sending /who chan1,chan2,chan3 can be much faster, but only if there are not too many results  (Max sendQ exceeded)&lt;br /&gt;
 ;&lt;br /&gt;
 ;&lt;br /&gt;
 ;  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS MAX.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l max.who {&lt;br /&gt;
  ; maximum number of replies in a WHO, too big may cause &#039;Max sendQ exceeded&#039; disconnection&lt;br /&gt;
  ; too low may take the script a long time to update the IAL, 500 or 400 should be fine for most situations&lt;br /&gt;
  ![[return]] 700&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS LEN.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l len.who {&lt;br /&gt;
  ; maximum length of the /who &amp;lt;string&amp;gt;, too long may cause the server to ignore the command&lt;br /&gt;
  ; too low may slow things down, 400 should be fine in most cases&lt;br /&gt;
  ![[return]] 400&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS DELAY.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l delay.who {&lt;br /&gt;
  ; N seconds after the first join, the script starts to update the IAL&lt;br /&gt;
  ![[return]] 120&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS REPEAT.WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l repeat.who {&lt;br /&gt;
  ; wait N seconds after doing /who to do the next check and /who&lt;br /&gt;
  ![[return]] 30&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS SHOW ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l show.who {&lt;br /&gt;
  ; set this to 1 if you want the script to echo when the IAL is updated&lt;br /&gt;
  ; shows number of opers, number of users that are away, number of users that are deaf (+d),&lt;br /&gt;
  ; number of users that have fake host (+x)&lt;br /&gt;
  ; may slow things down, needs some checks / loops etc&lt;br /&gt;
  ; only shows when a whole channel is being who&#039;d&lt;br /&gt;
  ![[return]] 1&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:join:#:{&lt;br /&gt;
  ; we join, IAL not updated, timer does not run, start a timer&lt;br /&gt;
  [[If-Then-Else|if]] ([[$nick_(remote)|$nick]] == [[$me]]) &amp;amp;&amp;amp; (![[|$timer]]([[DollarPlus|$+]]([[$cid]],.ial-update.update))) {&lt;br /&gt;
    .![[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .ial-update.update 1 $$delay.who ial-update.update&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LOAD EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:load:{ !scon -at1 .!timer [[$!]][[DollarPlus|+]] [[$!]][[cid]] [[$!]][[DollarPlus|+]] .ial-update.update 1 $$delay.who ial-update.update }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IALUPDATE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] ialupdate { ![[echo]] -a IAL-update: $ial-update.update }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.UPDATE   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 [[alias]] -l ial-update.update {&lt;br /&gt;
  ![[Local_Variables|var]] %c, %n&lt;br /&gt;
  ; IAL is set on&lt;br /&gt;
  [[If-Then-Else|if]] ([[$ial]]) {&lt;br /&gt;
    ; hash table does not exist, set a var with the channels we need to who&lt;br /&gt;
    [[If-Then-Else|if]] (![[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[Local_Variables|var]] %c = [[|$ial-update.chan]]($max.who,$len.who)&lt;br /&gt;
      ; something is in there, send it to the hash alias, send the who request&lt;br /&gt;
      [[If-Then-Else|if]] (%c) { ial-update.hash %c | .!quote WHO %c }&lt;br /&gt;
      ; else no channels to who, set a var with the nicks we need to who&lt;br /&gt;
      [[If-Then-Else|else]] { ![[Local_Variables|var]] %n = [[|$ial-update.nick]]($max.who,$len.who)&lt;br /&gt;
        ; something is in there, send it to the hash alias, send the who request&lt;br /&gt;
        [[If-Then-Else|if]] (%n) { ial-update.hash %n | .!quote WHO %n  }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    ; we did a who or the hash table was not empty, start a timer to run this alias again&lt;br /&gt;
    [[If-Then-Else|if]] (%c) || (%n) || ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) {&lt;br /&gt;
      .![[timer]] [[DollarPlus|$+]] [[$cid]] [[DollarPlus|$+]] .ial-update.update 1 $$repeat.who ial-update.update&lt;br /&gt;
    }&lt;br /&gt;
    ; return some info&lt;br /&gt;
    [[If-Then-Else|if]] (%c) || (%n) { ![[return]] updating }&lt;br /&gt;
    [[If-Then-Else|elseif]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[return]] already in progress }&lt;br /&gt;
    [[If-Then-Else|else]] { ![[return]] nothing to update }&lt;br /&gt;
  }&lt;br /&gt;
  ; ial is off return some info&lt;br /&gt;
  [[If-Then-Else|else]] { ![[return]] ERROR, IAL is turned off, /IAL on to enable }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.SORT  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.sort&lt;br /&gt;
 ; sorts channels where the IAL is not updated&lt;br /&gt;
 ; &amp;lt;number of nicks&amp;gt;.&amp;lt;channel number&amp;gt;&lt;br /&gt;
 ; 127.1 &amp;lt;= means 127 users on channel 1&lt;br /&gt;
 [[alias]] -l ial-update.sort {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1, %c&lt;br /&gt;
   ; loop through all common channels that we have with ourself&lt;br /&gt;
  ; $chan(0) returns the number of open channel windows,&lt;br /&gt;
  ; which does not mean you are on it (&amp;quot;keep channels open&amp;quot; option)&lt;br /&gt;
  [[while]] (%x &amp;lt;= [[$comchan]]([[$me]],0)) {&lt;br /&gt;
    ; check if the ial is not updated or busy, add it to a var&lt;br /&gt;
    [[If-Then-Else|if]] ([[$chan_(window)|$chan(]][[$comchan]]([[$me]],%x)).ial == $false) { ![[Local_Variables|var]] %c =  [[$addtok]](%c,[[DollarPlus|$+]]([[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),0),.,%x),32) }&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ; return it sorted&lt;br /&gt;
  ![[return]] [[$sorttok]](%c,32,n)&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.MAX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.max(N)&lt;br /&gt;
 ; N maximum number of nicks to request at once&lt;br /&gt;
 ; this alias returns the channels to ial based on the info provided by $ial-update.sort&lt;br /&gt;
 ; #chan1,#chan2,#chan3&lt;br /&gt;
 [[alias]] -l ial-update.max {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1, %t = 0, %c = $ial-update.sort, %w&lt;br /&gt;
  ; loop through the channels and as long as %t smaller then $1, increase %t&lt;br /&gt;
  [[while]] (%x &amp;lt;= [[$numtok]](%c,32)) &amp;amp;&amp;amp; (%t &amp;lt; [[$1|$1]]) {&lt;br /&gt;
    ![[inc]] %t [[$gettok]]([[$gettok]](%c,%x,32),1,46)&lt;br /&gt;
    ; if %t is greater then $1, stop the loop&lt;br /&gt;
    [[If-Then-Else|if]] (%t &amp;gt; [[$1|$1]]) { ![[break]] }&lt;br /&gt;
    ; add it to a var&lt;br /&gt;
    ![[Local_Variables|var]] %w = [[$addtok]](%w,[[$gettok]]([[$gettok]](%c,%x,32),2,46),32)&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ![[return]] %w&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.CHAN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.chan(N,L)&lt;br /&gt;
 ; N maximum number of nicks to request at once&lt;br /&gt;
 ; L maximum length of the WHO request&lt;br /&gt;
 ; this alias is used to WHO channels&lt;br /&gt;
 [[alias]] -l ial-update.chan {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1, %l = 0, %c = [[|$ial-update.max]]([[$1|$1]]), %w&lt;br /&gt;
  ; loop through the channels, as long as %l smaller then $2, increase %l for the length of the  channel&lt;br /&gt;
  [[while]] (%x &amp;lt;= [[$numtok]](%c,32)) &amp;amp;&amp;amp; (%l &amp;lt; [[$1|$2]]) {&lt;br /&gt;
    ![[inc]] %l [[$len]]([[$comchan]]([[$me]],[[$gettok]](%c,%x,32)))&lt;br /&gt;
    ; %l greater then $2, stop the loop&lt;br /&gt;
    [[If-Then-Else|if]] (%l &amp;gt; [[$1|$2]]) { ![[break]] }&lt;br /&gt;
    ; add it to the var&lt;br /&gt;
    ![[Local_Variables|var]] %w = [[$addtok]](%w,[[$comchan]]([[$me]],[[$gettok]](%c,%x,32)),44)&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ![[return]] %w&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.NICK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; $ial-update.nick(N,L)&lt;br /&gt;
 ; N maximum number of nicks to request at once&lt;br /&gt;
 ; L maximum length of the WHO request&lt;br /&gt;
 ; this alias is used to WHO nicks&lt;br /&gt;
 [[alias]] -l ial-update.nick {&lt;br /&gt;
  ![[Local_Variables|var]] %x = 1&lt;br /&gt;
  ; loop through the channels untill we found one where the IAL isnt updated&lt;br /&gt;
  [[while]] ([[$chan_(window)|$chan(]][[$comchan]]([[$me]],%x)).ial != $false) &amp;amp;&amp;amp; (%x &amp;lt;= [[$comchan]]([[$me]],0)) {&lt;br /&gt;
    ![[inc]] %x&lt;br /&gt;
  }&lt;br /&gt;
  ; ial is not updated, set vars&lt;br /&gt;
  [[If-Then-Else|if]] ([[$chan_(window)|$chan(]][[$comchan]]([[$me]],%x)).ial == $false) { ![[Local_Variables|var]] %y = 1, %t = 0, %l = 0, %w&lt;br /&gt;
    ; loop&lt;br /&gt;
    [[while]] (%t &amp;lt;= [[$1|$1]]) &amp;amp;&amp;amp; (%l &amp;lt; [[$1|$2]]) &amp;amp;&amp;amp; (%y &amp;lt;= [[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),0)) {&lt;br /&gt;
      ; ial for that nick isnt updated, increase %l&lt;br /&gt;
      [[If-Then-Else|if]] (![[$ial]]([[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),%y))) {&lt;br /&gt;
        ![[inc]] %l [[$len]]([[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),%y))&lt;br /&gt;
        ; if greater then $2, stop the loop&lt;br /&gt;
        [[If-Then-Else|if]] (%l &amp;gt; [[$1|$2]]) { ![[break]] }&lt;br /&gt;
        ; add it to the var&lt;br /&gt;
        ![[Local_Variables|var]] %w = [[$addtok]](%w,[[$nick_(nick)|$nick(]][[$comchan]]([[$me]],%x),%y),44)&lt;br /&gt;
      }&lt;br /&gt;
      ![[inc]] %y&lt;br /&gt;
    }&lt;br /&gt;
    ![[return]] %w&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS IAL-UPDATE.HASH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; /ial-update.hash &amp;lt;things&amp;gt; -remove&lt;br /&gt;
 [[alias]] -l ial-update.hash {&lt;br /&gt;
  ; $2 is not there, set a var&lt;br /&gt;
  [[If-Then-Else|if]] ([[$1|$2]] == [[$null]]) { ![[Local_Variables|var]] %x = [[$numtok]]([[$1|$1]],44)&lt;br /&gt;
    ; loop through each part seperated with a comma, add it to a hash table&lt;br /&gt;
    [[while]] (%x) { ![[hadd]] -m [[DollarPlus|$+]](ial-update.,[[$cid]]) [[$gettok]]([[$1|$1]],%x,44) 1 | ![[dec]] %x }&lt;br /&gt;
    ; add mask&lt;br /&gt;
    ![[hadd]] -m [[DollarPlus|$+]](ial-update.,[[$cid]]) -mask [[$1|$1]]&lt;br /&gt;
  }&lt;br /&gt;
  ; $2 is -remove, set a var&lt;br /&gt;
  [[If-Then-Else|elseif]] ([[$1|$2]] == -remove) { ![[Local_Variables|var]] %x = [[$numtok]]([[$1|$1]],44)&lt;br /&gt;
    ; loop through each part seperated with a comma, remove it from the hash table&lt;br /&gt;
    [[while]] (%x) { [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[$gettok]]([[$1|$1]],%x,44) } | ![[dec]] %x }&lt;br /&gt;
    ; del mask&lt;br /&gt;
    ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) -mask&lt;br /&gt;
    ; check hash table, free hash table&lt;br /&gt;
    [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),0).item == 0) &amp;amp;&amp;amp; ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[hfree]] [[DollarPlus|$+]](ial-update.,[[$cid]]) }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 352 WHO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; 352 &amp;lt;you&amp;gt; &amp;lt;channel&amp;gt; &amp;lt;user&amp;gt; &amp;lt;host&amp;gt; &amp;lt;server&amp;gt; &amp;lt;nick&amp;gt; &amp;lt;flags&amp;gt; :&amp;lt;distance&amp;gt; &amp;lt;realname&amp;gt;&lt;br /&gt;
 raw 352:&amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; *: {&lt;br /&gt;
  ; chan or nick are in the hash table&lt;br /&gt;
  [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[$1|$2]])) || ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[$1|$6]])) {&lt;br /&gt;
    ; check setting, set a var&lt;br /&gt;
    [[If-Then-Else|if]] ($show.who == 1) &amp;amp;&amp;amp; ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[$1|$2]])) &amp;amp;&amp;amp; ([[$comchan]]([[$1|$6]],0)) { ![[Local_Variables|var]] %x = [[$comchan]]([[$1|$6]],0)&lt;br /&gt;
      ; loop, set a var&lt;br /&gt;
      [[while]] (%x) { ![[Local_Variables|var]] %c = [[$comchan]]([[$1|$6]],%x)&lt;br /&gt;
        ; check has table&lt;br /&gt;
        [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),%c)) {&lt;br /&gt;
          ; * meaning oper isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (* isin [[$1|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),oper) }&lt;br /&gt;
          ; G meaning Gone isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (G isincs [[$1|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),away) }&lt;br /&gt;
          ; d meaning deaf isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (d isincs [[$1|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),deaf) }&lt;br /&gt;
          ; x meaning fake host isin $7, increase&lt;br /&gt;
          [[If-Then-Else|if]] (x isincs [[$1|$7]]) { ![[hinc]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),xhost) }&lt;br /&gt;
        }&lt;br /&gt;
        ![[dec]] %x&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    ; stop mirc from showing this raw&lt;br /&gt;
    ![[haltdef]]&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RAW 315 WHO END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 ; raw 315 &amp;lt;you&amp;gt; &amp;lt;requested&amp;gt; :End of /who list.&lt;br /&gt;
 raw 315:&amp;amp; &amp;amp; end of /WHO list.: {&lt;br /&gt;
  ; check -mask in hash table&lt;br /&gt;
  [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),-mask) == [[$1|$2]]) {&lt;br /&gt;
    ; check setting, set a var&lt;br /&gt;
    [[If-Then-Else|if]] ($show.who == 1) { ![[Local_Variables|var]] %x = [[$numtok]]([[$1|$2]],44)&lt;br /&gt;
      ; loop, we are on the channel, set var&lt;br /&gt;
      [[while]] (%x) { [[If-Then-Else|if]] ([[$me]] ison [[$gettok]]([[$1|$2]],%x,44)) { ![[Local_Variables|var]] %c = [[$gettok]]([[$1|$2]],%x,44)&lt;br /&gt;
          ; oper info&lt;br /&gt;
          ![[Local_Variables|var]] %oper = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),oper)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %oper = %oper / [[$round]]([[$calc]](%oper / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % Oper&lt;br /&gt;
          ; away info&lt;br /&gt;
          ![[Local_Variables|var]] %away = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),away)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %away = %away / [[$round]]([[$calc]](%away / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % Away&lt;br /&gt;
          ; deaf info&lt;br /&gt;
          ![[Local_Variables|var]] %deaf = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),deaf)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %deaf = %deaf / [[$round]]([[$calc]](%deaf / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % deaf&lt;br /&gt;
          ; xhost info&lt;br /&gt;
          ![[Local_Variables|var]] %xhost = [[$iif]]([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]),[[DollarPlus|$+]](%c,[[$chr]](44),xhost)),[[$ifmatch]],0)&lt;br /&gt;
          ![[Local_Variables|var]] %xhost = %xhost / [[$round]]([[$calc]](%xhost / [[$nick_(nick)|$nick(]]%c,0) * 100),1) [[DollarPlus|$+]] % x-host&lt;br /&gt;
          ; echo&lt;br /&gt;
          ![[echo]] -t [[$gettok]]([[$1|$2]],%x,44) * IAL updated ( [[DollarPlus|$+]] %oper ---- %away ---- %deaf ---- %xhost [[DollarPlus|$+]] )&lt;br /&gt;
        }&lt;br /&gt;
        ; remove from hash table&lt;br /&gt;
        ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),oper) | ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),away)&lt;br /&gt;
        ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),deaf) | ![[hdel]] [[DollarPlus|$+]](ial-update.,[[$cid]]) [[DollarPlus|$+]](%c,[[$chr]](44),xhost)&lt;br /&gt;
        ![[dec]] %x&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    ; remove the items from the hash table&lt;br /&gt;
    ial-update.hash [[$1|$2]] -remove&lt;br /&gt;
    ![[haltdef]]&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISCONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;
 on *:disconnect:{ [[If-Then-Else|if]] ([[|$hget]]([[DollarPlus|$+]](ial-update.,[[$cid]]))) { ![[hfree]] [[DollarPlus|$+]](ial-update.,[[$cid]]) } }&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sock&amp;diff=4552</id>
		<title>$sock</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sock&amp;diff=4552"/>
		<updated>2011-02-03T12:27:39Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: wow this page is still very ugly&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;$sock(name,N)&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
This returns information about a socket connection that you created using the socket commands.&lt;br /&gt;
&lt;br /&gt;
Properties:&amp;lt;br /&amp;gt;&lt;br /&gt;
.name is the name you give to a connection to identify it&amp;lt;br /&amp;gt;&lt;br /&gt;
.addr original named address if one was used.&amp;lt;br /&amp;gt;&lt;br /&gt;
.sent and .rcvd return the number of bytes sent and rcvd over that connection so far&amp;lt;br /&amp;gt;&lt;br /&gt;
.sq and .rq return the number of bytes queued in the send and receive buffers respectively&amp;lt;br /&amp;gt;&lt;br /&gt;
.ls and .lr return the number of seconds since the connection last sent and last received info&amp;lt;br /&amp;gt;&lt;br /&gt;
.mark is a user storage area max. 512 bytes (see [[sockmark|/sockmark]])&amp;lt;br /&amp;gt;&lt;br /&gt;
.type returns the socket type, TCP or UDP&amp;lt;br /&amp;gt;&lt;br /&gt;
.saddr and .sport return the source address and port of the last received UDP packet&amp;lt;br /&amp;gt;&lt;br /&gt;
.to returns the number of seconds the socket has been open&amp;lt;br /&amp;gt;&lt;br /&gt;
.wserr returns the last winsock error number that occurred on a socket&amp;lt;br /&amp;gt;&lt;br /&gt;
.wsmsg returns the last winsock error message match the error number&amp;lt;br /&amp;gt;&lt;br /&gt;
.ssl returns $true for an SSL connection&amp;lt;br /&amp;gt;&lt;br /&gt;
.pause returns $true if a socket has been paused&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You can use a wildcard name to quickly reference matching entries. The N parameter is optional, if it isn&#039;t specified it is assumed to be 1.&lt;br /&gt;
&lt;br /&gt;
[[Category:Socket]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sockname&amp;diff=4553</id>
		<title>$sockname</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sockname&amp;diff=4553"/>
		<updated>2011-02-03T12:26:59Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;$sockname is the name given to a connection to identify it. This identifier can be used in events to know which connection an event is related to.&lt;br /&gt;
&lt;br /&gt;
[[Category:Socket]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sline&amp;diff=4838</id>
		<title>$sline</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sline&amp;diff=4838"/>
		<updated>2011-02-03T08:43:54Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the selected line in a [[:Category:Custom Windows|window]] listbox.&lt;br /&gt;
&lt;br /&gt;
 $sline(@window, line)[.ln]&lt;br /&gt;
&lt;br /&gt;
* @window is the custom window with a listbox to look in. The window MUST have a listbox.&lt;br /&gt;
* Line is the line number to retrieve. In other words, the Nth selected line.&lt;br /&gt;
* Returns: The Nth selected line in @Window&lt;br /&gt;
** If the .ln property is specified, it will return the line number in the window that the Nth selected line is on.&lt;br /&gt;
** If N=0, returns the total number of selected lines.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
 There are $sline(@mywindow,0) lines selected in @mywindow.&lt;br /&gt;
&lt;br /&gt;
 The 5th selected line is: $sline(@mywindow,5)&lt;br /&gt;
&lt;br /&gt;
This is re-invinting the wheel to demonstrate .ln&lt;br /&gt;
&lt;br /&gt;
 The 5th selected line is: [[$line]](@mywindow,$sline(@window,5).ln)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[window]] [[$window]] [[$line]] [[$fline]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Custom Windows]]&lt;br /&gt;
[[Category:Window Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$line&amp;diff=4820</id>
		<title>$line</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$line&amp;diff=4820"/>
		<updated>2011-02-03T08:43:45Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Line is used to get information on a line of text in an mIRC [[:Category:Custom Windows|window]]. Note this works for channel windows as well as [[:Category:Custom Windows|custom windows]].&lt;br /&gt;
&lt;br /&gt;
 $line(window, line[, T])[.state|.color]&lt;br /&gt;
&lt;br /&gt;
* Window is the mIRC [[Custom Windows|window]] to check.&lt;br /&gt;
* Line is the line number to check. 0 will return the number of lines in the window.&lt;br /&gt;
* T is an optional flag to specify which location.&lt;br /&gt;
** 0 means the display area, 1 means the listbox.&lt;br /&gt;
* The .state property returns [[$true]] or [[$false]] based on whether or not the line is selected.&lt;br /&gt;
* The .color property returns the line&#039;s color.&lt;br /&gt;
* No property returns the string at this line, [[$null]], or the number of lines (if line = 0).&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
 [[If-Then-Else|if]] ($line(@mywindow,5,1).state) { [[echo]] -atg Line 5 is selected. }&lt;br /&gt;
&lt;br /&gt;
 [[If-Then-Else|if]] ($line(@window,5) == The end is near) { [[echo]] -atg Apparently the end is near. }&lt;br /&gt;
&lt;br /&gt;
 [[If-Then-Else|if]] ($line(@window,5).color == 1) { [[echo]] -atg Line 5 is in black. }&lt;br /&gt;
&lt;br /&gt;
[[Category:Custom Windows]]&lt;br /&gt;
[[Category:Window Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$fline&amp;diff=4805</id>
		<title>$fline</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$fline&amp;diff=4805"/>
		<updated>2011-02-03T08:43:39Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the number of the line in a [[Custom_Windows|custom window]] that matches the specified wildtext or regular expression.&lt;br /&gt;
&lt;br /&gt;
 $fline(@name,wildtext|regexp [,N][,T])&lt;br /&gt;
&lt;br /&gt;
* The first parameter is the name of the window.&lt;br /&gt;
* The second parameter is the wildcard string to attempt to match a line against.&lt;br /&gt;
* N is the line number to start your search from. It is optional, and will default to 1 (the entire window).&lt;br /&gt;
* T is an optional flag that specifies the location of the search in the window.&lt;br /&gt;
** 1 indicates to reference the listbox.&lt;br /&gt;
** 2 indicates that a regular expression was specified.&lt;br /&gt;
** 3 indicates both (to reference the listbox, and use a regular expression)&lt;br /&gt;
&lt;br /&gt;
[[Category:Custom Windows]]&lt;br /&gt;
[[Category:Window Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$tip&amp;diff=4762</id>
		<title>$tip</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$tip&amp;diff=4762"/>
		<updated>2011-02-03T08:42:20Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The $tip() identifer allows you to create scripted tips that are independent of normal tip events.&lt;br /&gt;
 $tip(name,title,text,[delay,iconfn,iconpos,alias,wid])&lt;br /&gt;
 ; Returns Nth position of tip if it was successfully created, zero if not.&lt;br /&gt;
&lt;br /&gt;
 $tip(name/N)&lt;br /&gt;
 ; Returns properties for the specified tip.&lt;br /&gt;
&lt;br /&gt;
== Parameters and properties ==&lt;br /&gt;
* name - name of the tip&lt;br /&gt;
* title - title&lt;br /&gt;
* text - text&lt;br /&gt;
* delay - from 3 to 60 seconds&lt;br /&gt;
* iconfn - icon filename&lt;br /&gt;
* iconpos - icon position in filename&lt;br /&gt;
* alias - alias to perform when tip is double-clicked&lt;br /&gt;
* wid - id of window to which tip belongs&lt;br /&gt;
&lt;br /&gt;
[[Category:Tips]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$width&amp;diff=4645</id>
		<title>$width</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$width&amp;diff=4645"/>
		<updated>2011-02-03T08:41:10Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns width of text in pixels for the specified font.&lt;br /&gt;
 $width(text,font,size,B,C)&lt;br /&gt;
&lt;br /&gt;
If B is non-zero, the font is bold, if C is non-zero, control codes are processed. Both B and C are optional.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; If you use a negative number for the font size, it will match the size of fonts in the font dialog.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 $width(Lorem ispum,Arial,12)&lt;br /&gt;
Returns 74.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[$wrap]]&lt;br /&gt;
* [[font|/font]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Picture Windows]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$getdot&amp;diff=4732</id>
		<title>$getdot</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$getdot&amp;diff=4732"/>
		<updated>2011-02-03T08:40:46Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the RGB color value of the dot at the specified position.&lt;br /&gt;
 $getdot(@,x,y)&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 $getdot(@picwin,50,10)&lt;br /&gt;
Returns the RGB color value of the dot in @picwin at (50,10)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[drawdot|/drawdot]] - Draws a dot on a picture window.&lt;br /&gt;
* [[$rgb]] - Returns an RGB color value.&lt;br /&gt;
&lt;br /&gt;
[[Category:Picture Windows]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$abook&amp;diff=4176</id>
		<title>$abook</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$abook&amp;diff=4176"/>
		<updated>2011-02-02T23:19:58Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns informations about users, stored in [[MIRC|mIRC]]s internal [[Address book|address book]].&lt;br /&gt;
&lt;br /&gt;
 $abook(nick,N)&lt;br /&gt;
&lt;br /&gt;
* If both &#039;&#039;nick&#039;&#039; and &#039;&#039;N&#039;&#039; is supplied mIRC will think nick is supplied in wildcarded form. Thus returning the Nth entry in the address book.&lt;br /&gt;
* If only &#039;&#039;N&#039;&#039; is used it will return the Nth entry. If &#039;&#039;N&#039;&#039; is 0 it will return the number of entries in the address book.&lt;br /&gt;
* If only a &#039;&#039;nick&#039;&#039; is used it will return info about that nick.&lt;br /&gt;
&lt;br /&gt;
Properties:&lt;br /&gt;
* &#039;&#039;nick&#039;&#039; will return the nick associated with an entry.&lt;br /&gt;
* &#039;&#039;info&#039;&#039; will return the name field stored with a nick.&lt;br /&gt;
* &#039;&#039;email&#039;&#039; will return the email address associated with nick.&lt;br /&gt;
* &#039;&#039;website&#039;&#039; will return the website supplied with nick.&lt;br /&gt;
* &#039;&#039;picture&#039;&#039; will return the full path to the picture you have assigned the user.&lt;br /&gt;
* &#039;&#039;noteN&#039;&#039; will return the Nth note assigned to that users entry. N being a number.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
We have added [[Dana]] to our address book. And can thus use the following:&lt;br /&gt;
&lt;br /&gt;
 //[[Echo|echo]] -a $abook(Dana).info  ;will return &#039;&#039;DDB v5 - #help.script servicebot by cmouse&amp;amp;k0sm0s&#039;&#039;&lt;br /&gt;
 //echo -a $abook(Dana).website  ;will return &#039;&#039;http://script.quakenet.org/&#039;&#039;&lt;br /&gt;
 //echo -a $abook(Dana).note2  ;will return &#039;&#039;the second note saved with her&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 //echo -a $abook(1).nick  ;will return &#039;&#039;Dana&#039;&#039; if she is number 1 and/or the only one in the address book.&lt;br /&gt;
 //echo -a $abook(Dan*,1).nick  ;will return &#039;&#039;Dana&#039;&#039; since that is the first address book entry matching the given wildcard.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Address Book]] for more information about the address book in general.&amp;lt;br \&amp;gt;&lt;br /&gt;
* [[Abook]] for details on how to add people to the address book through commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Remote Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$dlevel&amp;diff=4801</id>
		<title>$dlevel</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$dlevel&amp;diff=4801"/>
		<updated>2011-02-02T23:19:49Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the default [[Userlist|user level]].&lt;br /&gt;
 $dlevel&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Remote Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$level&amp;diff=4365</id>
		<title>$level</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$level&amp;diff=4365"/>
		<updated>2011-02-02T23:19:43Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Finds a matching address in the remote users list and returns its corresponding levels list.&lt;br /&gt;
 $level(nick|address)&lt;br /&gt;
&lt;br /&gt;
The levels will be returned as comma seperated list. If it is no general access level, a &amp;quot;=&amp;quot; will be infront of the level. &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
 [[auser]] 1,2,3 Dana&lt;br /&gt;
 [[echo]] -a $level(Dana)&lt;br /&gt;
This example would at first add Dana to your userlist and then echo its levels. The result would be &amp;quot;1,=2,=3&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Guser|/guser]] to add a user by his address.&lt;br /&gt;
* [[Ruser|/ruser]] to remove users from your user list.&lt;br /&gt;
* [[$ulevel]] to get the userlevel that was matched for the currectly triggered event.&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Remote Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$ulevel&amp;diff=4518</id>
		<title>$ulevel</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$ulevel&amp;diff=4518"/>
		<updated>2011-02-02T23:19:36Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the user level that was matched for the currently triggered event.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Access Levels]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Remote Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$ulist&amp;diff=4373</id>
		<title>$ulist</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$ulist&amp;diff=4373"/>
		<updated>2011-02-02T23:19:29Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the Nth address in the Users list that matches the specified address and level.&lt;br /&gt;
&lt;br /&gt;
 $ulist(nick!userid@address,L,N)&lt;br /&gt;
&lt;br /&gt;
* Properties: info&lt;br /&gt;
&lt;br /&gt;
You can specify a [[wildcard]] address or a * to match any address in the user list. If you don&#039;t specify a full address, it completes the address with wildcards. If you don&#039;t specify &#039;&#039;N&#039;&#039;, the first matching address is returned.&lt;br /&gt;
&lt;br /&gt;
If you specify &#039;&#039;L&#039;&#039;, only matching addresses that contain the specified level are returned.&lt;br /&gt;
&lt;br /&gt;
Using the &#039;info&#039; property it will return the info-line for the matched userlist entry.&lt;br /&gt;
&lt;br /&gt;
* Note: &#039;&#039;L&#039;&#039; and &#039;&#039;N&#039;&#039; are optional, but if you specify &#039;&#039;L&#039;&#039;, you must specify &#039;&#039;N&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following example will loop through the userlist and print/echo each entry.&lt;br /&gt;
&lt;br /&gt;
 [[var]] %x = 1&lt;br /&gt;
 [[While loops|while]] (%x &amp;lt; $ulist(*!*@*,0)) {&lt;br /&gt;
   [[echo]] -a * %x [[DollarPlus|$+]] ) Mask: $ulist(*!*@*,%x) Level: [[$level]]($ulist(*!*@*,%x)) Info: [[$iif]]($ulist(*!*@*,%x).info,[[$v1]],none)&lt;br /&gt;
   [[inc]] %x&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Access Levels]] for more information on mIRCs internal userlist.&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Remote Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$ulevel&amp;diff=2818</id>
		<title>$ulevel</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$ulevel&amp;diff=2818"/>
		<updated>2011-02-02T23:19:07Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the user level that was matched for the currently triggered event.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Access Levels]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$level&amp;diff=2819</id>
		<title>$level</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$level&amp;diff=2819"/>
		<updated>2011-02-02T23:18:59Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Finds a matching address in the remote users list and returns its corresponding levels list.&lt;br /&gt;
 $level(nick|address)&lt;br /&gt;
&lt;br /&gt;
The levels will be returned as comma seperated list. If it is no general access level, a &amp;quot;=&amp;quot; will be infront of the level. &lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
 [[auser]] 1,2,3 Dana&lt;br /&gt;
 [[echo]] -a $level(Dana)&lt;br /&gt;
This example would at first add Dana to your userlist and then echo its levels. The result would be &amp;quot;1,=2,=3&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Guser|/guser]] to add a user by his address.&lt;br /&gt;
* [[Ruser|/ruser]] to remove users from your user list.&lt;br /&gt;
* [[$ulevel]] to get the userlevel that was matched for the currectly triggered event.&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$dlevel&amp;diff=2820</id>
		<title>$dlevel</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$dlevel&amp;diff=2820"/>
		<updated>2011-02-02T23:18:54Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the default [[Userlist|user level]].&lt;br /&gt;
 $dlevel&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$abook&amp;diff=2821</id>
		<title>$abook</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$abook&amp;diff=2821"/>
		<updated>2011-02-02T23:18:47Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns informations about users, stored in [[MIRC|mIRC]]s internal [[Address book|address book]].&lt;br /&gt;
&lt;br /&gt;
 $abook(nick,N)&lt;br /&gt;
&lt;br /&gt;
* If both &#039;&#039;nick&#039;&#039; and &#039;&#039;N&#039;&#039; is supplied mIRC will think nick is supplied in wildcarded form. Thus returning the Nth entry in the address book.&lt;br /&gt;
* If only &#039;&#039;N&#039;&#039; is used it will return the Nth entry. If &#039;&#039;N&#039;&#039; is 0 it will return the number of entries in the address book.&lt;br /&gt;
* If only a &#039;&#039;nick&#039;&#039; is used it will return info about that nick.&lt;br /&gt;
&lt;br /&gt;
Properties:&lt;br /&gt;
* &#039;&#039;nick&#039;&#039; will return the nick associated with an entry.&lt;br /&gt;
* &#039;&#039;info&#039;&#039; will return the name field stored with a nick.&lt;br /&gt;
* &#039;&#039;email&#039;&#039; will return the email address associated with nick.&lt;br /&gt;
* &#039;&#039;website&#039;&#039; will return the website supplied with nick.&lt;br /&gt;
* &#039;&#039;picture&#039;&#039; will return the full path to the picture you have assigned the user.&lt;br /&gt;
* &#039;&#039;noteN&#039;&#039; will return the Nth note assigned to that users entry. N being a number.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
We have added [[Dana]] to our address book. And can thus use the following:&lt;br /&gt;
&lt;br /&gt;
 //[[Echo|echo]] -a $abook(Dana).info  ;will return &#039;&#039;DDB v5 - #help.script servicebot by cmouse&amp;amp;k0sm0s&#039;&#039;&lt;br /&gt;
 //echo -a $abook(Dana).website  ;will return &#039;&#039;http://script.quakenet.org/&#039;&#039;&lt;br /&gt;
 //echo -a $abook(Dana).note2  ;will return &#039;&#039;the second note saved with her&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 //echo -a $abook(1).nick  ;will return &#039;&#039;Dana&#039;&#039; if she is number 1 and/or the only one in the address book.&lt;br /&gt;
 //echo -a $abook(Dan*,1).nick  ;will return &#039;&#039;Dana&#039;&#039; since that is the first address book entry matching the given wildcard.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Address Book]] for more information about the address book in general.&amp;lt;br \&amp;gt;&lt;br /&gt;
* [[Abook]] for details on how to add people to the address book through commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Userlist]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$regsubex&amp;diff=4738</id>
		<title>$regsubex</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$regsubex&amp;diff=4738"/>
		<updated>2011-02-02T23:17:14Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Performs a regular expression match, like [[$regex]], and then performs a substitution using subtext.&lt;br /&gt;
 $regsubex([name], text, re, subtext)&lt;br /&gt;
&lt;br /&gt;
Subtext is evaluated during substitution and can be an identifier.&lt;br /&gt;
&lt;br /&gt;
Subtext can also contain special markers where&lt;br /&gt;
* \0 = number of matches&lt;br /&gt;
* \n = match number&lt;br /&gt;
* \t = match text&lt;br /&gt;
* \a = all match items&lt;br /&gt;
* \A = a non-spaced version of \a&lt;br /&gt;
&lt;br /&gt;
Returns text result.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 $regsubex(&amp;amp;lt;p style=&amp;quot;font-size: 18px;&amp;quot;&amp;amp;gt;Example text.&amp;amp;lt;/p&amp;amp;gt;,/&amp;amp;lt;[^&amp;gt;]+&amp;amp;gt;/g,)&lt;br /&gt;
The above regular expression can be used to strip any HTML tags using $regsubex, returning the stripped text.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[$regex]]&lt;br /&gt;
* [[$regsub]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Regular Expression]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$regsub&amp;diff=4541</id>
		<title>$regsub</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$regsub&amp;diff=4541"/>
		<updated>2011-02-02T23:17:06Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;$regsub([name], text, re, subtext, %var)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Performs a regular expression match, like [[$regex|$regex()]], and then performs a substitution using subtext.&amp;lt;br /&amp;gt;&lt;br /&gt;
Returns N, the number of substitutions made, and assigns the result to %var.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 alias testing {&lt;br /&gt;
  var %num_of_matches = $regsub(a dog was eating milk,/dog/g,cat,%new_content)&lt;br /&gt;
  ;%num_of_matches will have a value of 1, since &#039;dog&#039; was mathced once&lt;br /&gt;
  ;%new_content will be &#039;a cat was eating milk&#039;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Regular_Expression]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$regml&amp;diff=4542</id>
		<title>$regml</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$regml&amp;diff=4542"/>
		<updated>2011-02-02T23:17:01Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;$regml([name], N)&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Properties: pos&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This can be used to reference the back referenced (items enclosed in parentheses) values returned by a call to [[$regex|$regex()]] or [[$regsub|$regsub()]].&lt;br /&gt;
&lt;br /&gt;
If N = 0, returns total number of match strings.&amp;lt;br /&amp;gt;&lt;br /&gt;
The pos property returns a strings position in the original match text.&lt;br /&gt;
&lt;br /&gt;
[[Category:Regular_Expression]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$regex&amp;diff=4538</id>
		<title>$regex</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$regex&amp;diff=4538"/>
		<updated>2011-02-02T23:16:55Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;$regex([name], text, re)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Returns N, the number of strings in text that matched the regular expression.&amp;lt;br /&amp;gt;&lt;br /&gt;
You can assign a name to a $regex() call which you can use later in [[$regml|$regml()]] to reference a match list.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you don&#039;t specify a name, all identifiers use a default name which is overwritten with each call to $regex().&amp;lt;br /&amp;gt;&lt;br /&gt;
$regex() remembers the results for the last ten $regex() calls. Each time you do a match with $regex(), and you specify a name, that name&#039;s previous results are overwritten with the new results.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 $regex(a cat walked by the dog,/cat|dog/g)&lt;br /&gt;
 ;&#039;cat&#039; and &#039;dog&#039; are matched, returns 2&lt;br /&gt;
[[Category:Regular_Expression]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$activecid&amp;diff=4453</id>
		<title>$activecid</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$activecid&amp;diff=4453"/>
		<updated>2011-02-02T23:16:20Z</updated>

		<summary type="html">&lt;p&gt;Vliedel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the connection id of the currently active window.&lt;br /&gt;
 $activecid&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[$lactivecid]] to get the connection of the last active window.&lt;br /&gt;
* [[On_active|On active event]] to react on windows changes.&lt;br /&gt;
&lt;br /&gt;
[[Category:Multi-server]]&lt;br /&gt;
[[Category:Identifiers]]&lt;/div&gt;</summary>
		<author><name>Vliedel</name></author>
	</entry>
</feed>