<?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=NaNg</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=NaNg"/>
	<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/Special:Contributions/NaNg"/>
	<updated>2026-04-03T14:14:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=6164</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=6164"/>
		<updated>2015-07-18T13:17:32Z</updated>

		<summary type="html">&lt;p&gt;NaNg: version link.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.2&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:TEXT:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.ExecuteInput {&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[ChallengeAuth]] (the new script working on versions 7.42 or higher).&lt;br /&gt;
* [[Joining channels after hiding your address]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=ChallengeAuth&amp;diff=6163</id>
		<title>ChallengeAuth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=ChallengeAuth&amp;diff=6163"/>
		<updated>2015-07-18T13:16:58Z</updated>

		<summary type="html">&lt;p&gt;NaNg: old script reference.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 2.0&lt;br /&gt;
 ; Written and tested on mIRC 7.42&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on $hmac and $sha256 which are available from mIRC v7.42.&lt;br /&gt;
 ;   * No addon dll needed for mIRC on tested version.&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha256]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha256]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User [[$hmac]]([[$1-|$1]], %ChallengeAuth.Pass, sha256) HMAC-SHA-256&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:TEXT:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.ExecuteInput {&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-256, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-256 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Challenge auth]] (the old script, works on versions older than v7.42)&lt;br /&gt;
* [[Joining channels after hiding your address]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$hmac&amp;diff=6162</id>
		<title>$hmac</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$hmac&amp;diff=6162"/>
		<updated>2015-07-18T13:13:29Z</updated>

		<summary type="html">&lt;p&gt;NaNg: new $hmac identifier.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns HMAC hash value for the specified data using the given key, where hash can be md5, sha1 (default), sha256, sha384 or sha512 and N = 0 for plain text (default), 1 for &amp;amp;binvar, 2 for filename.&lt;br /&gt;
 $hmac(text|&amp;amp;binvar|filename,key,hash,[N])&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 $hmac(text string, hmackey, sha256)&lt;br /&gt;
Returns the HMAC-SHA-256 hash value of &#039;&#039;text string&#039;&#039; with key &#039;&#039;hmackey&#039;&#039; (19df3338494ee69e5a1648f9456677355878af1ffed0f74a6fc0effee8551089)&lt;br /&gt;
&lt;br /&gt;
 //bset -t &amp;amp;bvar 1 text string | echo -ag $hmac(&amp;amp;bvar,hmackey,sha256,1)&lt;br /&gt;
Echoes the same as the last value, this time using a binary variable.&lt;br /&gt;
&lt;br /&gt;
 $hmac(mirc.ini,hmackey,sha1,2)&lt;br /&gt;
Returns the HMAC-SHA-1 hash value of the file &#039;&#039;mirc.ini&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[$md5]]&lt;br /&gt;
* [[$sha1]]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Hash-based_message_authentication_code HMAC on wikipedia]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sha512&amp;diff=6161</id>
		<title>$sha512</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sha512&amp;diff=6161"/>
		<updated>2015-07-18T13:08:03Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Redirected page to $sha1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[$sha1]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sha384&amp;diff=6160</id>
		<title>$sha384</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sha384&amp;diff=6160"/>
		<updated>2015-07-18T13:07:48Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Redirected page to $sha1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[$sha1]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sha256&amp;diff=6159</id>
		<title>$sha256</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sha256&amp;diff=6159"/>
		<updated>2015-07-18T13:07:33Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Redirected page to $sha1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[$sha1]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sha1&amp;diff=6158</id>
		<title>$sha1</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sha1&amp;diff=6158"/>
		<updated>2015-07-18T13:06:27Z</updated>

		<summary type="html">&lt;p&gt;NaNg: add examples.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns SHA-1 hash value for the specified data, where N = 0 for plain text (default), 1 for &amp;amp;binvar, 2 for filename.&lt;br /&gt;
 $sha1(text|&amp;amp;binvar|filename,[N])&lt;br /&gt;
&lt;br /&gt;
Also available are $sha256, $sha384 and $sha512 with the same format for SHA-256, SHA-384 and SHA-512.&lt;br /&gt;
 $sha256(text|&amp;amp;binvar|filename,[N])&lt;br /&gt;
 $sha384(text|&amp;amp;binvar|filename,[N])&lt;br /&gt;
 $sha512(text|&amp;amp;binvar|filename,[N])&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 $sha1(text string)&lt;br /&gt;
Returns the SHA-1 hash value of &#039;&#039;text string&#039;&#039; (384270d144eede06a0254452cc26d06f2b0005d6)&lt;br /&gt;
&lt;br /&gt;
 //bset -t &amp;amp;bvar 1 text string | echo -ag $sha1(&amp;amp;bvar,1)&lt;br /&gt;
Echoes the same as the last value, this time using a binary variable.&lt;br /&gt;
&lt;br /&gt;
 $sha1(mirc.ini,2)&lt;br /&gt;
Returns the SHA-1 hash value of the file &#039;&#039;mirc.ini&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 $sha256(text string)&lt;br /&gt;
Returns the SHA-256 hash value of &#039;&#039;text string&#039;&#039; (f8ddf8b97330b28452da0971b6b78c19fd769378bd26d29d7bf790fbba051710)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[$md5]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Other Identifiers]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$sha1&amp;diff=6157</id>
		<title>$sha1</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$sha1&amp;diff=6157"/>
		<updated>2015-07-18T13:06:05Z</updated>

		<summary type="html">&lt;p&gt;NaNg: add other hashes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns SHA-1 hash value for the specified data, where N = 0 for plain text (default), 1 for &amp;amp;binvar, 2 for filename.&lt;br /&gt;
 $sha1(text|&amp;amp;binvar|filename,[N])&lt;br /&gt;
&lt;br /&gt;
Also available are $sha256, $sha384 and $sha512 with the same format for SHA-256, SHA-384 and SHA-512.&lt;br /&gt;
 $sha256(text|&amp;amp;binvar|filename,[N])&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 $sha1(text string)&lt;br /&gt;
Returns the SHA-1 hash value of &#039;&#039;text string&#039;&#039; (384270d144eede06a0254452cc26d06f2b0005d6)&lt;br /&gt;
&lt;br /&gt;
 //bset -t &amp;amp;bvar 1 text string | echo -ag $sha1(&amp;amp;bvar,1)&lt;br /&gt;
Echoes the same as the last value, this time using a binary variable.&lt;br /&gt;
&lt;br /&gt;
 $sha1(mirc.ini,2)&lt;br /&gt;
Returns the SHA-1 hash value of the file &#039;&#039;mirc.ini&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 $sha256(text string)&lt;br /&gt;
Returns the SHA-256 hash value of &#039;&#039;text string&#039;&#039; (f8ddf8b97330b28452da0971b6b78c19fd769378bd26d29d7bf790fbba051710)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[$md5]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Other Identifiers]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Wikify&amp;diff=6156</id>
		<title>Wikify</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Wikify&amp;diff=6156"/>
		<updated>2015-07-18T13:04:10Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Add new identifiers.&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;
 $hmac                $hmac&lt;br /&gt;
 $hnick               $hnick&lt;br /&gt;
 $hotp                $hotp&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;
 $sha256              $sha256&lt;br /&gt;
 $sha384              $sha1&lt;br /&gt;
 $sha512              $sha512&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;br /&gt;
&lt;br /&gt;
[[Category:Wiki]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=ChallengeAuth&amp;diff=6155</id>
		<title>ChallengeAuth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=ChallengeAuth&amp;diff=6155"/>
		<updated>2015-07-18T13:01:25Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Challenge auth 2.0 script based on mIRC 7.42 new identifiers.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 2.0&lt;br /&gt;
 ; Written and tested on mIRC 7.42&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on $hmac and $sha256 which are available from mIRC v7.42.&lt;br /&gt;
 ;   * No addon dll needed for mIRC on tested version.&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha256]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha256]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User [[$hmac]]([[$1-|$1]], %ChallengeAuth.Pass, sha256) HMAC-SHA-256&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:TEXT:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.ExecuteInput {&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-256, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-256 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Joining channels after hiding your address]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$window_(remote)&amp;diff=6118</id>
		<title>$window (remote)</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$window_(remote)&amp;diff=6118"/>
		<updated>2014-10-09T12:41:29Z</updated>

		<summary type="html">&lt;p&gt;NaNg: special windows.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns information about a window.&lt;br /&gt;
&lt;br /&gt;
 $window(N|window name|@WID)&lt;br /&gt;
* Takes either the position of the window (if N=0, returns the number of windows), the name/wildtext of the window, or the window&#039;s Window ID. If wildtext is specified, a second N property can be specified ($window(wildtext,N))&lt;br /&gt;
* If no property is given, returns the window name or number of windows (For N=0)&lt;br /&gt;
* Special windows use negative numbers as follow:&lt;br /&gt;
** -1 = Desktop&lt;br /&gt;
** -2 = mIRC window&lt;br /&gt;
** -3 = MDI window&lt;br /&gt;
* There are several properties for $window:&lt;br /&gt;
** .x Returns the window&#039;s top left corner X coordinate (Relative to mIRC)&lt;br /&gt;
** .y Returns the window&#039;s top left corner Y coordinate (Relative to mIRC)&lt;br /&gt;
** .w Returns the window&#039;s width in pixels&lt;br /&gt;
** .h Returns the window&#039;s height in pixels&lt;br /&gt;
** .dx Returns the window&#039;s top left corner X coordinate (Relative to the desktop)&lt;br /&gt;
** .dy Returns the window&#039;s top left corner Y coordinate (Relative to the desktop)&lt;br /&gt;
** .dw Returns the window&#039;s text display area&#039;s width.&lt;br /&gt;
** .dh Returns the window&#039;s text display area&#039;s height.&lt;br /&gt;
** .bw Returns the width of the bitmap in a [[:Category:Picture Windows|graphic window]]&lt;br /&gt;
** .bh Returns the height of the bitmap in a [[:Category:Picture Windows|graphic window]]&lt;br /&gt;
** .mdi returns [[$true]] if the window is inside the mdi, in other words, if it is a child window of mIRC or on the desktop.&lt;br /&gt;
** .state returns the windows state: minimized, maximized, hidden or normal&lt;br /&gt;
** .title returns the text in the title of a window. Can be set using [[titlebar]]&lt;br /&gt;
** .font returns the window&#039;s current font name&lt;br /&gt;
** .fontsize returns the window&#039;s current font&#039;s size&lt;br /&gt;
** .fontbold returns [[$true]] if the window&#039;s current font is bold.&lt;br /&gt;
** .fontcs returns the window&#039;s current font&#039;s character set.&lt;br /&gt;
** .logfile returns the full path for the window&#039;s log file, or [[$null]] if there is none.&lt;br /&gt;
** .icon returns on or off, depending on whether or not the window&#039;s icon is visible&lt;br /&gt;
** .ontop returns [[$true]] if this window is set to be always on top.&lt;br /&gt;
** .type Returns the window type, such as &amp;quot;channel&amp;quot; &amp;quot;status&amp;quot; or &amp;quot;custom&amp;quot;&lt;br /&gt;
** .anysc Returns [[$true]] if created with [[window]] -i (Set to be associated with the active server, always).&lt;br /&gt;
** .wid Returns the window ID.&lt;br /&gt;
** .cid Returns the [[:Category:multi-server|connection ID]].&lt;br /&gt;
** .sbtext Returns the text for this window on the switchbar button.&lt;br /&gt;
** .sbcolor Returns the highligt color for this window as shown on the swichbar&lt;br /&gt;
** .sbstate Returns the state for this window on the switchbar&lt;br /&gt;
** .tbstate Returns the state for this window on the treebar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Window Identifiers]][[Category:Custom Windows]][[Category:Remote Identifiers]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_parse_HL_log_data&amp;diff=6023</id>
		<title>How to parse HL log data</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_parse_HL_log_data&amp;diff=6023"/>
		<updated>2013-10-25T14:26:36Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Bad rcon fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; HL Log Listener snippet by NaNg&lt;br /&gt;
 ; Date: 11-06-2011&lt;br /&gt;
 ; Tested on mIRC 7.19&lt;br /&gt;
 ;&lt;br /&gt;
 ; HL Log window for HL log based engines (HL1, Source etc.),&lt;br /&gt;
 ; Based on the HL Log Standard found at http://developer.valvesoftware.com/wiki/HL_Log_Standard&lt;br /&gt;
 ;&lt;br /&gt;
 ; ==================== NOTE! ====================&lt;br /&gt;
 ; This does NOT query the server to start logging, this should be done on your end, by sending&lt;br /&gt;
 ; this command to the server:&lt;br /&gt;
 ;   logaddress_add &amp;lt;listening_ip&amp;gt; &amp;lt;listening_port&amp;gt;&lt;br /&gt;
 ; &amp;lt;listening_port&amp;gt; should be the same in this command as well as in the /hllog command.&lt;br /&gt;
 ;&lt;br /&gt;
 ; This snippet was built based on CS (1.6) logs, therefore only two team colors exist (besides default).&lt;br /&gt;
 ; You can easly add more team colors by adding them to the $hllog.teamcolor alias found here.&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /hllog &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;listening_port&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] hllog {&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]] !isnum 1-65536)) {&lt;br /&gt;
     [[echo]] -ag hllog: 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 HL log window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a log step over another log for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag HL log window for %server.addr is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Open the HL log window whilst activating it, hide the @ prefix and maximize it.&lt;br /&gt;
   window -ak0x @ [[DollarPlus|$+]] %server.addr&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr HL log window, now listening to: %server.addr&lt;br /&gt;
 &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($hllog.prefix, %server.addr)&lt;br /&gt;
 &lt;br /&gt;
   ; Start listening to HL logs from the server.&lt;br /&gt;
   [[sockudp]] -k %sockname [[$1-|$3]] [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Parses the given player.&lt;br /&gt;
 [[alias]] hlplayer {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$regex]]([[$1-|$1-]], /&amp;quot;(.*?)&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;quot;/)) {&lt;br /&gt;
     [[echo]] -ag hlpalyer: Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$prop]] == name) { [[return]] [[$regml]](1) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == id) { [[return]] [[$regml]](2) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == authid) { [[return]] [[$regml]](3) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == team) { [[return]] [[$regml]](4) }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] [[$true]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Gets the given property&#039;s value.&lt;br /&gt;
 [[alias]] -l hllog.prop {&lt;br /&gt;
   ; Number of keys is requested.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$]][[$1-|2]] == 0) {&lt;br /&gt;
     [[return]] [[$regex]]([[$1-|$1]], /\((\S+)(?: &amp;quot;([^&amp;quot;]*)&amp;quot;|())\)/g)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$regex]]([[$1-|$1]], /\(( [[DollarPlus|$+]] [[$1-|$2]] [[DollarPlus|$+]] )(?: &amp;quot;([^&amp;quot;]*)&amp;quot;|())\)/i)) {&lt;br /&gt;
     [[return]] [[$iif]]([[$regml]](2) == [[$null]], [[$true]], [[$ifmatch]])&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] [[$null]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Get the team&#039;s corresponding color.&lt;br /&gt;
 [[alias]] -l hllog.teamcolor {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == CT) { [[return]] 12 }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] == TERRORIST) { [[return]] 04 }&lt;br /&gt;
 &lt;br /&gt;
   ; Default color if team is not recognized.&lt;br /&gt;
   [[return]] 14&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l hllog.prefix { [[return]] hllog }&lt;br /&gt;
 &lt;br /&gt;
 ; If the user has closed the HL log window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[DollarPlus|$+]]($hllog.prefix, [[$remove]]($target, @)))) {&lt;br /&gt;
     [[sockclose]] [[DollarPlus|$+]]($hllog.prefix, [[$remove]]($target, @))&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:UDPREAD:$([[DollarPlus|$+]]($hllog.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %hllog.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $hllog.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 %hllog.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[Sockread|sockread]] -f %hllog.value&lt;br /&gt;
 &lt;br /&gt;
   ; Separate the server log time and the log line itself.&lt;br /&gt;
   [[noop]] [[$regex]](%hllog.value, /L ((?:0[1-9]|1[0-2])/(?:0[1-9]|[12][0-9]|3[01])/[0-9]{4} - (?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]): (.*)[\n\r\0]*$/)&lt;br /&gt;
 &lt;br /&gt;
   ; Invalid log line.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$regml]](0) == 0) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; Get the server log time (usually un-needed. if you do need it - uncomment the next line).&lt;br /&gt;
   ; var %hllog.time = $regml(1)&lt;br /&gt;
   [[Local_Variables|var]] %hllog.cmd = [[$regml]](2)&lt;br /&gt;
 &lt;br /&gt;
   ; If the command is a comment, disregard it.&lt;br /&gt;
   [[If-Then-Else|if]] (//* iswm %hllog.cmd) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; Server cvar change (event 001b).&lt;br /&gt;
   [[If-Then-Else|elseif]] (server cvar* iswm %hllog.cmd) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^Server cvar &amp;quot;([^&amp;quot;]+)&amp;quot; = &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; If the line was succesfully parsed.&lt;br /&gt;
     [[If-Then-Else|if]] ([[$regml]](0) &amp;gt; 0) {&lt;br /&gt;
       [[Local_Variables|var]] %cvar.name = [[$regml]](1)&lt;br /&gt;
       [[Local_Variables|var]] %cvar.value = [[$regml]](2)&lt;br /&gt;
       ; var %hllog.props = $regml(3)&lt;br /&gt;
 &lt;br /&gt;
       [[aline]] 3 %hllog.window Cvar &amp;quot; [[DollarPlus|$+]] %cvar.name [[DollarPlus|$+]] &amp;quot; has been changed, new value: &amp;quot; [[DollarPlus|$+]] %cvar.value [[DollarPlus|$+]] &amp;quot;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Rcon (events 004a and 004b).&lt;br /&gt;
   [[If-Then-Else|elseif]] ((Bad Rcon:* iswm %hllog.cmd) || (Rcon:* iswm %hllog.cmd)) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^((?:Bad )?)Rcon: &amp;quot;[^&amp;quot;]+ ([^&amp;quot;]+) &amp;quot;([^&amp;quot;]+)&amp;quot; (.*)&amp;quot; [^&amp;quot;\x28]+ &amp;quot;([^&amp;quot;]+:[^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; Parse the event&#039;s details.&lt;br /&gt;
     [[Local_Variables|var]] %hllog.badrcon = [[$iif]]([[$regml]](1) == [[$null]], $false, [[$true]])&lt;br /&gt;
     ; var %hllog.challenge = $regml(2)&lt;br /&gt;
     ; var %hllog.rconpwd = $regml(3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.rconcmd = [[$regml]](4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.sender = [[$regml]](5)&lt;br /&gt;
     ; var %hllog.props = $regml(6)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 4 %hllog.window [[$iif]](%hllog.badrcon, Bad) RCON: %hllog.rconcmd (from: %hllog.sender [[DollarPlus|$+]] )&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Player got kicked (event 052b).&lt;br /&gt;
   [[If-Then-Else|elseif]] (Kick:* iswm %hllog.cmd) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^Kick: (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; Parse the event&#039;s details.&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     ; var %hllog.noun = $regml(2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.kicker = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 4 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.player).team), $hlplayer(%hllog.player).name, [[$chr]](15)) was kicked by %hllog.kicker with reason: [[DollarPlus|$+]](&amp;quot;, $hllog.prop(%hllog.props, message), &amp;quot;)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Team score report (event 065).&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Team &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.score = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.numPlayers = [[$regml]](5)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](7)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 3 %hllog.window Team [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), %hllog.team, [[$chr]](15)) scored %hllog.score with %hllog.numPlayers players %hllog.props&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Player score report (event 067).&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Player (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.score = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 3 %hllog.window Player [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.player).team), $hlplayer(%hllog.player).name, [[$chr]](15)) scored %hllog.score %hllog.props&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 057, 058, 059, 066.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) (&amp;quot;[^&amp;quot;]+&amp;quot;)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.firstEvent = [[$regml]](2)&lt;br /&gt;
     ; var %hllog.secondEvent = $regml(4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.firstPlayer = [[$regml]](1)&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.firstEvent == triggered) {&lt;br /&gt;
       [[Local_Variables|var]] %hllog.secondPlayer = [[$regml]](5)&lt;br /&gt;
       [[Local_Variables|var]] %hllog.noun = [[$remove]]([[$regml]](3), &amp;quot;)&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[Local_Variables|var]] %hllog.secondPlayer = [[$regml]](3)&lt;br /&gt;
       [[Local_Variables|var]] %hllog.noun = [[$remove]]([[$regml]](5), &amp;quot;)&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](6)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.firstPlayer).team), $hlplayer(%hllog.firstPlayer).name, [[$chr]](15)) %hllog.firstEvent [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.secondPlayer ).team), $hlplayer(%hllog.secondPlayer ).name, [[$chr]](15)) with: [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) [[$iif]]($hllog.prop(%hllog.props, headshot), (headshot))&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 050, 053, 054, 055, 056, 060, 063a, 063b, 068, 069.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = $hlplayer(%hllog.player).team&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.event == say) {&lt;br /&gt;
       [[aline]] 7 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) [[DollarPlus|$+]](says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] (%hllog.event == say_team) {&lt;br /&gt;
       [[aline]] 7 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) [[DollarPlus|$+]](team says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) %hllog.props&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 050b, 051, 052.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^\x28]+)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     ; var %hllog.props = $regml(3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = $hlplayer(%hllog.player).team&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) %hllog.event&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 061, 064.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Team &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](3)&lt;br /&gt;
     ; var %hllog.props = $regml(4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), %hllog.team, [[$chr]](15)) %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 062, 003a, 003b, 005, 006.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](3)&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.event == server say) {&lt;br /&gt;
       [[aline]] 7 %hllog.window Server [[DollarPlus|$+]](says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[aline]] 1 %hllog.window %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) %hllog.props&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 001a, 001c, 002a, 002b.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^([^&amp;quot;\x28]+)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](1)&lt;br /&gt;
     ; var %hllog.props = $regml(2)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window %hllog.event&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
* [[How to RCON an HL1 engine based server]]&lt;br /&gt;
* [[How to RCON a source engine based server]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/HL_Log_Standard HL Log Standard on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_parse_HL_log_data&amp;diff=6022</id>
		<title>How to parse HL log data</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_parse_HL_log_data&amp;diff=6022"/>
		<updated>2013-10-25T13:49:55Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Fixed log parse&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; HL Log Listener snippet by NaNg&lt;br /&gt;
 ; Date: 11-06-2011&lt;br /&gt;
 ; Tested on mIRC 7.19&lt;br /&gt;
 ;&lt;br /&gt;
 ; HL Log window for HL log based engines (HL1, Source etc.),&lt;br /&gt;
 ; Based on the HL Log Standard found at http://developer.valvesoftware.com/wiki/HL_Log_Standard&lt;br /&gt;
 ;&lt;br /&gt;
 ; ==================== NOTE! ====================&lt;br /&gt;
 ; This does NOT query the server to start logging, this should be done on your end, by sending&lt;br /&gt;
 ; this command to the server:&lt;br /&gt;
 ;   logaddress_add &amp;lt;listening_ip&amp;gt; &amp;lt;listening_port&amp;gt;&lt;br /&gt;
 ; &amp;lt;listening_port&amp;gt; should be the same in this command as well as in the /hllog command.&lt;br /&gt;
 ;&lt;br /&gt;
 ; This snippet was built based on CS (1.6) logs, therefore only two team colors exist (besides default).&lt;br /&gt;
 ; You can easly add more team colors by adding them to the $hllog.teamcolor alias found here.&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /hllog &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;listening_port&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] hllog {&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]] !isnum 1-65536)) {&lt;br /&gt;
     [[echo]] -ag hllog: 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 HL log window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a log step over another log for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag HL log window for %server.addr is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Open the HL log window whilst activating it, hide the @ prefix and maximize it.&lt;br /&gt;
   window -ak0x @ [[DollarPlus|$+]] %server.addr&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr HL log window, now listening to: %server.addr&lt;br /&gt;
 &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($hllog.prefix, %server.addr)&lt;br /&gt;
 &lt;br /&gt;
   ; Start listening to HL logs from the server.&lt;br /&gt;
   [[sockudp]] -k %sockname [[$1-|$3]] [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Parses the given player.&lt;br /&gt;
 [[alias]] hlplayer {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$regex]]([[$1-|$1-]], /&amp;quot;(.*?)&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;quot;/)) {&lt;br /&gt;
     [[echo]] -ag hlpalyer: Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$prop]] == name) { [[return]] [[$regml]](1) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == id) { [[return]] [[$regml]](2) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == authid) { [[return]] [[$regml]](3) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == team) { [[return]] [[$regml]](4) }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] [[$true]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Gets the given property&#039;s value.&lt;br /&gt;
 [[alias]] -l hllog.prop {&lt;br /&gt;
   ; Number of keys is requested.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$]][[$1-|2]] == 0) {&lt;br /&gt;
     [[return]] [[$regex]]([[$1-|$1]], /\((\S+)(?: &amp;quot;([^&amp;quot;]*)&amp;quot;|())\)/g)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$regex]]([[$1-|$1]], /\(( [[DollarPlus|$+]] [[$1-|$2]] [[DollarPlus|$+]] )(?: &amp;quot;([^&amp;quot;]*)&amp;quot;|())\)/i)) {&lt;br /&gt;
     [[return]] [[$iif]]([[$regml]](2) == [[$null]], [[$true]], [[$ifmatch]])&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] [[$null]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Get the team&#039;s corresponding color.&lt;br /&gt;
 [[alias]] -l hllog.teamcolor {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == CT) { [[return]] 12 }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] == TERRORIST) { [[return]] 04 }&lt;br /&gt;
 &lt;br /&gt;
   ; Default color if team is not recognized.&lt;br /&gt;
   [[return]] 14&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l hllog.prefix { [[return]] hllog }&lt;br /&gt;
 &lt;br /&gt;
 ; If the user has closed the HL log window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[DollarPlus|$+]]($hllog.prefix, [[$remove]]($target, @)))) {&lt;br /&gt;
     [[sockclose]] [[DollarPlus|$+]]($hllog.prefix, [[$remove]]($target, @))&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:UDPREAD:$([[DollarPlus|$+]]($hllog.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %hllog.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $hllog.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 %hllog.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[Sockread|sockread]] -f %hllog.value&lt;br /&gt;
 &lt;br /&gt;
   ; Separate the server log time and the log line itself.&lt;br /&gt;
   [[noop]] [[$regex]](%hllog.value, /L ((?:0[1-9]|1[0-2])/(?:0[1-9]|[12][0-9]|3[01])/[0-9]{4} - (?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]): (.*)[\n\r\0]*$/)&lt;br /&gt;
 &lt;br /&gt;
   ; Invalid log line.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$regml]](0) == 0) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; Get the server log time (usually un-needed. if you do need it - uncomment the next line).&lt;br /&gt;
   ; var %hllog.time = $regml(1)&lt;br /&gt;
   [[Local_Variables|var]] %hllog.cmd = [[$regml]](2)&lt;br /&gt;
 &lt;br /&gt;
   ; If the command is a comment, disregard it.&lt;br /&gt;
   [[If-Then-Else|if]] (//* iswm %hllog.cmd) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; Server cvar change (event 001b).&lt;br /&gt;
   [[If-Then-Else|elseif]] (server cvar* iswm %hllog.cmd) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^Server cvar &amp;quot;([^&amp;quot;]+)&amp;quot; = &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; If the line was succesfully parsed.&lt;br /&gt;
     [[If-Then-Else|if]] ([[$regml]](0) &amp;gt; 0) {&lt;br /&gt;
       [[Local_Variables|var]] %cvar.name = [[$regml]](1)&lt;br /&gt;
       [[Local_Variables|var]] %cvar.value = [[$regml]](2)&lt;br /&gt;
       ; var %hllog.props = $regml(3)&lt;br /&gt;
 &lt;br /&gt;
       [[aline]] 3 %hllog.window Cvar &amp;quot; [[DollarPlus|$+]] %cvar.name [[DollarPlus|$+]] &amp;quot; has been changed, new value: &amp;quot; [[DollarPlus|$+]] %cvar.value [[DollarPlus|$+]] &amp;quot;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Rcon (events 004a and 004b).&lt;br /&gt;
   [[If-Then-Else|elseif]] ((Bad Rcon:* iswm %hllog.cmd) || (Rcon:* iswm %hllog.cmd)) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^(Bad )?Rcon: &amp;quot;[^&amp;quot;]+ ([^&amp;quot;]+) &amp;quot;([^&amp;quot;]+)&amp;quot; (.*)&amp;quot; [^&amp;quot;\x28]+ &amp;quot;([^&amp;quot;]+:[^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; Parse the event&#039;s details.&lt;br /&gt;
     [[Local_Variables|var]] %hllog.badrcon = [[$iif]]([[$regml]](1) == [[$null]], $false, [[$true]])&lt;br /&gt;
     ; var %hllog.challenge = $regml(2)&lt;br /&gt;
     ; var %hllog.rconpwd = $regml(3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.rconcmd = [[$regml]](4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.sender = [[$regml]](5)&lt;br /&gt;
     ; var %hllog.props = $regml(6)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 4 %hllog.window [[$iif]](%hllog.badrcon, Bad) RCON: %hllog.rconcmd (from: %hllog.sender [[DollarPlus|$+]] )&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Player got kicked (event 052b).&lt;br /&gt;
   [[If-Then-Else|elseif]] (Kick:* iswm %hllog.cmd) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^Kick: (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; Parse the event&#039;s details.&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     ; var %hllog.noun = $regml(2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.kicker = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 4 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.player).team), $hlplayer(%hllog.player).name, [[$chr]](15)) was kicked by %hllog.kicker with reason: [[DollarPlus|$+]](&amp;quot;, $hllog.prop(%hllog.props, message), &amp;quot;)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Team score report (event 065).&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Team &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.score = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.numPlayers = [[$regml]](5)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](7)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 3 %hllog.window Team [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), %hllog.team, [[$chr]](15)) scored %hllog.score with %hllog.numPlayers players %hllog.props&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Player score report (event 067).&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Player (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.score = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 3 %hllog.window Player [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.player).team), $hlplayer(%hllog.player).name, [[$chr]](15)) scored %hllog.score %hllog.props&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 057, 058, 059, 066.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) (&amp;quot;[^&amp;quot;]+&amp;quot;)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.firstEvent = [[$regml]](2)&lt;br /&gt;
     ; var %hllog.secondEvent = $regml(4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.firstPlayer = [[$regml]](1)&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.firstEvent == triggered) {&lt;br /&gt;
       [[Local_Variables|var]] %hllog.secondPlayer = [[$regml]](5)&lt;br /&gt;
       [[Local_Variables|var]] %hllog.noun = [[$remove]]([[$regml]](3), &amp;quot;)&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[Local_Variables|var]] %hllog.secondPlayer = [[$regml]](3)&lt;br /&gt;
       [[Local_Variables|var]] %hllog.noun = [[$remove]]([[$regml]](5), &amp;quot;)&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](6)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.firstPlayer).team), $hlplayer(%hllog.firstPlayer).name, [[$chr]](15)) %hllog.firstEvent [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.secondPlayer ).team), $hlplayer(%hllog.secondPlayer ).name, [[$chr]](15)) with: [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) [[$iif]]($hllog.prop(%hllog.props, headshot), (headshot))&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 050, 053, 054, 055, 056, 060, 063a, 063b, 068, 069.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = $hlplayer(%hllog.player).team&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.event == say) {&lt;br /&gt;
       [[aline]] 7 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) [[DollarPlus|$+]](says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] (%hllog.event == say_team) {&lt;br /&gt;
       [[aline]] 7 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) [[DollarPlus|$+]](team says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) %hllog.props&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 050b, 051, 052.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^\x28]+)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     ; var %hllog.props = $regml(3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = $hlplayer(%hllog.player).team&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) %hllog.event&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 061, 064.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Team &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](3)&lt;br /&gt;
     ; var %hllog.props = $regml(4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), %hllog.team, [[$chr]](15)) %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 062, 003a, 003b, 005, 006.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](3)&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.event == server say) {&lt;br /&gt;
       [[aline]] 7 %hllog.window Server [[DollarPlus|$+]](says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[aline]] 1 %hllog.window %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) %hllog.props&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 001a, 001c, 002a, 002b.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^([^&amp;quot;\x28]+)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](1)&lt;br /&gt;
     ; var %hllog.props = $regml(2)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window %hllog.event&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
* [[How to RCON an HL1 engine based server]]&lt;br /&gt;
* [[How to RCON a source engine based server]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/HL_Log_Standard HL Log Standard on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Silence&amp;diff=6020</id>
		<title>Silence</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Silence&amp;diff=6020"/>
		<updated>2013-09-08T18:08:48Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Added info according to https://www.quakenet.org/news/227-ircd-upgrade&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Adds or removes an address from your silence list.&lt;br /&gt;
 /silence [[+|-]&amp;lt;mask&amp;gt;|&amp;lt;nick&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
This command silences/unsilences the specified nick/mask. The silence works server side, unlike [[ignore]] you won&#039;t receive the messages. The number of silences you can set is given on connect by [[Raw_005|raw 005]]. On Quakenet the silence list is normally limited to 15. &#039;&#039;&#039;Note&#039;&#039;&#039; that all entries of your silence list are deleted if you disconnect.&lt;br /&gt;
&lt;br /&gt;
Results are replied with a [[:Category:Raw_silence|raw]].&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
 /silence&lt;br /&gt;
Shows your silence list.&lt;br /&gt;
 /silence *!*@*moo &lt;br /&gt;
This would silence every user with a mask matching *!*@*moo.&lt;br /&gt;
 /silence +fishbot &lt;br /&gt;
This would silence the nick fishbot.&lt;br /&gt;
 /silence -fishbot &lt;br /&gt;
This removes silence of the nick fishbot if its in your silence list.&lt;br /&gt;
 /silence +fishbot,-snailbot&lt;br /&gt;
This would silence the nick fishbot and removes silence of the nick snailbot from your silence list.&lt;br /&gt;
 /silence +~fishbot!*@*&lt;br /&gt;
This excludes fishbot from the silence list.&lt;br /&gt;
 /silence -* &lt;br /&gt;
Removes all silences&lt;br /&gt;
 /silence +!@12.34.56.78/24&lt;br /&gt;
Silence also supports CIDRs which are /16 and higher.&lt;br /&gt;
 /silence +!@authname.users.quakenet.org&lt;br /&gt;
This would add a silence to all users authed as &amp;quot;authname&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Raw_silence]][[Category:Basic IRC commands]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5785</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5785"/>
		<updated>2013-04-18T14:31:16Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Added a &amp;quot;see also&amp;quot; for hiding your address before joining channels&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.2&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:TEXT:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.ExecuteInput {&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Joining channels after hiding your address]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$ini&amp;diff=5784</id>
		<title>$ini</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$ini&amp;diff=5784"/>
		<updated>2013-01-25T18:35:39Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Thank bindi for noticing and testing :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns the name/Nth position of the specified topic/item in an ini/text file.&lt;br /&gt;
 $ini(file,topic/N,item/N)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that the item/N parameter is optional. If you specify  N = 0, it returns the total number of topics/items.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
 [[echo]] -a $ini(mirc.ini,0)&lt;br /&gt;
Echos the total number of topics in your mirc.ini.&lt;br /&gt;
 echo -a $ini(mirc.ini,mirc,0)&lt;br /&gt;
Echos the total number of items in the topic mirc in your mirc.ini&lt;br /&gt;
 &lt;br /&gt;
The following, more complex example shows howto loop through an entire ini file.&lt;br /&gt;
 ; We want to have an alias called &#039;&#039;showini&#039;&#039;. At the end, it will be /showini &amp;lt;inifile&amp;gt;&lt;br /&gt;
 [[alias]] showini {&lt;br /&gt;
  ; echos ini name&lt;br /&gt;
  echo -a $1&lt;br /&gt;
  [[var]] %i = 1&lt;br /&gt;
  ; We begin to loop through all topics. $ini($1,0) returns the total number of topics&lt;br /&gt;
  [[while]] (%i &amp;lt;= $ini($1,0)) {&lt;br /&gt;
   ; echos the name of the current topic&lt;br /&gt;
   echo -a - $ini($1,%i)&lt;br /&gt;
   ; set a new looping-variable&lt;br /&gt;
   var %j = 1&lt;br /&gt;
   ; lets begin to loop through all items in the current topic&lt;br /&gt;
   while (%j &amp;lt;= $ini($1,$ini($1,%i),0)) {&lt;br /&gt;
    ; echo all items in this topic&lt;br /&gt;
    ; $ini($1,$ini($1,%i),%j) returns the item name of the %j&#039;s item in the %i&#039;s section.&lt;br /&gt;
    ; $ini($1,%i) returns the %i&#039;s section name&lt;br /&gt;
    echo -a -- $ini($1,$ini($1,%i),%j) =&amp;gt; [[$readini]]($1,$ini($1,%i),$ini($1,$ini($1,%i),%j))&lt;br /&gt;
    ; increase looping variable&lt;br /&gt;
    inc %j&lt;br /&gt;
   }&lt;br /&gt;
   ; increase first looping-variable&lt;br /&gt;
   inc %i&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[$readini]] to see howto read a single line of an ini.&lt;br /&gt;
* [[Writeini|/writeini]] to write to an ini file.&lt;br /&gt;
&lt;br /&gt;
[[Category:File and Directory Identifiers]]&lt;br /&gt;
[[Category:Ini]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5782</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=5782"/>
		<updated>2012-12-07T15:45:40Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Added CS:GO to the comments&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, CS:GO, 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;
   ; If the input is not for the Source Rcon window, ignore it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$|$]]([[DollarPlus|$+]](%, srcon.id., %srcon.socket), 2) == [[$null]]) { [[return]] }&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 RCON an HL1 engine based server]]&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
* [[How to parse HL log data]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/Source_RCON_Protocol Source RCON Protocol on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5777</id>
		<title>Joining channels after hiding your address</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5777"/>
		<updated>2012-06-18T17:28:29Z</updated>

		<summary type="html">&lt;p&gt;NaNg: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Safe login --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 ; Joining channels after hiding your address&lt;br /&gt;
 ; by bindi @ QuakeNet&lt;br /&gt;
 ; Date: 08-04-2012&lt;br /&gt;
 ; Tested on mIRC 7.22&lt;br /&gt;
 &lt;br /&gt;
 on *:[[on start|START]]:{&lt;br /&gt;
   ;; when mirc starts, connect to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
   ;; (change the server if you prefer another server geographically closer&lt;br /&gt;
   ;; to you or something like that, see http://www.quakenet.org/servers)&lt;br /&gt;
  &lt;br /&gt;
   [[server]] irc.quakenet.org -i &amp;lt;nick&amp;gt; &amp;lt;alternate nick&amp;gt; &amp;lt;ident&amp;gt;@any.email.doesnt.matter &amp;lt;real name (doesn&#039;t have to be real, either :D)&amp;gt;&lt;br /&gt;
   ;; change the above to match your information.&lt;br /&gt;
  &lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 on *:[[on connect|CONNECT]]:{&lt;br /&gt;
   ;; this triggers when you&#039;ve connected to a server&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if we have connected to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
     [[Challenge auth|ChallengeAuth]]&lt;br /&gt;
     ;; if so, let&#039;s auth safely&lt;br /&gt;
  &lt;br /&gt;
     ![[mode]] [[$me]] +x&lt;br /&gt;
     ;; and add +x to our usermode&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 [[raw 396]]:*:{&lt;br /&gt;
   ;; this triggers when your host is hidden&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if it&#039;s QuakeNet (just to be sure)&lt;br /&gt;
  &lt;br /&gt;
     [[join]] #channel1,#channel2,#channel3 key1,,key3&lt;br /&gt;
     ;;change above to your channels and keys (if any).&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Challenge auth]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5774</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5774"/>
		<updated>2012-05-08T17:36:14Z</updated>

		<summary type="html">&lt;p&gt;NaNg: fixed script splittings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.2&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:TEXT:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.ExecuteInput {&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5773</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5773"/>
		<updated>2012-05-08T17:34:31Z</updated>

		<summary type="html">&lt;p&gt;NaNg: version update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.2&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 on ^*:NOTICE:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:TEXT:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.ExecuteInput {&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5772</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5772"/>
		<updated>2012-05-08T17:32:46Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Fixed to work when Q messages the responses (userflags -n)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.1&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 on ^*:NOTICE:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:TEXT:*:?: {&lt;br /&gt;
   ChallengeAuth.ExecuteInput [[$1-|$1-]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.ExecuteInput {&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5771</id>
		<title>Joining channels after hiding your address</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5771"/>
		<updated>2012-04-20T11:53:46Z</updated>

		<summary type="html">&lt;p&gt;NaNg: more clickies!!! :D&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Joining channels after hiding your address&lt;br /&gt;
 ; by bindi @ QuakeNet&lt;br /&gt;
 ; Date: 08-04-2012&lt;br /&gt;
 ; Tested on mIRC 7.22&lt;br /&gt;
 &lt;br /&gt;
 on *:[[on start|START]]:{&lt;br /&gt;
   ;; when mirc starts, connect to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
   ;; (change the server if you prefer another server geographically closer&lt;br /&gt;
   ;; to you or something like that, see http://www.quakenet.org/servers)&lt;br /&gt;
  &lt;br /&gt;
   [[server]] irc.quakenet.org -i &amp;lt;nick&amp;gt; &amp;lt;alternate nick&amp;gt; &amp;lt;ident&amp;gt;@any.email.doesnt.matter &amp;lt;real name (doesn&#039;t have to be real, either :D)&amp;gt;&lt;br /&gt;
   ;; change the above to match your information.&lt;br /&gt;
  &lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 on *:[[on connect|CONNECT]]:{&lt;br /&gt;
   ;; this triggers when you&#039;ve connected to a server&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if we have connected to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
     [[Challenge auth|ChallengeAuth]]&lt;br /&gt;
     ;; if so, let&#039;s auth safely&lt;br /&gt;
  &lt;br /&gt;
     ![[mode]] [[$me]] +x&lt;br /&gt;
     ;; and add +x to our usermode&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 [[raw 396]]:*:{&lt;br /&gt;
   ;; this triggers when your host is hidden&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if it&#039;s QuakeNet (just to be sure)&lt;br /&gt;
  &lt;br /&gt;
     [[join]] #channel1,#channel2,#channel3 key1,,key3&lt;br /&gt;
     ;;change above to your channels and keys (if any).&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Challenge auth]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5770</id>
		<title>Joining channels after hiding your address</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5770"/>
		<updated>2012-04-20T11:49:46Z</updated>

		<summary type="html">&lt;p&gt;NaNg: challengeauth is safer :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Joining channels after hiding your address&lt;br /&gt;
 ; by bindi @ QuakeNet&lt;br /&gt;
 ; Date: 08-04-2012&lt;br /&gt;
 ; Tested on mIRC 7.22&lt;br /&gt;
 &lt;br /&gt;
 on *:START:{&lt;br /&gt;
   ;; when mirc starts, connect to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
   ;; (change the server if you prefer another server geographically closer&lt;br /&gt;
   ;; to you or something like that, see http://www.quakenet.org/servers)&lt;br /&gt;
  &lt;br /&gt;
   [[server]] irc.quakenet.org -i &amp;lt;nick&amp;gt; &amp;lt;alternate nick&amp;gt; &amp;lt;ident&amp;gt;@any.email.doesnt.matter &amp;lt;real name (doesn&#039;t have to be real, either :D)&amp;gt;&lt;br /&gt;
   ;; change the above to match your information.&lt;br /&gt;
  &lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 on *:CONNECT:{&lt;br /&gt;
   ;; this triggers when you&#039;ve connected to a server&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if we have connected to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
     [[Challenge auth|ChallengeAuth]]&lt;br /&gt;
     ;; if so, let&#039;s auth safely&lt;br /&gt;
  &lt;br /&gt;
     ![[mode]] [[$me]] +x&lt;br /&gt;
     ;; and add +x to our usermode&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 raw 396:*:{&lt;br /&gt;
   ;; this triggers when your host is hidden&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if it&#039;s QuakeNet (just to be sure)&lt;br /&gt;
  &lt;br /&gt;
     [[join]] #channel1,#channel2,#channel3 key1,,key3&lt;br /&gt;
     ;;change above to your channels and keys (if any).&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Challenge auth]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5769</id>
		<title>Joining channels after hiding your address</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Joining_channels_after_hiding_your_address&amp;diff=5769"/>
		<updated>2012-04-20T11:44:36Z</updated>

		<summary type="html">&lt;p&gt;NaNg: by bindi&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Joining channels after hiding your address&lt;br /&gt;
 ; by bindi @ QuakeNet&lt;br /&gt;
 ; Date: 08-04-2012&lt;br /&gt;
 ; Tested on mIRC 7.22&lt;br /&gt;
 &lt;br /&gt;
 on *:START:{&lt;br /&gt;
   ;; when mirc starts, connect to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
   ;; (change the server if you prefer another server geographically closer&lt;br /&gt;
   ;; to you or something like that, see http://www.quakenet.org/servers)&lt;br /&gt;
  &lt;br /&gt;
   [[server]] irc.quakenet.org -i &amp;lt;nick&amp;gt; &amp;lt;alternate nick&amp;gt; &amp;lt;ident&amp;gt;@any.email.doesnt.matter &amp;lt;real name (doesn&#039;t have to be real, either :D)&amp;gt;&lt;br /&gt;
   ;; change the above to match your information.&lt;br /&gt;
  &lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
 on *:CONNECT:{&lt;br /&gt;
   ;; this triggers when you&#039;ve connected to a server&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if we have connected to QuakeNet&lt;br /&gt;
  &lt;br /&gt;
     !.[[raw]] -q AUTH &amp;lt;auth&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
     ;; if so, let&#039;s auth&lt;br /&gt;
  &lt;br /&gt;
     ![[mode]] [[$me]] +x&lt;br /&gt;
     ;; and add +x to our usermode&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
  &lt;br /&gt;
 raw 396:*:{&lt;br /&gt;
   ;; this triggers when your host is hidden&lt;br /&gt;
  &lt;br /&gt;
   [[If-Then-Else|if]] ([[$network]] == QuakeNet) &amp;amp;&amp;amp; (*.??.quakenet.org iswm [[$server]]) {&lt;br /&gt;
     ;; check if it&#039;s QuakeNet (just to be sure)&lt;br /&gt;
  &lt;br /&gt;
     [[join]] #channel1,#channel2,#channel3 key1,,key3&lt;br /&gt;
     ;;change above to your channels and keys (if any).&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Challenge auth]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5768</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5768"/>
		<updated>2012-04-10T13:23:07Z</updated>

		<summary type="html">&lt;p&gt;NaNg: clear vars + more doc&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.1&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   You don&#039;t need to configure ANYTHING! The scripts can work as is, by executing /ChallengeAuth.&lt;br /&gt;
 ;   If you&#039;d like for it to auto-auth on connect, use /ChallengeAuth.AutoAuth 1.&lt;br /&gt;
 ;   The script will pop up windows asking your username (first time only) and password (every time).&lt;br /&gt;
 ;&lt;br /&gt;
 ; If you don&#039;t want it to pop the password window every time, follow these instructions:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q account name and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corresponds to the given user which you should insert in the alias below, e.g:&lt;br /&gt;
 ;     alias -l ChallengeAuth.Password { return &amp;lt;Hashed_Password&amp;gt; }&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 ; Unsets challengeauth vars&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Clear {&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
   ![[Unset|unset]] %ChallengeAuth.Pass&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         ChallengeAuth.Clear&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       ChallengeAuth.Clear&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     ChallengeAuth.Clear&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5767</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5767"/>
		<updated>2012-04-10T13:06:06Z</updated>

		<summary type="html">&lt;p&gt;NaNg: fix &amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.1&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q authname and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corespondes to the given user which you should insert in the alias below.&lt;br /&gt;
 ;   If you want to auto-auth on connect to QuakeNet, make sure to enable the auto-auth (see below).&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren&#039;t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5766</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5766"/>
		<updated>2012-04-10T13:03:50Z</updated>

		<summary type="html">&lt;p&gt;NaNg: autoauth info message + challengeauth can now be used without parameters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.1&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q authname and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corespondes to the given user which you should insert in the alias below.&lt;br /&gt;
 ;   If you want to auto-auth on connect to QuakeNet, make sure to enable the auto-auth (see below).&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
   [[echo]] -at ChallengeAuth: Automatic authentication is now [[$iif]](%ChallengeAuth.AutoAuth, ON, OFF)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   ; If username and password weren?t supplied, use the defaults.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[tokenize]] 32 $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5764</id>
		<title>How to start</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5764"/>
		<updated>2012-04-05T17:32:09Z</updated>

		<summary type="html">&lt;p&gt;NaNg: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- noob --&amp;gt;&lt;br /&gt;
&amp;lt;!-- comment for Dana&#039;s wiki search --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial is supposed to give an introduction into scripting in mIRC. It will explain the so-called &#039;&#039;Scripts-Editor&#039;&#039; and its functions, followed by a little example. At the end it will give some hints about how to debug a script.&lt;br /&gt;
&lt;br /&gt;
== The Remote Editor ==&lt;br /&gt;
&lt;br /&gt;
If you want to begin to script in mIRC, you need to open the Script-Editor. You can do it in two ways: pressing &amp;quot;Alt + R&amp;quot; or with mIRC&#039;s menubar (Tools -&amp;gt; Scripts Editor).&lt;br /&gt;
&lt;br /&gt;
If you are using a premade script (for example nnscript), you will probably see a lot of code. Note that it is difficult to implement own scripts in such a premade one, as your code may interfere with the existing code (if you want to change mIRC&#039;s default output for example). &lt;br /&gt;
&lt;br /&gt;
At first, you should open a &#039;&#039;&#039;new remote file&#039;&#039;&#039;. To do it, click on File -&amp;gt; New (see picture below).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Newfile.png]]&lt;br /&gt;
&lt;br /&gt;
Note that your script files will be saved once you press &amp;quot;Ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The next part is about the five different tabs of mIRC&#039;s Scripts Editor:&lt;br /&gt;
&lt;br /&gt;
[[Image:scriptseditortabs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Aliases-Tab === &lt;br /&gt;
&lt;br /&gt;
Basically, you do not need to use aliases.ini (that you can edit using this tab). Usually, if you want to add a new alias, it would look like:&lt;br /&gt;
&lt;br /&gt;
 [[alias]] moo { [[return]] moo }&lt;br /&gt;
&lt;br /&gt;
in your &#039;Remote-Section&#039; of the editor (the one that&#039;s active after pressing Alt + R).&lt;br /&gt;
&lt;br /&gt;
You can add the same alias in your Aliases-Section:&lt;br /&gt;
&lt;br /&gt;
 moo { return moo }&lt;br /&gt;
&lt;br /&gt;
Notice that you don&#039;t need to write &#039;alias&#039; infront of the new alias if it&#039;s in the Aliases section and note that you cannot add events in this section.&lt;br /&gt;
&lt;br /&gt;
=== Popups-Tab ===&lt;br /&gt;
&lt;br /&gt;
Again you do not need to use this section. It&#039;s the same as using the [[Popup_Menus#MENU_prefix|menus]] alias in the remote section. Usually, there will be some menus added in this section (for example your nicklist-menu).&lt;br /&gt;
&lt;br /&gt;
[[Image:Popupsview.png]]&lt;br /&gt;
&lt;br /&gt;
=== Remote-Tab ===&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;maintab&amp;quot;. Every script is supposed to be saved in here.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you should not have two same events in one file, as only the first matching one will be triggered. Two separate examples:&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
 &lt;br /&gt;
 ; will never be triggered&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered for level 10&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
 &lt;br /&gt;
 ; will be triggered for all but level 10&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So if you aren&#039;t sure whether it will work or not, just use another (a new) file (look the image below to see how to make a new file). &lt;br /&gt;
&lt;br /&gt;
The following script will trigger on every &amp;quot;!moo&amp;quot; in every channel and response with &amp;quot;moo00oo00&amp;quot;:&lt;br /&gt;
 &lt;br /&gt;
 [[On_text|on *:TEXT]]:!moo:#: {&lt;br /&gt;
  [[msg]] [[$chan]] moo00oo00&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This would look like:&lt;br /&gt;
&lt;br /&gt;
[[Image:Firstscript.png]]&lt;br /&gt;
&lt;br /&gt;
If you are scripting something more complex, you want to use the check-mark button (or &amp;quot;{}&amp;quot;-button in older mIRC versions) in the upper right corner (see below). That button is used to check for bracket mis-matches in the scriptfile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracket-button.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve pressed it and nothing happended, everything is ok (note that it doesn&#039;t mean that your scripts will work, just that there are no obvious bracket mistakes (mIRC just counts the open and closed brackets)). If something&#039;s wrong, you will get the following popup:&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracketerror.png]]&lt;br /&gt;
&lt;br /&gt;
Even if it says that the bracket error is &#039;&#039;around&#039;&#039; line 1, it could be almost anywhere. Start you search from that line and look at the indentations to find out where you&#039;re missing a bracket.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The remote tab contains scripts that are triggered by events, such as [[On text|when someone speaks]] or [[On join|when someone joins a channel]]. For example, the following &#039;remote script&#039; would tell user&#039;s who join a channel hello!&lt;br /&gt;
&lt;br /&gt;
  [[On join|on *:JOIN]]:#: {&lt;br /&gt;
    [[msg]] [[$nick]] Hello. Welcome to [[$chan]] [[DollarPlus|$+]] !!! &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
If you would like to learn scripting, you should familiarize yourself with this tab. &lt;br /&gt;
You should also learn [[:Category:Events|event names]] and understand how to run commands, such as the [[msg]] command above which messages a channel or nick name.  You should also learn what [[:Category:Remote Identifiers|identifiers]] are and how to use them.  An example of an identifier in the above script is [[$nick]] and [[$chan]] which tell us the user&#039;s nick name and the channel&#039;s name.&lt;br /&gt;
You may click on any blue hyperlink for more information about a a command or identifier that you see in any of this wiki&#039;s examples.  Please use the examples and test them, to try and understand what they do.  Keep in mind, mIRC is a high level language and almost everything sounds like it is.  For example, if you want to know when someone quites you would use the [[on quit]] event!  One of the most common script events used is the [[on text]] event, which triggers when someone speaks either in a channel or a private message.&lt;br /&gt;
If you are interested in these events, you should move on to [[How to start (part 2)|part 2]] of this introduction.&lt;br /&gt;
&lt;br /&gt;
=== Users-Tab ===&lt;br /&gt;
&lt;br /&gt;
In this file your userlist is saved. You don&#039;t need to edit it manually, as there are commands to do it. See [[Access_Levels|access levels in general]], [[auser]], [[guser]] and [[ruser]].&lt;br /&gt;
&lt;br /&gt;
=== Variables-Tab ===&lt;br /&gt;
&lt;br /&gt;
All your global variables are saved in here. Again, you don&#039;t need to edit it manually, as you can use [[set]], [[unset]] or [[unsetall]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to debug ==&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve written some lines and you&#039;ve tested it, you will most likely notice, that it doesn&#039;t do what you expect it to do. The next step is to &#039;&#039;&#039;debug&#039;&#039;&#039; your script. At first take a look at your Status Window and check for error messages. If there are any, search for these errors in your script and correct them. If they aren&#039;t any, you should add [[echo]]&#039;s in your script to see where it stops to work. For example:&lt;br /&gt;
&lt;br /&gt;
 on *:TEXT:*:*: {&lt;br /&gt;
  if (%moo) { echo -a we are here }&lt;br /&gt;
  elseif (%moo2) { echo -a we are here 2 } &lt;br /&gt;
  echo -a after the if clauses&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
With this method, you can see exactly where it stops to work and correct this part.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; You cannot trigger on text, on notice, on action... events by yourself, you will need someone&#039;s help or another client or multiserver (/[[server]] -m ...) to test them.&lt;br /&gt;
&lt;br /&gt;
If some of the built-in commands don&#039;t work, ie. /kick, /away ... etc. you might have a custom alias that overrides them, you can test it with /!command, ie. /!kick #channel nick.&lt;br /&gt;
/!command will use the default mIRC command and bypass any custom aliases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For more info on debugging, see [[Debugging (Find The Bug)]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to start (part 2)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
&amp;lt;!-- noob --&amp;gt;&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5763</id>
		<title>How to start</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5763"/>
		<updated>2012-04-05T17:30:54Z</updated>

		<summary type="html">&lt;p&gt;NaNg: noob&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- noob --&amp;gt;&lt;br /&gt;
&amp;lt;!-- comment for Dana&#039;s wiki search --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial is supposed to give an introduction into scripting in mIRC. It will explain the so-called &#039;&#039;Scripts-Editor&#039;&#039; and its functions, followed by a little example. At the end it will give some hints about how to debug a script.&lt;br /&gt;
&lt;br /&gt;
This tutorial is aimed for starters, newbies (or noobs) and anyone who wants to learn the basics of mIRC scripting.&lt;br /&gt;
&lt;br /&gt;
== The Remote Editor ==&lt;br /&gt;
&lt;br /&gt;
If you want to begin to script in mIRC, you need to open the Script-Editor. You can do it in two ways: pressing &amp;quot;Alt + R&amp;quot; or with mIRC&#039;s menubar (Tools -&amp;gt; Scripts Editor).&lt;br /&gt;
&lt;br /&gt;
If you are using a premade script (for example nnscript), you will probably see a lot of code. Note that it is difficult to implement own scripts in such a premade one, as your code may interfere with the existing code (if you want to change mIRC&#039;s default output for example). &lt;br /&gt;
&lt;br /&gt;
At first, you should open a &#039;&#039;&#039;new remote file&#039;&#039;&#039;. To do it, click on File -&amp;gt; New (see picture below).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Newfile.png]]&lt;br /&gt;
&lt;br /&gt;
Note that your script files will be saved once you press &amp;quot;Ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The next part is about the five different tabs of mIRC&#039;s Scripts Editor:&lt;br /&gt;
&lt;br /&gt;
[[Image:scriptseditortabs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Aliases-Tab === &lt;br /&gt;
&lt;br /&gt;
Basically, you do not need to use aliases.ini (that you can edit using this tab). Usually, if you want to add a new alias, it would look like:&lt;br /&gt;
&lt;br /&gt;
 [[alias]] moo { [[return]] moo }&lt;br /&gt;
&lt;br /&gt;
in your &#039;Remote-Section&#039; of the editor (the one that&#039;s active after pressing Alt + R).&lt;br /&gt;
&lt;br /&gt;
You can add the same alias in your Aliases-Section:&lt;br /&gt;
&lt;br /&gt;
 moo { return moo }&lt;br /&gt;
&lt;br /&gt;
Notice that you don&#039;t need to write &#039;alias&#039; infront of the new alias if it&#039;s in the Aliases section and note that you cannot add events in this section.&lt;br /&gt;
&lt;br /&gt;
=== Popups-Tab ===&lt;br /&gt;
&lt;br /&gt;
Again you do not need to use this section. It&#039;s the same as using the [[Popup_Menus#MENU_prefix|menus]] alias in the remote section. Usually, there will be some menus added in this section (for example your nicklist-menu).&lt;br /&gt;
&lt;br /&gt;
[[Image:Popupsview.png]]&lt;br /&gt;
&lt;br /&gt;
=== Remote-Tab ===&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;maintab&amp;quot;. Every script is supposed to be saved in here.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you should not have two same events in one file, as only the first matching one will be triggered. Two separate examples:&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
 &lt;br /&gt;
 ; will never be triggered&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered for level 10&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
 &lt;br /&gt;
 ; will be triggered for all but level 10&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So if you aren&#039;t sure whether it will work or not, just use another (a new) file (look the image below to see how to make a new file). &lt;br /&gt;
&lt;br /&gt;
The following script will trigger on every &amp;quot;!moo&amp;quot; in every channel and response with &amp;quot;moo00oo00&amp;quot;:&lt;br /&gt;
 &lt;br /&gt;
 [[On_text|on *:TEXT]]:!moo:#: {&lt;br /&gt;
  [[msg]] [[$chan]] moo00oo00&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This would look like:&lt;br /&gt;
&lt;br /&gt;
[[Image:Firstscript.png]]&lt;br /&gt;
&lt;br /&gt;
If you are scripting something more complex, you want to use the check-mark button (or &amp;quot;{}&amp;quot;-button in older mIRC versions) in the upper right corner (see below). That button is used to check for bracket mis-matches in the scriptfile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracket-button.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve pressed it and nothing happended, everything is ok (note that it doesn&#039;t mean that your scripts will work, just that there are no obvious bracket mistakes (mIRC just counts the open and closed brackets)). If something&#039;s wrong, you will get the following popup:&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracketerror.png]]&lt;br /&gt;
&lt;br /&gt;
Even if it says that the bracket error is &#039;&#039;around&#039;&#039; line 1, it could be almost anywhere. Start you search from that line and look at the indentations to find out where you&#039;re missing a bracket.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The remote tab contains scripts that are triggered by events, such as [[On text|when someone speaks]] or [[On join|when someone joins a channel]]. For example, the following &#039;remote script&#039; would tell user&#039;s who join a channel hello!&lt;br /&gt;
&lt;br /&gt;
  [[On join|on *:JOIN]]:#: {&lt;br /&gt;
    [[msg]] [[$nick]] Hello. Welcome to [[$chan]] [[DollarPlus|$+]] !!! &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
If you would like to learn scripting, you should familiarize yourself with this tab. &lt;br /&gt;
You should also learn [[:Category:Events|event names]] and understand how to run commands, such as the [[msg]] command above which messages a channel or nick name.  You should also learn what [[:Category:Remote Identifiers|identifiers]] are and how to use them.  An example of an identifier in the above script is [[$nick]] and [[$chan]] which tell us the user&#039;s nick name and the channel&#039;s name.&lt;br /&gt;
You may click on any blue hyperlink for more information about a a command or identifier that you see in any of this wiki&#039;s examples.  Please use the examples and test them, to try and understand what they do.  Keep in mind, mIRC is a high level language and almost everything sounds like it is.  For example, if you want to know when someone quites you would use the [[on quit]] event!  One of the most common script events used is the [[on text]] event, which triggers when someone speaks either in a channel or a private message.&lt;br /&gt;
If you are interested in these events, you should move on to [[How to start (part 2)|part 2]] of this introduction.&lt;br /&gt;
&lt;br /&gt;
=== Users-Tab ===&lt;br /&gt;
&lt;br /&gt;
In this file your userlist is saved. You don&#039;t need to edit it manually, as there are commands to do it. See [[Access_Levels|access levels in general]], [[auser]], [[guser]] and [[ruser]].&lt;br /&gt;
&lt;br /&gt;
=== Variables-Tab ===&lt;br /&gt;
&lt;br /&gt;
All your global variables are saved in here. Again, you don&#039;t need to edit it manually, as you can use [[set]], [[unset]] or [[unsetall]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to debug ==&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve written some lines and you&#039;ve tested it, you will most likely notice, that it doesn&#039;t do what you expect it to do. The next step is to &#039;&#039;&#039;debug&#039;&#039;&#039; your script. At first take a look at your Status Window and check for error messages. If there are any, search for these errors in your script and correct them. If they aren&#039;t any, you should add [[echo]]&#039;s in your script to see where it stops to work. For example:&lt;br /&gt;
&lt;br /&gt;
 on *:TEXT:*:*: {&lt;br /&gt;
  if (%moo) { echo -a we are here }&lt;br /&gt;
  elseif (%moo2) { echo -a we are here 2 } &lt;br /&gt;
  echo -a after the if clauses&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
With this method, you can see exactly where it stops to work and correct this part.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; You cannot trigger on text, on notice, on action... events by yourself, you will need someone&#039;s help or another client or multiserver (/[[server]] -m ...) to test them.&lt;br /&gt;
&lt;br /&gt;
If some of the built-in commands don&#039;t work, ie. /kick, /away ... etc. you might have a custom alias that overrides them, you can test it with /!command, ie. /!kick #channel nick.&lt;br /&gt;
/!command will use the default mIRC command and bypass any custom aliases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For more info on debugging, see [[Debugging (Find The Bug)]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to start (part 2)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
&amp;lt;!-- noob --&amp;gt;&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5762</id>
		<title>How to start</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5762"/>
		<updated>2012-03-24T19:00:03Z</updated>

		<summary type="html">&lt;p&gt;NaNg: noob ?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- noob --&amp;gt;&lt;br /&gt;
&amp;lt;!-- comment for Dana&#039;s wiki search --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial is supposed to give an introduction into scripting in mIRC. It will explain the so-called &#039;&#039;Scripts-Editor&#039;&#039; and its functions, followed by a little example. At the end it will give some hints about how to debug a script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Remote Editor ==&lt;br /&gt;
&lt;br /&gt;
If you want to begin to script in mIRC, you need to open the Script-Editor. You can do it in two ways: pressing &amp;quot;Alt + R&amp;quot; or with mIRC&#039;s menubar (Tools -&amp;gt; Scripts Editor).&lt;br /&gt;
&lt;br /&gt;
If you are using a premade script (for example nnscript), you will probably see a lot of code. Note that it is difficult to implement own scripts in such a premade one, as your code may interfere with the existing code (if you want to change mIRC&#039;s default output for example). &lt;br /&gt;
&lt;br /&gt;
At first, you should open a &#039;&#039;&#039;new remote file&#039;&#039;&#039;. To do it, click on File -&amp;gt; New (see picture below).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Newfile.png]]&lt;br /&gt;
&lt;br /&gt;
Note that your script files will be saved once you press &amp;quot;Ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The next part is about the five different tabs of mIRC&#039;s Scripts Editor:&lt;br /&gt;
&lt;br /&gt;
[[Image:scriptseditortabs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Aliases-Tab === &lt;br /&gt;
&lt;br /&gt;
Basically, you do not need to use aliases.ini (that you can edit using this tab). Usually, if you want to add a new alias, it would look like:&lt;br /&gt;
&lt;br /&gt;
 [[alias]] moo { [[return]] moo }&lt;br /&gt;
&lt;br /&gt;
in your &#039;Remote-Section&#039; of the editor (the one that&#039;s active after pressing Alt + R).&lt;br /&gt;
&lt;br /&gt;
You can add the same alias in your Aliases-Section:&lt;br /&gt;
&lt;br /&gt;
 moo { return moo }&lt;br /&gt;
&lt;br /&gt;
Notice that you don&#039;t need to write &#039;alias&#039; infront of the new alias if it&#039;s in the Aliases section and note that you cannot add events in this section.&lt;br /&gt;
&lt;br /&gt;
=== Popups-Tab ===&lt;br /&gt;
&lt;br /&gt;
Again you do not need to use this section. It&#039;s the same as using the [[Popup_Menus#MENU_prefix|menus]] alias in the remote section. Usually, there will be some menus added in this section (for example your nicklist-menu).&lt;br /&gt;
&lt;br /&gt;
[[Image:Popupsview.png]]&lt;br /&gt;
&lt;br /&gt;
=== Remote-Tab ===&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;maintab&amp;quot;. Every script is supposed to be saved in here.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you should not have two same events in one file, as only the first matching one will be triggered. Two separate examples:&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
 &lt;br /&gt;
 ; will never be triggered&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered for level 10&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
 &lt;br /&gt;
 ; will be triggered for all but level 10&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So if you aren&#039;t sure whether it will work or not, just use another (a new) file (look the image below to see how to make a new file). &lt;br /&gt;
&lt;br /&gt;
The following script will trigger on every &amp;quot;!moo&amp;quot; in every channel and response with &amp;quot;moo00oo00&amp;quot;:&lt;br /&gt;
 &lt;br /&gt;
 [[On_text|on *:TEXT]]:!moo:#: {&lt;br /&gt;
  [[msg]] [[$chan]] moo00oo00&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This would look like:&lt;br /&gt;
&lt;br /&gt;
[[Image:Firstscript.png]]&lt;br /&gt;
&lt;br /&gt;
If you are scripting something more complex, you want to use the check-mark button (or &amp;quot;{}&amp;quot;-button in older mIRC versions) in the upper right corner (see below). That button is used to check for bracket mis-matches in the scriptfile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracket-button.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve pressed it and nothing happended, everything is ok (note that it doesn&#039;t mean that your scripts will work, just that there are no obvious bracket mistakes (mIRC just counts the open and closed brackets)). If something&#039;s wrong, you will get the following popup:&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracketerror.png]]&lt;br /&gt;
&lt;br /&gt;
Even if it says that the bracket error is &#039;&#039;around&#039;&#039; line 1, it could be almost anywhere. Start you search from that line and look at the indentations to find out where you&#039;re missing a bracket.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The remote tab contains scripts that are triggered by events, such as [[On text|when someone speaks]] or [[On join|when someone joins a channel]]. For example, the following &#039;remote script&#039; would tell user&#039;s who join a channel hello!&lt;br /&gt;
&lt;br /&gt;
  [[On join|on *:JOIN]]:#: {&lt;br /&gt;
    [[msg]] [[$nick]] Hello. Welcome to [[$chan]] [[DollarPlus|$+]] !!! &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
If you would like to learn scripting, you should familiarize yourself with this tab. &lt;br /&gt;
You should also learn [[:Category:Events|event names]] and understand how to run commands, such as the [[msg]] command above which messages a channel or nick name.  You should also learn what [[:Category:Remote Identifiers|identifiers]] are and how to use them.  An example of an identifier in the above script is [[$nick]] and [[$chan]] which tell us the user&#039;s nick name and the channel&#039;s name.&lt;br /&gt;
You may click on any blue hyperlink for more information about a a command or identifier that you see in any of this wiki&#039;s examples.  Please use the examples and test them, to try and understand what they do.  Keep in mind, mIRC is a high level language and almost everything sounds like it is.  For example, if you want to know when someone quites you would use the [[on quit]] event!  One of the most common script events used is the [[on text]] event, which triggers when someone speaks either in a channel or a private message.&lt;br /&gt;
If you are interested in these events, you should move on to [[How to start (part 2)|part 2]] of this introduction.&lt;br /&gt;
&lt;br /&gt;
=== Users-Tab ===&lt;br /&gt;
&lt;br /&gt;
In this file your userlist is saved. You don&#039;t need to edit it manually, as there are commands to do it. See [[Access_Levels|access levels in general]], [[auser]], [[guser]] and [[ruser]].&lt;br /&gt;
&lt;br /&gt;
=== Variables-Tab ===&lt;br /&gt;
&lt;br /&gt;
All your global variables are saved in here. Again, you don&#039;t need to edit it manually, as you can use [[set]], [[unset]] or [[unsetall]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to debug ==&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve written some lines and you&#039;ve tested it, you will most likely notice, that it doesn&#039;t do what you expect it to do. The next step is to &#039;&#039;&#039;debug&#039;&#039;&#039; your script. At first take a look at your Status Window and check for error messages. If there are any, search for these errors in your script and correct them. If they aren&#039;t any, you should add [[echo]]&#039;s in your script to see where it stops to work. For example:&lt;br /&gt;
&lt;br /&gt;
 on *:TEXT:*:*: {&lt;br /&gt;
  if (%moo) { echo -a we are here }&lt;br /&gt;
  elseif (%moo2) { echo -a we are here 2 } &lt;br /&gt;
  echo -a after the if clauses&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
With this method, you can see exactly where it stops to work and correct this part.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; You cannot trigger on text, on notice, on action... events by yourself, you will need someone&#039;s help or another client or multiserver (/[[server]] -m ...) to test them.&lt;br /&gt;
&lt;br /&gt;
If some of the built-in commands don&#039;t work, ie. /kick, /away ... etc. you might have a custom alias that overrides them, you can test it with /!command, ie. /!kick #channel nick.&lt;br /&gt;
/!command will use the default mIRC command and bypass any custom aliases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For more info on debugging, see [[Debugging (Find The Bug)]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to start (part 2)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
&amp;lt;!-- noob --&amp;gt;&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5761</id>
		<title>How to start</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5761"/>
		<updated>2012-03-24T18:57:33Z</updated>

		<summary type="html">&lt;p&gt;NaNg: modified the hidden &amp;quot;noob&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is supposed to give an introduction into scripting in mIRC. It will explain the so-called &#039;&#039;Scripts-Editor&#039;&#039; and its functions, followed by a little example. At the end it will give some hints about how to debug a script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Remote Editor ==&lt;br /&gt;
&lt;br /&gt;
If you want to begin to script in mIRC, you need to open the Script-Editor. You can do it in two ways: pressing &amp;quot;Alt + R&amp;quot; or with mIRC&#039;s menubar (Tools -&amp;gt; Scripts Editor).&lt;br /&gt;
&lt;br /&gt;
If you are using a premade script (for example nnscript), you will probably see a lot of code. Note that it is difficult to implement own scripts in such a premade one, as your code may interfere with the existing code (if you want to change mIRC&#039;s default output for example). &lt;br /&gt;
&lt;br /&gt;
At first, you should open a &#039;&#039;&#039;new remote file&#039;&#039;&#039;. To do it, click on File -&amp;gt; New (see picture below).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Newfile.png]]&lt;br /&gt;
&lt;br /&gt;
Note that your script files will be saved once you press &amp;quot;Ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The next part is about the five different tabs of mIRC&#039;s Scripts Editor:&lt;br /&gt;
&lt;br /&gt;
[[Image:scriptseditortabs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Aliases-Tab === &lt;br /&gt;
&lt;br /&gt;
Basically, you do not need to use aliases.ini (that you can edit using this tab). Usually, if you want to add a new alias, it would look like:&lt;br /&gt;
&lt;br /&gt;
 [[alias]] moo { [[return]] moo }&lt;br /&gt;
&lt;br /&gt;
in your &#039;Remote-Section&#039; of the editor (the one that&#039;s active after pressing Alt + R).&lt;br /&gt;
&lt;br /&gt;
You can add the same alias in your Aliases-Section:&lt;br /&gt;
&lt;br /&gt;
 moo { return moo }&lt;br /&gt;
&lt;br /&gt;
Notice that you don&#039;t need to write &#039;alias&#039; infront of the new alias if it&#039;s in the Aliases section and note that you cannot add events in this section.&lt;br /&gt;
&lt;br /&gt;
=== Popups-Tab ===&lt;br /&gt;
&lt;br /&gt;
Again you do not need to use this section. It&#039;s the same as using the [[Popup_Menus#MENU_prefix|menus]] alias in the remote section. Usually, there will be some menus added in this section (for example your nicklist-menu).&lt;br /&gt;
&lt;br /&gt;
[[Image:Popupsview.png]]&lt;br /&gt;
&lt;br /&gt;
=== Remote-Tab ===&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;maintab&amp;quot;. Every script is supposed to be saved in here.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you should not have two same events in one file, as only the first matching one will be triggered. Two separate examples:&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
 &lt;br /&gt;
 ; will never be triggered&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered for level 10&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
 &lt;br /&gt;
 ; will be triggered for all but level 10&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So if you aren&#039;t sure whether it will work or not, just use another (a new) file (look the image below to see how to make a new file). &lt;br /&gt;
&lt;br /&gt;
The following script will trigger on every &amp;quot;!moo&amp;quot; in every channel and response with &amp;quot;moo00oo00&amp;quot;:&lt;br /&gt;
 &lt;br /&gt;
 [[On_text|on *:TEXT]]:!moo:#: {&lt;br /&gt;
  [[msg]] [[$chan]] moo00oo00&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This would look like:&lt;br /&gt;
&lt;br /&gt;
[[Image:Firstscript.png]]&lt;br /&gt;
&lt;br /&gt;
If you are scripting something more complex, you want to use the check-mark button (or &amp;quot;{}&amp;quot;-button in older mIRC versions) in the upper right corner (see below). That button is used to check for bracket mis-matches in the scriptfile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracket-button.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve pressed it and nothing happended, everything is ok (note that it doesn&#039;t mean that your scripts will work, just that there are no obvious bracket mistakes (mIRC just counts the open and closed brackets)). If something&#039;s wrong, you will get the following popup:&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracketerror.png]]&lt;br /&gt;
&lt;br /&gt;
Even if it says that the bracket error is &#039;&#039;around&#039;&#039; line 1, it could be almost anywhere. Start you search from that line and look at the indentations to find out where you&#039;re missing a bracket.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The remote tab contains scripts that are triggered by events, such as [[On text|when someone speaks]] or [[On join|when someone joins a channel]]. For example, the following &#039;remote script&#039; would tell user&#039;s who join a channel hello!&lt;br /&gt;
&lt;br /&gt;
  [[On join|on *:JOIN]]:#: {&lt;br /&gt;
    [[msg]] [[$nick]] Hello. Welcome to [[$chan]] [[DollarPlus|$+]] !!! &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
If you would like to learn scripting, you should familiarize yourself with this tab. &lt;br /&gt;
You should also learn [[:Category:Events|event names]] and understand how to run commands, such as the [[msg]] command above which messages a channel or nick name.  You should also learn what [[:Category:Remote Identifiers|identifiers]] are and how to use them.  An example of an identifier in the above script is [[$nick]] and [[$chan]] which tell us the user&#039;s nick name and the channel&#039;s name.&lt;br /&gt;
You may click on any blue hyperlink for more information about a a command or identifier that you see in any of this wiki&#039;s examples.  Please use the examples and test them, to try and understand what they do.  Keep in mind, mIRC is a high level language and almost everything sounds like it is.  For example, if you want to know when someone quites you would use the [[on quit]] event!  One of the most common script events used is the [[on text]] event, which triggers when someone speaks either in a channel or a private message.&lt;br /&gt;
If you are interested in these events, you should move on to [[How to start (part 2)|part 2]] of this introduction.&lt;br /&gt;
&lt;br /&gt;
=== Users-Tab ===&lt;br /&gt;
&lt;br /&gt;
In this file your userlist is saved. You don&#039;t need to edit it manually, as there are commands to do it. See [[Access_Levels|access levels in general]], [[auser]], [[guser]] and [[ruser]].&lt;br /&gt;
&lt;br /&gt;
=== Variables-Tab ===&lt;br /&gt;
&lt;br /&gt;
All your global variables are saved in here. Again, you don&#039;t need to edit it manually, as you can use [[set]], [[unset]] or [[unsetall]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to debug ==&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve written some lines and you&#039;ve tested it, you will most likely notice, that it doesn&#039;t do what you expect it to do. The next step is to &#039;&#039;&#039;debug&#039;&#039;&#039; your script. At first take a look at your Status Window and check for error messages. If there are any, search for these errors in your script and correct them. If they aren&#039;t any, you should add [[echo]]&#039;s in your script to see where it stops to work. For example:&lt;br /&gt;
&lt;br /&gt;
 on *:TEXT:*:*: {&lt;br /&gt;
  if (%moo) { echo -a we are here }&lt;br /&gt;
  elseif (%moo2) { echo -a we are here 2 } &lt;br /&gt;
  echo -a after the if clauses&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
With this method, you can see exactly where it stops to work and correct this part.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; You cannot trigger on text, on notice, on action... events by yourself, you will need someone&#039;s help or another client or multiserver (/[[server]] -m ...) to test them.&lt;br /&gt;
&lt;br /&gt;
If some of the built-in commands don&#039;t work, ie. /kick, /away ... etc. you might have a custom alias that overrides them, you can test it with /!command, ie. /!kick #channel nick.&lt;br /&gt;
/!command will use the default mIRC command and bypass any custom aliases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For more info on debugging, see [[Debugging (Find The Bug)]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to start (part 2)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
&amp;lt;!-- noob --&amp;gt;&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Category:Quakenet&amp;diff=5760</id>
		<title>Category:Quakenet</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Category:Quakenet&amp;diff=5760"/>
		<updated>2012-03-24T18:55:58Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Fixed servers link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;QuakeNet&#039;&#039;&#039; is an IRC network, built around the gaming community, and is an organisation that facilitates the communication of many teams and online organisations. Though originally founded as a chat network for gamers, by gamers, QuakeNet welcomes everyone to chat about anything (within its rules). QuakeNet is also currently the largest chat network in the world, with a peak usercount each week of around 180,000 to 190,000 users (as listed by [http://irc.netsplit.de/networks/ http://irc.netsplit.de/networks/]).&lt;br /&gt;
&lt;br /&gt;
[[:Category:IRC|IRC]] stands for &#039;Internet Relay Chat&#039;, and is a means for people to talk together in a text-based, real-time environment on the internet.&lt;br /&gt;
&lt;br /&gt;
It has proven itself more popular than other chat systems, and more sophisticated, due in part to the ability to allow people to set up and keep their own rooms, or &#039;channels&#039;. Almost all IRC server software is open source, therefore even servers are available to anyone to set up. IRC networks are comprised of many linked servers, this means that when talking on the chat network, you can select a server closest to you and still talk to someone connected to a server on the other side of the world (as long as those servers are part of the same network, such as QuakeNet).Due to the nature and availability of IRC software and the protocols, IRC is controlled by no one person or organisation.&lt;br /&gt;
&lt;br /&gt;
Whilst the vast majority of users on QuakeNet are gamers, QuakeNet is not limited to gaming-related topics, and we welcome all users who abide by our rules.&lt;br /&gt;
&lt;br /&gt;
It&#039;s very simple to join in the fun. All you need is an IRC &#039;client&#039; (such as [[mIRC]] from [http://www.mirc.com www.mirc.com]), you can then reach QuakeNet by selecting &amp;quot;QuakeNet: random server&amp;quot; from the server list, or by connecting directly to a server listed at [http://www.quakenet.org/servers http://www.quakenet.org/servers].&lt;br /&gt;
&lt;br /&gt;
==External link==&lt;br /&gt;
*[http://www.quakenet.org/ http://www.quakenet.org/]&lt;br /&gt;
&lt;br /&gt;
[[Category:IRC]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5759</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5759"/>
		<updated>2012-03-24T18:40:06Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Fixed wrong alias names&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.1&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q authname and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corespondes to the given user which you should insert in the alias below.&lt;br /&gt;
 ;   If you want to auto-auth on connect to QuakeNet, make sure to enable the auto-auth (see below).&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (!%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.Username, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.Username &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Username specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5758</id>
		<title>Challenge auth</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Challenge_auth&amp;diff=5758"/>
		<updated>2012-03-24T18:13:08Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Changed to use $sha1 instead of SHA2.dll&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; Original by doomie @ QuakeNet&lt;br /&gt;
 ; Modified by NaNg @ QuakeNet&lt;br /&gt;
 ; Version 1.1&lt;br /&gt;
 ; Written and tested on mIRC 6.34&lt;br /&gt;
 ; Also tested on mIRC 7.22&lt;br /&gt;
 ;&lt;br /&gt;
 ; What does this script contains?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth script based on hmac-sha1 (no addon dll needed for mIRC on tested version).&lt;br /&gt;
 ;&lt;br /&gt;
 ; What is ChallengeAuth?&lt;br /&gt;
 ;&lt;br /&gt;
 ;   ChallengeAuth is a safe way to auth to your Q account, without sending your password in plain&lt;br /&gt;
 ;   text over the network. For more information, please read the following link:&lt;br /&gt;
 ;     http://www.quakenet.org/development/challengeauth/&lt;br /&gt;
 ;&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ; What do I need to configure before using this script?&lt;br /&gt;
 ; *****************************************************&lt;br /&gt;
 ;&lt;br /&gt;
 ;   The ChallengeAuth.Username and ChallengeAuth.Password right under this documentation needs to&lt;br /&gt;
 ;   be edited for your username and hashed password.&lt;br /&gt;
 ;   To get the hashed password, after loading this script, use:&lt;br /&gt;
 ;     /ChallengeAuth.CreateHash &amp;lt;User&amp;gt; &amp;lt;Pass&amp;gt;&lt;br /&gt;
 ;   where User is your Q authname and Pass is your Q password, and you will be given the hashed&lt;br /&gt;
 ;   password that corespondes to the given user which you should insert in the alias below.&lt;br /&gt;
 ;   If you want to auto-auth on connect to QuakeNet, make sure to enable the auto-auth (see below).&lt;br /&gt;
 ;&lt;br /&gt;
 ; Available commands:&lt;br /&gt;
 ;&lt;br /&gt;
 ;   * ChallengeAuth&lt;br /&gt;
 ;       To auth to the pre-set user and password using the challengeauth.&lt;br /&gt;
 ;   * ChallengeAuth.AutoAuth [1|0]&lt;br /&gt;
 ;       Set 1 to enable to auto-auth on connect or 0 to disable.&lt;br /&gt;
 ;   * ChallengeAuth.CreateHash [&amp;lt;Authname&amp;gt;] [&amp;lt;Pass&amp;gt;]&lt;br /&gt;
 ;       Creates a hashed request according to the given Q user and pass.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; CONFIGURE&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Username {&lt;br /&gt;
   [[If-Then-Else|if]] (%ChallengeAuth.User) {&lt;br /&gt;
     ![[set]] %ChallengeAuth.User $?=&amp;quot;Q account name?&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] %ChallengeAuth.User&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Password {&lt;br /&gt;
   [[return]] $ChallengeAuth.CreateHash($ChallengeAuth.User, $?*=&amp;quot;Password for Q account name: $ChallengeAuth.User &amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 ; DONT CHANGE ANYTHING UNDER THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING&lt;br /&gt;
  &lt;br /&gt;
 [[alias]] -l ChallengeAuth.Q { [[return]] Q@CServe.quakenet.org }&lt;br /&gt;
 &lt;br /&gt;
 ; id = whether autoauth is on or not.&lt;br /&gt;
 ; $1 = 1 for autoauth or 0 for not.&lt;br /&gt;
 [[alias]] ChallengeAuth.AutoAuth {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.AutoAuth&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == [[$null]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Not enough parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] !isin 01) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: Invalid parameter. Please enter 1 to enable or 0 to disable.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[set]] %ChallengeAuth.AutoAuth [[$1-|$1]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = key, $2 = message&lt;br /&gt;
 [[alias]] hmac-sha1 {&lt;br /&gt;
   [[Local_Variables|var]] %i = 1&lt;br /&gt;
   [[while]] (%i &amp;lt;= 64) {&lt;br /&gt;
     [[Local_Variables|var]] %k = [[$iif]]([[$asc]]([[$mid]]([[$1-|$1]],%i,1)),[[$v1]],0)&lt;br /&gt;
     [[Local_Variables|var]] %opad = %opad [[$xor]](92,%k)&lt;br /&gt;
     [[Local_Variables|var]] %ipad = %ipad [[$xor]](54,%k)&lt;br /&gt;
     [[inc]] %i&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[bset]] &amp;amp;ipad 1 %ipad [[$regsubex]]([[$1-|$2]],/(.)/g,[[$asc]](\t) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[bset]] &amp;amp;opad 1 %opad [[$regsubex]]([[$sha1]](&amp;amp;ipad,1),/(..)/g,[[$base]](\t,16,10) [[DollarPlus|$+]] [[$chr]](32))&lt;br /&gt;
   [[Local_Variables|var]] %res = [[$sha1]](&amp;amp;opad,1)&lt;br /&gt;
   [[bunset]] &amp;amp;ipad &amp;amp;opad&lt;br /&gt;
   [[return]] %res&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = string to lower&lt;br /&gt;
 [[alias]] -l ChallengeAuth.IRCToLower {&lt;br /&gt;
   [[return]] [[$replacex]]([[$lower]]([[$1-|$1]]),[[$chr]](91),[[$chr]](123),[[$chr]](93),[[$chr]](125),[[$chr]](92),[[$chr]](124),[[$chr]](94),[[$chr]](126))&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Authname, $2 = Password&lt;br /&gt;
 [[alias]] ChallengeAuth.CreateHash {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -ta ChallengeAuth: Not enough values given.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[Local_Variables|var]] %ChallengeAuth.Hash = [[$sha1]]([[DollarPlus|$+]]($ChallengeAuth.IRCToLower([[$1-|$1]]),:,[[$sha1]]([[$left]]([[$1-|$2]],10))))&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$isid]]) [[return]] %ChallengeAuth.Hash&lt;br /&gt;
 &lt;br /&gt;
   ![[echo]] -atg ChallengeAuth: Hashed user/pass: %ChallengeAuth.Hash&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; $1 = Challenge&lt;br /&gt;
 [[alias]] -l ChallengeAuth.Auth {&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q CHALLENGEAUTH %ChallengeAuth.User $hmac-sha1(%ChallengeAuth.Pass, [[$1-|$1]]) HMAC-SHA-1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] ChallengeAuth {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$1]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Username specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (![[$1-|$2]]) {&lt;br /&gt;
     [[echo]] -at ChallengeAuth: No Password specified.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ![[set]] %ChallengeAuth.Active [[$true]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.User [[$1-|$1]]&lt;br /&gt;
   ![[set]] %ChallengeAuth.Pass [[$1-|$2]]&lt;br /&gt;
 &lt;br /&gt;
   [[echo]] -at ChallengeAuth: ChallengeAuth is beginning.&lt;br /&gt;
   !.[[msg]] $ChallengeAuth.Q challenge&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] (%ChallengeAuth.User == NaNg) {&lt;br /&gt;
     !mode [[$me]] +Inw&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     !mode [[$me]] +xw&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:CONNECT: {&lt;br /&gt;
   [[If-Then-Else|if]] (($ChallengeAuth.AutoAuth) &amp;amp;&amp;amp; ([[$network]] == QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org)) {&lt;br /&gt;
     ChallengeAuth $ChallengeAuth.Username $ChallengeAuth.Password&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on ^*:NOTICE:*:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ($fulladdress === Q!TheQBot@CServe.quakenet.org) &amp;amp;&amp;amp; ([[$network]] === QuakeNet) &amp;amp;&amp;amp; ([[$right]]([[$server]], 13) === .quakenet.org) {&lt;br /&gt;
     [[If-Then-Else|if]] ([[$1-|$1]] === CHALLENGE) &amp;amp;&amp;amp; ([[$len]]([[$1-|$2]]) == 32) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[If-Then-Else|if]] ([[$istok]]([[$1-|$3-]], HMAC-SHA-1, 32)) {&lt;br /&gt;
         .timer 1 0 ChallengeAuth.Auth [[$1-|$2]]&lt;br /&gt;
       }&lt;br /&gt;
       [[If-Then-Else|else]] {&lt;br /&gt;
         [[echo]] -ts ChallengeAuth: HMAC-SHA-1 is not supported. ChallengeAuth is NOT continuing.&lt;br /&gt;
         [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == CHALLENGE is not available once you have authed.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are already authed!&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-6]] == You are now logged in as) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: You are now authed as ***&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] ([[$1-|$1-]] == Username or password incorrect.) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
       [[echo]] -ts ChallengeAuth: Username or password incorrect.&lt;br /&gt;
       [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 raw 401:*: {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1-]] == [[$me]] $ChallengeAuth.Q No such nick) &amp;amp;&amp;amp; (%ChallengeAuth.Active) {&lt;br /&gt;
     [[echo]] -ts ChallengeAuth: Q is currently not reachable. Please try again later.&lt;br /&gt;
     [[Unset|unset]] %ChallengeAuth.Active&lt;br /&gt;
     [[haltdef]]&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=On_text&amp;diff=5757</id>
		<title>On text</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=On_text&amp;diff=5757"/>
		<updated>2012-03-23T07:23:14Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Added references to &amp;quot;why doesn&amp;#039;t my text event work&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The on TEXT event triggers when you receive private and/or channel messages.&lt;br /&gt;
 on &amp;lt;level&amp;gt;:TEXT:&amp;lt;[[wildcards|matchtext]]&amp;gt;:&amp;lt;*&amp;gt;&amp;lt;?&amp;gt;&amp;lt;#[,#]&amp;gt;:&amp;lt;commands&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matchtext can be a [[If-Then-Else#The_Operators|wildcard]] match or even a [[Regular_Expression|regular expression]]. &lt;br /&gt;
To use regular expressions as matchtext, you need the [[Access_Levels|$-Prefix]].&lt;br /&gt;
&lt;br /&gt;
Read [[Access_Levels|access levels]] to get more info about the &amp;lt;level&amp;gt; field.&lt;br /&gt;
&lt;br /&gt;
Read [[wildcards]] to get more information about how to use matchtext to match unknown words, words that may change.&lt;br /&gt;
&lt;br /&gt;
The location where this event occurrs can be either any channel (#), a certain channel (#channel), a query (?) or all (*).&lt;br /&gt;
&lt;br /&gt;
You can also use variables and identifiers as matchtext and location parameter. See below for examples.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you  can&#039;t test out these events by typing text to yourself. To test them, use another connection, that you can establish via [[Server|/server]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that mIRC iterates the triggers in the script files one by one, and when a trigger is catched, other triggers &#039;&#039;in the same script file&#039;&#039; will not be triggered. A &amp;quot;catch-all&amp;quot; trigger (a trigger which catches all events, marked with matchtext of *) should be placed last of the &amp;quot;on TEXT&amp;quot; triggers in the script file. See also [[Why doesnt my text event work]].&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
 On *:Text:*moo*:#: { [[echo]] -a [[$nick]] just said moo in [[$chan]] [[DollarPlus|$+]] . }&lt;br /&gt;
This will echo &amp;quot;&amp;lt;nick&amp;gt; just said moo in &amp;lt;channel&amp;gt;.&amp;quot;, when someone has said a sentence with &amp;quot;moo&amp;quot; in it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 On *:Text:*:?: { echo -a $nick just said in query: $1- }&lt;br /&gt;
This will echo everything someone said to you in query in your active window, as $1- refers to the entire text that was said to you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 On *:Text:%mymatchtext:%mychannels: { [[beep]] }&lt;br /&gt;
The value of %mymatchtext will be matched against whatever text the user sends, and the value of %mychannels will be matched against the channel to which the message was sent. If both matched, it will beep.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get identifiers evaluated in the matchtext, you need to use a special identifier [[$(...)]]. If you use this identifier in the matchtext, you can&#039;t have anything else outside this identifier in the matchtext.&lt;br /&gt;
 On *:Text:$([[$me]]):#: { beep }&lt;br /&gt;
This beeps when someone says your nick (but nothing else than your nick) in any channel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can also combine identifiers and variables inside the $(...) identifier.&lt;br /&gt;
 On *:Text:[[$(...)|$]]([[DollarPlus|$+]](*,$me,*)):?: { echo -a $nick mentioned your nick in a query. }&lt;br /&gt;
This triggers when someone says any line containing your nick in a query. The matchtext is basically *$me*, but in order to get that $me evaluated to your current nick, you need to use the $(...) identifier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 On $*:Text:/\s200\d\s/:#: { echo -a $nick just mentioned some year in channel $chan $+ ! }&lt;br /&gt;
This is a regular expression match. It triggers when someone mentions a year between 2000-2009 in any channel. mIRC syntax requires the //&#039;s around the expression.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[if|if-statements]] to make more restrictions.&lt;br /&gt;
* [[On_input|On Input]] to trigger to your own text.&lt;br /&gt;
* [[Wildcards]] for information on using * and ? in matchtext&lt;br /&gt;
* [[Why doesnt my text event work]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Events]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5756</id>
		<title>How to start</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_start&amp;diff=5756"/>
		<updated>2012-03-02T19:57:20Z</updated>

		<summary type="html">&lt;p&gt;NaNg: checkmark button for updated mIRC ver.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is supposed to give an introduction into scripting in mIRC. It will explain the so-called &#039;&#039;Scripts-Editor&#039;&#039; and its functions, followed by a little example. At the end it will give some hints about how to debug a script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Remote Editor ==&lt;br /&gt;
&lt;br /&gt;
If you want to begin to script in mIRC, you need to open the Script-Editor. You can do it in two ways: pressing &amp;quot;Alt + R&amp;quot; or with mIRC&#039;s menubar (Tools -&amp;gt; Scripts Editor).&lt;br /&gt;
&lt;br /&gt;
If you are using a premade script (for example nnscript), you will probably see a lot of code. Note that it is difficult to implement own scripts in such a premade one, as your code may interfere with the existing code (if you want to change mIRC&#039;s default output for example). &lt;br /&gt;
&lt;br /&gt;
At first, you should open a &#039;&#039;&#039;new remote file&#039;&#039;&#039;. To do it, click on File -&amp;gt; New (see picture below).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Newfile.png]]&lt;br /&gt;
&lt;br /&gt;
Note that your script files will be saved once you press &amp;quot;Ok&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The next part is about the five different tabs of mIRC&#039;s Scripts Editor:&lt;br /&gt;
&lt;br /&gt;
[[Image:scriptseditortabs.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Aliases-Tab === &lt;br /&gt;
&lt;br /&gt;
Basically, you do not need to use aliases.ini (that you can edit using this tab). Usually, if you want to add a new alias, it would look like:&lt;br /&gt;
&lt;br /&gt;
 [[alias]] moo { [[return]] moo }&lt;br /&gt;
&lt;br /&gt;
in your &#039;Remote-Section&#039; of the editor (the one that&#039;s active after pressing Alt + R).&lt;br /&gt;
&lt;br /&gt;
You can add the same alias in your Aliases-Section:&lt;br /&gt;
&lt;br /&gt;
 moo { return moo }&lt;br /&gt;
&lt;br /&gt;
Notice that you don&#039;t need to write &#039;alias&#039; infront of the new alias if it&#039;s in the Aliases section and note that you cannot add events in this section.&lt;br /&gt;
&lt;br /&gt;
=== Popups-Tab ===&lt;br /&gt;
&lt;br /&gt;
Again you do not need to use this section. It&#039;s the same as using the [[Popup_Menus#MENU_prefix|menus]] alias in the remote section. Usually, there will be some menus added in this section (for example your nicklist-menu).&lt;br /&gt;
&lt;br /&gt;
[[Image:Popupsview.png]]&lt;br /&gt;
&lt;br /&gt;
=== Remote-Tab ===&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;maintab&amp;quot;. Every script is supposed to be saved in here.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you should not have two same events in one file, as only the first matching one will be triggered. Two separate examples:&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
 &lt;br /&gt;
 ; will never be triggered&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
&lt;br /&gt;
 ; will be triggered for level 10&lt;br /&gt;
 on 10:Text:*:*: { echo maa }&lt;br /&gt;
 &lt;br /&gt;
 ; will be triggered for all but level 10&lt;br /&gt;
 on *:Text:*:*: { echo moo }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So if you aren&#039;t sure whether it will work or not, just use another (a new) file (look the image below to see how to make a new file). &lt;br /&gt;
&lt;br /&gt;
The following script will trigger on every &amp;quot;!moo&amp;quot; in every channel and response with &amp;quot;moo00oo00&amp;quot;:&lt;br /&gt;
 &lt;br /&gt;
 [[On_text|on *:TEXT]]:!moo:#: {&lt;br /&gt;
  [[msg]] [[$chan]] moo00oo00&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This would look like:&lt;br /&gt;
&lt;br /&gt;
[[Image:Firstscript.png]]&lt;br /&gt;
&lt;br /&gt;
If you are scripting something more complex, you want to use the check-mark button (or &amp;quot;{}&amp;quot;-button in older mIRC versions) in the upper right corner (see below). That button is used to check for bracket mis-matches in the scriptfile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracket-button.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve pressed it and nothing happended, everything is ok (note that it doesn&#039;t mean that your scripts will work, just that there are no obvious bracket mistakes (mIRC just counts the open and closed brackets)). If something&#039;s wrong, you will get the following popup:&lt;br /&gt;
&lt;br /&gt;
[[Image:Bracketerror.png]]&lt;br /&gt;
&lt;br /&gt;
Even if it says that the bracket error is &#039;&#039;around&#039;&#039; line 1, it could be almost anywhere. Start you search from that line and look at the indentations to find out where you&#039;re missing a bracket.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The remote tab contains scripts that are triggered by events, such as [[On text|when someone speaks]] or [[On join|when someone joins a channel]]. For example, the following &#039;remote script&#039; would tell user&#039;s who join a channel hello!&lt;br /&gt;
&lt;br /&gt;
  [[On join|on *:JOIN]]:#: {&lt;br /&gt;
    [[msg]] [[$nick]] Hello. Welcome to [[$chan]] [[DollarPlus|$+]] !!! &lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
If you would like to learn scripting, you should familiarize yourself with this tab. &lt;br /&gt;
You should also learn [[:Category:Events|event names]] and understand how to run commands, such as the [[msg]] command above which messages a channel or nick name.  You should also learn what [[:Category:Remote Identifiers|identifiers]] are and how to use them.  An example of an identifier in the above script is [[$nick]] and [[$chan]] which tell us the user&#039;s nick name and the channel&#039;s name.&lt;br /&gt;
You may click on any blue hyperlink for more information about a a command or identifier that you see in any of this wiki&#039;s examples.  Please use the examples and test them, to try and understand what they do.  Keep in mind, mIRC is a high level language and almost everything sounds like it is.  For example, if you want to know when someone quites you would use the [[on quit]] event!  One of the most common script events used is the [[on text]] event, which triggers when someone speaks either in a channel or a private message.&lt;br /&gt;
If you are interested in these events, you should move on to [[How to start (part 2)|part 2]] of this introduction.&lt;br /&gt;
&lt;br /&gt;
=== Users-Tab ===&lt;br /&gt;
&lt;br /&gt;
In this file your userlist is saved. You don&#039;t need to edit it manually, as there are commands to do it. See [[Access_Levels|access levels in general]], [[auser]], [[guser]] and [[ruser]].&lt;br /&gt;
&lt;br /&gt;
=== Variables-Tab ===&lt;br /&gt;
&lt;br /&gt;
All your global variables are saved in here. Again, you don&#039;t need to edit it manually, as you can use [[set]], [[unset]] or [[unsetall]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to debug ==&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve written some lines and you&#039;ve tested it, you will most likely notice, that it doesn&#039;t do what you expect it to do. The next step is to &#039;&#039;&#039;debug&#039;&#039;&#039; your script. At first take a look at your Status Window and check for error messages. If there are any, search for these errors in your script and correct them. If they aren&#039;t any, you should add [[echo]]&#039;s in your script to see where it stops to work. For example:&lt;br /&gt;
&lt;br /&gt;
 on *:TEXT:*:*: {&lt;br /&gt;
  if (%moo) { echo -a we are here }&lt;br /&gt;
  elseif (%moo2) { echo -a we are here 2 } &lt;br /&gt;
  echo -a after the if clauses&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
With this method, you can see exactly where it stops to work and correct this part.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; You cannot trigger on text, on notice, on action... events by yourself, you will need someone&#039;s help or another client or multiserver (/[[server]] -m ...) to test them.&lt;br /&gt;
&lt;br /&gt;
If some of the built-in commands don&#039;t work, ie. /kick, /away ... etc. you might have a custom alias that overrides them, you can test it with /!command, ie. /!kick #channel nick.&lt;br /&gt;
/!command will use the default mIRC command and bypass any custom aliases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For more info on debugging, see [[Debugging (Find The Bug)]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to start (part 2)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
&amp;lt;!--// noob //--&amp;gt;&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=On_text&amp;diff=5754</id>
		<title>On text</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=On_text&amp;diff=5754"/>
		<updated>2011-08-08T19:53:46Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Trigger iterations and catch-all&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The on TEXT event triggers when you receive private and/or channel messages.&lt;br /&gt;
 on &amp;lt;level&amp;gt;:TEXT:&amp;lt;[[wildcards|matchtext]]&amp;gt;:&amp;lt;*&amp;gt;&amp;lt;?&amp;gt;&amp;lt;#[,#]&amp;gt;:&amp;lt;commands&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matchtext can be a [[If-Then-Else#The_Operators|wildcard]] match or even a [[Regular_Expression|regular expression]]. &lt;br /&gt;
To use regular expressions as matchtext, you need the [[Access_Levels|$-Prefix]].&lt;br /&gt;
&lt;br /&gt;
Read [[Access_Levels|access levels]] to get more info about the &amp;lt;level&amp;gt; field.&lt;br /&gt;
&lt;br /&gt;
Read [[wildcards]] to get more information about how to use matchtext to match unknown words, words that may change.&lt;br /&gt;
&lt;br /&gt;
The location where this event occurrs can be either any channel (#), a certain channel (#channel), a query (?) or all (*).&lt;br /&gt;
&lt;br /&gt;
You can also use variables and identifiers as matchtext and location parameter. See below for examples.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that you  can&#039;t test out these events by typing text to yourself. To test them, use another connection, that you can establish via [[Server|/server]].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that mIRC iterates the triggers in the script files one by one, and when a trigger is catched, other triggers &#039;&#039;in the same script file&#039;&#039; will not be triggered. A &amp;quot;catch-all&amp;quot; trigger (a trigger which catches all events, marked with matchtext of *) should be placed last of the &amp;quot;on TEXT&amp;quot; triggers in the script file.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
 On *:Text:*moo*:#: { [[echo]] -a [[$nick]] just said moo in [[$chan]] [[DollarPlus|$+]] . }&lt;br /&gt;
This will echo &amp;quot;&amp;lt;nick&amp;gt; just said moo in &amp;lt;channel&amp;gt;.&amp;quot;, when someone has said a sentence with &amp;quot;moo&amp;quot; in it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 On *:Text:*:?: { echo -a $nick just said in query: $1- }&lt;br /&gt;
This will echo everything someone said to you in query in your active window, as $1- refers to the entire text that was said to you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 On *:Text:%mymatchtext:%mychannels: { [[beep]] }&lt;br /&gt;
The value of %mymatchtext will be matched against whatever text the user sends, and the value of %mychannels will be matched against the channel to which the message was sent. If both matched, it will beep.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get identifiers evaluated in the matchtext, you need to use a special identifier [[$(...)]]. If you use this identifier in the matchtext, you can&#039;t have anything else outside this identifier in the matchtext.&lt;br /&gt;
 On *:Text:$([[$me]]):#: { beep }&lt;br /&gt;
This beeps when someone says your nick (but nothing else than your nick) in any channel.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can also combine identifiers and variables inside the $(...) identifier.&lt;br /&gt;
 On *:Text:[[$(...)|$]]([[DollarPlus|$+]](*,$me,*)):?: { echo -a $nick mentioned your nick in a query. }&lt;br /&gt;
This triggers when someone says any line containing your nick in a query. The matchtext is basically *$me*, but in order to get that $me evaluated to your current nick, you need to use the $(...) identifier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 On $*:Text:/\s200\d\s/:#: { echo -a $nick just mentioned some year in channel $chan $+ ! }&lt;br /&gt;
This is a regular expression match. It triggers when someone mentions a year between 2000-2009 in any channel. mIRC syntax requires the //&#039;s around the expression.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[if|if-statements]] to make more restrictions.&lt;br /&gt;
* [[On_input|On Input]] to trigger to your own text.&lt;br /&gt;
* [[Wildcards]] for information on using * and ? in matchtext&lt;br /&gt;
&lt;br /&gt;
[[Category:Events]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$hash&amp;diff=5750</id>
		<title>$hash</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$hash&amp;diff=5750"/>
		<updated>2011-06-17T21:57:29Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Created page with &amp;quot;Returns a hash number based on the number of bits used to calculate it.  $hash(text,B)  Where &amp;#039;&amp;#039;&amp;#039;B&amp;#039;&amp;#039;&amp;#039; is a number between 2 and 32.  === Examples ===   $hash(hello world, 2)     ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Returns a hash number based on the number of bits used to calculate it.&lt;br /&gt;
 $hash(text,B)&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;&#039;B&#039;&#039;&#039; is a number between 2 and 32.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
 $hash(hello world, 2)       returns 0&lt;br /&gt;
&lt;br /&gt;
 $hash(hello world, 32)      returns 4290291456&lt;br /&gt;
&lt;br /&gt;
[[Category:Other Identifiers]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Strip&amp;diff=5749</id>
		<title>Strip</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Strip&amp;diff=5749"/>
		<updated>2011-06-17T21:47:35Z</updated>

		<summary type="html">&lt;p&gt;NaNg: fixed non-flagged command&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Adjusts stripping options in the Options dialog.&lt;br /&gt;
 /strip [+-burc]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Stripping is client-side and on the incoming direction. This setting will not strip output messages.&lt;br /&gt;
&lt;br /&gt;
=== Switches ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;bur&#039;&#039;&#039; - turns on/off bold, underline, reverse and Italic color code stripping (can&#039;t be set separately).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;c&#039;&#039;&#039; - turns on/off color stripping&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
 /strip +bur-c         Turns on bold, underline and reverse stripping, and disables color stripping.&lt;br /&gt;
&lt;br /&gt;
 /strip -burc          Turns off all stripping.&lt;br /&gt;
&lt;br /&gt;
 /strip                Displays current stripping options.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Strip&amp;diff=5748</id>
		<title>Strip</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Strip&amp;diff=5748"/>
		<updated>2011-06-17T21:46:40Z</updated>

		<summary type="html">&lt;p&gt;NaNg: side note&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Adjusts stripping options in the Options dialog.&lt;br /&gt;
 /strip &amp;lt;+-burc&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Stripping is client-side and on the incoming direction. This setting will not strip output messages.&lt;br /&gt;
&lt;br /&gt;
=== Switches ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;bur&#039;&#039;&#039; - turns on/off bold, underline, reverse and Italic color code stripping (can&#039;t be set separately).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;c&#039;&#039;&#039; - turns on/off color stripping&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
 /strip +bur-c         Turns on bold, underline and reverse stripping, and disables color stripping.&lt;br /&gt;
&lt;br /&gt;
 /strip -burc          Turns off all stripping.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Strip&amp;diff=5747</id>
		<title>Strip</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Strip&amp;diff=5747"/>
		<updated>2011-06-17T21:45:10Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Created page with &amp;quot;Adjusts stripping options in the Options dialog.  /strip &amp;lt;+-burc&amp;gt;  === Switches ===  &amp;#039;&amp;#039;&amp;#039;bur&amp;#039;&amp;#039;&amp;#039; - turns on/off bold, underline, reverse and Italic color code stripping (can&amp;#039;t be s...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Adjusts stripping options in the Options dialog.&lt;br /&gt;
 /strip &amp;lt;+-burc&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Switches ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;bur&#039;&#039;&#039; - turns on/off bold, underline, reverse and Italic color code stripping (can&#039;t be set separately).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;c&#039;&#039;&#039; - turns on/off color stripping&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
 /strip +bur-c         Turns on bold, underline and reverse stripping, and disables color stripping.&lt;br /&gt;
&lt;br /&gt;
 /strip -burc          Turns off all stripping.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Renwin&amp;diff=5746</id>
		<title>Renwin</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Renwin&amp;diff=5746"/>
		<updated>2011-06-17T21:37:12Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Created page with &amp;quot;Renames an existing window, and allows an optional topic to be set.  /renwin &amp;lt;@oldname&amp;gt; &amp;lt;@newname&amp;gt; [topic]  Category:Commands&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Renames an existing window, and allows an optional topic to be set.&lt;br /&gt;
 /renwin &amp;lt;@oldname&amp;gt; &amp;lt;@newname&amp;gt; [topic]&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Playctrl&amp;diff=5745</id>
		<title>Playctrl</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Playctrl&amp;diff=5745"/>
		<updated>2011-06-17T21:35:04Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Created page with &amp;quot;Displays the play central dialog.  /playctrl  Category:Commands&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Displays the play central dialog.&lt;br /&gt;
 /playctrl&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=Showmirc&amp;diff=5744</id>
		<title>Showmirc</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=Showmirc&amp;diff=5744"/>
		<updated>2011-06-17T21:33:06Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Created page with &amp;quot;Manipulates the display of the main mIRC window.  /showmirc &amp;lt;-mnrstxoplf&amp;gt;  === Switches ===  &amp;#039;&amp;#039;&amp;#039;-n&amp;#039;&amp;#039;&amp;#039; - &amp;#039;&amp;#039;minimize&amp;#039;&amp;#039; - minimizes the main mIRC window.  &amp;#039;&amp;#039;&amp;#039;-r&amp;#039;&amp;#039;&amp;#039; - &amp;#039;&amp;#039;restore&amp;#039;&amp;#039;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Manipulates the display of the main [[mIRC]] window.&lt;br /&gt;
 /showmirc &amp;lt;-mnrstxoplf&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Switches ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-n&#039;&#039;&#039; - &#039;&#039;minimize&#039;&#039; - minimizes the main mIRC window.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-r&#039;&#039;&#039; - &#039;&#039;restore&#039;&#039; - restores the main mIRC window to its original size.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-s&#039;&#039;&#039; - &#039;&#039;show&#039;&#039; - brings the main mIRC window to the front.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-t&#039;&#039;&#039; - &#039;&#039;tray&#039;&#039; - minimizes the main mIRC window to the tray.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-x&#039;&#039;&#039; - &#039;&#039;maximize&#039;&#039; - maximizes the main mIRC window.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-o&#039;&#039;&#039; - &#039;&#039;on top&#039;&#039; - makes the main mIRC window always on top.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-p&#039;&#039;&#039; - &#039;&#039;not on top&#039;&#039; - stops main mIRC window from being always on top.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-m&#039;&#039;&#039; - &#039;&#039;minimize according to tray settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-f&#039;&#039;&#039; - &#039;&#039;full screen&#039;&#039; - makes main mIRC window on full screen.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;-l&#039;&#039;&#039; - &#039;&#039;lock&#039;&#039; - can be used with the -nt switches to prevent mIRC from being restored without a password which is being set upon locking.&lt;br /&gt;
&lt;br /&gt;
[[Category:Commands]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5742</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=5742"/>
		<updated>2011-06-11T19:19:59Z</updated>

		<summary type="html">&lt;p&gt;NaNg: /* See also */ fixed grammer&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;
   ; If the input is not for the Source Rcon window, ignore it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$|$]]([[DollarPlus|$+]](%, srcon.id., %srcon.socket), 2) == [[$null]]) { [[return]] }&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 RCON an HL1 engine based server]]&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
* [[How to parse HL log data]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/Source_RCON_Protocol Source RCON Protocol on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_parse_HL_log_data&amp;diff=5741</id>
		<title>How to parse HL log data</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_parse_HL_log_data&amp;diff=5741"/>
		<updated>2011-06-11T19:19:51Z</updated>

		<summary type="html">&lt;p&gt;NaNg: /* See also */ fixed grammer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; HL Log Listener snippet by NaNg&lt;br /&gt;
 ; Date: 11-06-2011&lt;br /&gt;
 ; Tested on mIRC 7.19&lt;br /&gt;
 ;&lt;br /&gt;
 ; HL Log window for HL log based engines (HL1, Source etc.),&lt;br /&gt;
 ; Based on the HL Log Standard found at http://developer.valvesoftware.com/wiki/HL_Log_Standard&lt;br /&gt;
 ;&lt;br /&gt;
 ; ==================== NOTE! ====================&lt;br /&gt;
 ; This does NOT query the server to start logging, this should be done on your end, by sending&lt;br /&gt;
 ; this command to the server:&lt;br /&gt;
 ;   logaddress_add &amp;lt;listening_ip&amp;gt; &amp;lt;listening_port&amp;gt;&lt;br /&gt;
 ; &amp;lt;listening_port&amp;gt; should be the same in this command as well as in the /hllog command.&lt;br /&gt;
 ;&lt;br /&gt;
 ; This snippet was built based on CS (1.6) logs, therefore only two team colors exist (besides default).&lt;br /&gt;
 ; You can easly add more team colors by adding them to the $hllog.teamcolor alias found here.&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /hllog &amp;lt;ip&amp;gt; &amp;lt;port&amp;gt; &amp;lt;listening_port&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] hllog {&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]] !isnum 1-65536)) {&lt;br /&gt;
     [[echo]] -ag hllog: 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 HL log window for the same server already.&lt;br /&gt;
   ; This makes sure that the user won&#039;t have a log step over another log for the same server.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$window_(remote)|$window(]]%server.addr)) {&lt;br /&gt;
     [[echo]] -ag HL log window for %server.addr is already open! close it before trying.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Open the HL log window whilst activating it, hide the @ prefix and maximize it.&lt;br /&gt;
   window -ak0x @ [[DollarPlus|$+]] %server.addr&lt;br /&gt;
   [[aline]] 12 @ [[DollarPlus|$+]] %server.addr HL log window, now listening to: %server.addr&lt;br /&gt;
 &lt;br /&gt;
   ; Set the socket name we&#039;ll use.&lt;br /&gt;
   [[Local_Variables|var]] %sockname = [[DollarPlus|$+]]($hllog.prefix, %server.addr)&lt;br /&gt;
 &lt;br /&gt;
   ; Start listening to HL logs from the server.&lt;br /&gt;
   [[sockudp]] -k %sockname [[$1-|$3]] [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Parses the given player.&lt;br /&gt;
 [[alias]] hlplayer {&lt;br /&gt;
   [[If-Then-Else|if]] (![[$regex]]([[$1-|$1-]], /&amp;quot;(.*?)&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;lt;([^&amp;gt;]*)&amp;gt;&amp;quot;/)) {&lt;br /&gt;
     [[echo]] -ag hlpalyer: Invalid parameters.&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$prop]] == name) { [[return]] [[$regml]](1) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == id) { [[return]] [[$regml]](2) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == authid) { [[return]] [[$regml]](3) }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$prop]] == team) { [[return]] [[$regml]](4) }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] [[$true]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Gets the given property&#039;s value.&lt;br /&gt;
 [[alias]] -l hllog.prop {&lt;br /&gt;
   ; Number of keys is requested.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$]][[$1-|2]] == 0) {&lt;br /&gt;
     [[return]] [[$regex]]([[$1-|$1]], /\((\S+)(?: &amp;quot;([^&amp;quot;]*)&amp;quot;|())\)/g)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[If-Then-Else|if]] ([[$regex]]([[$1-|$1]], /\(( [[DollarPlus|$+]] [[$1-|$2]] [[DollarPlus|$+]] )(?: &amp;quot;([^&amp;quot;]*)&amp;quot;|())\)/i)) {&lt;br /&gt;
     [[return]] [[$iif]]([[$regml]](2) == [[$null]], [[$true]], [[$ifmatch]])&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[return]] [[$null]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Get the team&#039;s corresponding color.&lt;br /&gt;
 [[alias]] -l hllog.teamcolor {&lt;br /&gt;
   [[If-Then-Else|if]] ([[$1-|$1]] == CT) { [[return]] 12 }&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$1-|$1]] == TERRORIST) { [[return]] 04 }&lt;br /&gt;
 &lt;br /&gt;
   ; Default color if team is not recognized.&lt;br /&gt;
   [[return]] 14&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l hllog.prefix { [[return]] hllog }&lt;br /&gt;
 &lt;br /&gt;
 ; If the user has closed the HL log window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]]([[DollarPlus|$+]]($hllog.prefix, [[$remove]]($target, @)))) {&lt;br /&gt;
     [[sockclose]] [[DollarPlus|$+]]($hllog.prefix, [[$remove]]($target, @))&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 on *:UDPREAD:$([[DollarPlus|$+]]($hllog.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %hllog.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $hllog.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 %hllog.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   [[Sockread|sockread]] -f %hllog.value&lt;br /&gt;
 &lt;br /&gt;
   ; Separate the server log time and the log line itself.&lt;br /&gt;
   [[noop]] [[$regex]](%hllog.value, /log L ((?:0[1-9]|1[0-2])/(?:0[1-9]|[12][0-9]|3[01])/[0-9]{4} - (?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]): (.*)[\n\r\0]*$/)&lt;br /&gt;
 &lt;br /&gt;
   ; Invalid log line.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$regml]](0) == 0) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; Get the server log time (usually un-needed. if you do need it - uncomment the next line).&lt;br /&gt;
   ; var %hllog.time = $regml(1)&lt;br /&gt;
   [[Local_Variables|var]] %hllog.cmd = [[$regml]](2)&lt;br /&gt;
 &lt;br /&gt;
   ; If the command is a comment, disregard it.&lt;br /&gt;
   [[If-Then-Else|if]] (//* iswm %hllog.cmd) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; Server cvar change (event 001b).&lt;br /&gt;
   [[If-Then-Else|elseif]] (server cvar* iswm %hllog.cmd) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^Server cvar &amp;quot;([^&amp;quot;]+)&amp;quot; = &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; If the line was succesfully parsed.&lt;br /&gt;
     [[If-Then-Else|if]] ([[$regml]](0) &amp;gt; 0) {&lt;br /&gt;
       [[Local_Variables|var]] %cvar.name = [[$regml]](1)&lt;br /&gt;
       [[Local_Variables|var]] %cvar.value = [[$regml]](2)&lt;br /&gt;
       ; var %hllog.props = $regml(3)&lt;br /&gt;
 &lt;br /&gt;
       [[aline]] 3 %hllog.window Cvar &amp;quot; [[DollarPlus|$+]] %cvar.name [[DollarPlus|$+]] &amp;quot; has been changed, new value: &amp;quot; [[DollarPlus|$+]] %cvar.value [[DollarPlus|$+]] &amp;quot;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Rcon (events 004a and 004b).&lt;br /&gt;
   [[If-Then-Else|elseif]] ((Bad Rcon:* iswm %hllog.cmd) || (Rcon:* iswm %hllog.cmd)) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^(Bad )?Rcon: &amp;quot;[^&amp;quot;]+ ([^&amp;quot;]+) &amp;quot;([^&amp;quot;]+)&amp;quot; (.*)&amp;quot; [^&amp;quot;\x28]+ &amp;quot;([^&amp;quot;]+:[^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; Parse the event&#039;s details.&lt;br /&gt;
     [[Local_Variables|var]] %hllog.badrcon = [[$iif]]([[$regml]](1) == [[$null]], $false, [[$true]])&lt;br /&gt;
     ; var %hllog.challenge = $regml(2)&lt;br /&gt;
     ; var %hllog.rconpwd = $regml(3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.rconcmd = [[$regml]](4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.sender = [[$regml]](5)&lt;br /&gt;
     ; var %hllog.props = $regml(6)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 4 %hllog.window [[$iif]](%hllog.badrcon, Bad) RCON: %hllog.rconcmd (from: %hllog.sender [[DollarPlus|$+]] )&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Player got kicked (event 052b).&lt;br /&gt;
   [[If-Then-Else|elseif]] (Kick:* iswm %hllog.cmd) {&lt;br /&gt;
     [[noop]] [[$regex]](%hllog.cmd, /^Kick: (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)&lt;br /&gt;
 &lt;br /&gt;
     ; Parse the event&#039;s details.&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     ; var %hllog.noun = $regml(2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.kicker = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 4 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.player).team), $hlplayer(%hllog.player).name, [[$chr]](15)) was kicked by %hllog.kicker with reason: [[DollarPlus|$+]](&amp;quot;, $hllog.prop(%hllog.props, message), &amp;quot;)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Team score report (event 065).&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Team &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.score = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.numPlayers = [[$regml]](5)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](7)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 3 %hllog.window Team [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), %hllog.team, [[$chr]](15)) scored %hllog.score with %hllog.numPlayers players %hllog.props&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Player score report (event 067).&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Player (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.score = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 3 %hllog.window Player [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.player).team), $hlplayer(%hllog.player).name, [[$chr]](15)) scored %hllog.score %hllog.props&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 057, 058, 059, 066.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) (&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) (&amp;quot;[^&amp;quot;]+&amp;quot;)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.firstEvent = [[$regml]](2)&lt;br /&gt;
     ; var %hllog.secondEvent = $regml(4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.firstPlayer = [[$regml]](1)&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.firstEvent == triggered) {&lt;br /&gt;
       [[Local_Variables|var]] %hllog.secondPlayer = [[$regml]](5)&lt;br /&gt;
       [[Local_Variables|var]] %hllog.noun = [[$remove]]([[$regml]](3), &amp;quot;)&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[Local_Variables|var]] %hllog.secondPlayer = [[$regml]](3)&lt;br /&gt;
       [[Local_Variables|var]] %hllog.noun = [[$remove]]([[$regml]](5), &amp;quot;)&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](6)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.firstPlayer).team), $hlplayer(%hllog.firstPlayer).name, [[$chr]](15)) %hllog.firstEvent [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor($hlplayer(%hllog.secondPlayer ).team), $hlplayer(%hllog.secondPlayer ).name, [[$chr]](15)) with: [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) [[$iif]]($hllog.prop(%hllog.props, headshot), (headshot))&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 050, 053, 054, 055, 056, 060, 063a, 063b, 068, 069.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](4)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = $hlplayer(%hllog.player).team&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.event == say) {&lt;br /&gt;
       [[aline]] 7 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) [[DollarPlus|$+]](says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|elseif]] (%hllog.event == say_team) {&lt;br /&gt;
       [[aline]] 7 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) [[DollarPlus|$+]](team says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) %hllog.props&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 050b, 051, 052.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^(&amp;quot;[^&amp;quot;]+&amp;quot;) ([^\x28]+)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.player = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     ; var %hllog.props = $regml(3)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = $hlplayer(%hllog.player).team&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), $hlplayer(%hllog.player).name, [[$chr]](15)) %hllog.event&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 061, 064.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^Team &amp;quot;([^&amp;quot;]+)&amp;quot; ([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/i)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.team = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](3)&lt;br /&gt;
     ; var %hllog.props = $regml(4)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window [[DollarPlus|$+]]([[$chr]](3), $hllog.teamcolor(%hllog.team), %hllog.team, [[$chr]](15)) %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;)&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 062, 003a, 003b, 005, 006.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^([^&amp;quot;\x28]+) &amp;quot;([^&amp;quot;]+)&amp;quot;(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](1)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.noun = [[$regml]](2)&lt;br /&gt;
     [[Local_Variables|var]] %hllog.props = [[$regml]](3)&lt;br /&gt;
 &lt;br /&gt;
     [[If-Then-Else|if]] (%hllog.event == server say) {&lt;br /&gt;
       [[aline]] 7 %hllog.window Server [[DollarPlus|$+]](says:, [[$chr]](3), 1) %hllog.noun&lt;br /&gt;
     }&lt;br /&gt;
     [[If-Then-Else|else]] {&lt;br /&gt;
       [[aline]] 1 %hllog.window %hllog.event [[DollarPlus|$+]](&amp;quot;, [[$replace]](%hllog.noun, _, [[$chr]](32)), &amp;quot;) %hllog.props&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Events 001a, 001c, 002a, 002b.&lt;br /&gt;
   [[If-Then-Else|elseif]] ([[$regex]](%hllog.cmd, /^([^&amp;quot;\x28]+)(.*)$/)) {&lt;br /&gt;
     [[Local_Variables|var]] %hllog.event = [[$regml]](1)&lt;br /&gt;
     ; var %hllog.props = $regml(2)&lt;br /&gt;
 &lt;br /&gt;
     [[aline]] 1 %hllog.window %hllog.event&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
== See also ==&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
* [[How to RCON an HL1 engine based server]]&lt;br /&gt;
* [[How to RCON a source engine based server]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/HL_Log_Standard HL Log Standard on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_query_a_CS_Server&amp;diff=5740</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=5740"/>
		<updated>2011-06-11T19:19:44Z</updated>

		<summary type="html">&lt;p&gt;NaNg: /* See also */ fixed grammer&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 parse HL log data]]&lt;br /&gt;
* [[How to RCON an HL1 engine based server]]&lt;br /&gt;
* [[How to RCON a source engine based server]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/Server_Queries Server Queries on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_HL1_engine_based_server&amp;diff=5739</id>
		<title>How to RCON a HL1 engine based server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_HL1_engine_based_server&amp;diff=5739"/>
		<updated>2011-06-11T19:18:37Z</updated>

		<summary type="html">&lt;p&gt;NaNg: moved How to RCON a HL1 engine based server to How to RCON an HL1 engine based server: Corrected title.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[How to RCON an HL1 engine based server]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_an_HL1_engine_based_server&amp;diff=5738</id>
		<title>How to RCON an HL1 engine based server</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=How_to_RCON_an_HL1_engine_based_server&amp;diff=5738"/>
		<updated>2011-06-11T19:18:37Z</updated>

		<summary type="html">&lt;p&gt;NaNg: moved How to RCON a HL1 engine based server to How to RCON an HL1 engine based server: Corrected title.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; ; HL1 RCON control snippet by NaNg&lt;br /&gt;
 ; Date: 11-06-2011&lt;br /&gt;
 ; Tested on mIRC 7.19&lt;br /&gt;
 ;&lt;br /&gt;
 ; Remote control window for HL1 engine based games (e.g. HL, CS, TF etc.),&lt;br /&gt;
 ; based on the HL1 Rcon Protocol (no source).&lt;br /&gt;
 ;&lt;br /&gt;
 ; Usage:&lt;br /&gt;
 ; * /hlrcon &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 hlrcon.prefix { [[return]] HLRcon }&lt;br /&gt;
 &lt;br /&gt;
 ; Validates arguments and challenges the game server.&lt;br /&gt;
 [[alias]] hlrcon {&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 HL 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|$+]]($hlrcon.prefix, %server.addr)&lt;br /&gt;
 &lt;br /&gt;
   ; Save the Rcon password.&lt;br /&gt;
   [[set]] [[DollarPlus|$+]](%, $hlrcon.prefix, .rconpw., %sockname) [[$1-|$3]]&lt;br /&gt;
 &lt;br /&gt;
   ; Challenge the Rcon.&lt;br /&gt;
   hlrcon.challengercon %sockname [[$1-|$1]] [[$1-|$2]]&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 [[alias]] -l hlrcon.challengercon {&lt;br /&gt;
   ; Construct the challenge request query.&lt;br /&gt;
   [[bset]] &amp;amp;hlrcon.challenge 1 255 255 255 255&lt;br /&gt;
   [[bset]] -t &amp;amp;hlrcon.challenge 5 challenge rcon&lt;br /&gt;
 &lt;br /&gt;
   ; Open the socket and challenge the game server.&lt;br /&gt;
   [[sockudp]] -k [[$$]][[$1-|1-3]] &amp;amp;hlrcon.challenge&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; Read data from the game server.&lt;br /&gt;
 on *:UDPREAD:$([[DollarPlus|$+]]($hlrcon.prefix, *)): {&lt;br /&gt;
   ; Get the window name for the current game server.&lt;br /&gt;
   [[Local_Variables|var]] %hlrcon.window = [[DollarPlus|$+]](@, [[$remove]]([[$sockname]], $hlrcon.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 %hlrcon.window * Error: Reading from socket: [[$sock]]([[$sockname]]).wsmsg&lt;br /&gt;
     [[sockclose]] [[$sockname]]&lt;br /&gt;
     [[return]]&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Read the data packet type.&lt;br /&gt;
   [[Sockread|sockread]] 4 &amp;amp;hlrcon.pckt.type&lt;br /&gt;
 &lt;br /&gt;
   ; Since we are not using it (and we are disregarding longer packets), drop the packet type.&lt;br /&gt;
   [[bunset]] &amp;amp;hlrcon.pckt.type&lt;br /&gt;
 &lt;br /&gt;
   ; Read the rest of the data.&lt;br /&gt;
   [[Sockread|sockread]] 1400 &amp;amp;hlrcon.pckt.data&lt;br /&gt;
   [[Local_Variables|var]] %hlrcon.data = [[$bvar]](&amp;amp;hlrcon.pckt.data, 1, [[$bvar]](&amp;amp;hlrcon.pckt.data, 0)).text&lt;br /&gt;
 &lt;br /&gt;
   ; If Rcon challenge is received, set it.&lt;br /&gt;
   [[If-Then-Else|if]] (challenge rcon* iswm %hlrcon.data) {&lt;br /&gt;
     ; Tokenize the received data to rows.&lt;br /&gt;
     [[tokenize]] [[$asc]]([[$lf]]) %hlrcon.data&lt;br /&gt;
 &lt;br /&gt;
     ; Tokenize the first row to get the challenge.&lt;br /&gt;
     [[tokenize]] 32 [[$1-|$1]]&lt;br /&gt;
 &lt;br /&gt;
     ; Save the challenge.&lt;br /&gt;
     [[set]] [[DollarPlus|$+]](%, $hlrcon.prefix, .challenge., [[$sockname]]) [[$1-|$3]]&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|else]] {&lt;br /&gt;
     ; Ignore the first byte (for non-log responses, the response contains this extra non-sense byte).&lt;br /&gt;
     [[Local_Variables|var]] %hlrcon.data = [[$bvar]](&amp;amp;hlrcon.pckt.data, 2, [[$bvar]](&amp;amp;hlrcon.pckt.data, 0)).text&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Tokenize the received data to rows.&lt;br /&gt;
   [[tokenize]] [[$asc]]([[$lf]]) %hlrcon.data&lt;br /&gt;
 &lt;br /&gt;
   ; Dispose the bvar.&lt;br /&gt;
   [[bunset]] &amp;amp;hlrcon.pckt.data&lt;br /&gt;
 &lt;br /&gt;
   ; Print the given data.&lt;br /&gt;
   [[aline]] %hlrcon.window [[$$|$*]]&lt;br /&gt;
 &lt;br /&gt;
   ; If an error occured, display a friendly message.&lt;br /&gt;
   [[If-Then-Else|if]] (bad challenge* iswm [[$1-|$1]]) {&lt;br /&gt;
     hlrcon.challengercon [[$sockname]] [[$sock]]([[$sockname]]).addr [[$sock]]([[$sockname]]).port&lt;br /&gt;
     [[aline]] 04 %hlrcon.window Bad challenge, requesting a new one. Please try again.&lt;br /&gt;
   }&lt;br /&gt;
   [[If-Then-Else|elseif]] (bad rcon_password* iswm [[$1-|$1]]) {&lt;br /&gt;
     [[aline]] 04 %hlrcon.window Bad Rcon password. Please try again.&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]] %hlrcon.socket = [[DollarPlus|$+]]($hlrcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 &lt;br /&gt;
   ; If the input is not for the HL Rcon window, ignore it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$|$]]([[DollarPlus|$+]](%, $hlrcon.prefix, .rconpw., %hlrcon.socket), 2) == [[$null]]) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; Check if the socket is still alive.&lt;br /&gt;
   [[If-Then-Else|if]] (![[$sock]](%hlrcon.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 command packet and send it to the server.&lt;br /&gt;
   [[bset]] &amp;amp;hlrcon.cmd 1 255 255 255 255&lt;br /&gt;
   [[bset]] -t &amp;amp;hlrcon.cmd 5 rcon [[$$|$]]([[DollarPlus|$+]](%, $hlrcon.prefix, .challenge., %hlrcon.socket), 2) [[DollarPlus|$+]](&amp;quot;, [[$$|$]]([[DollarPlus|$+]](%, $hlrcon.prefix, .rconpw., %hlrcon.socket), 2), &amp;quot;) [[$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;
   [[sockudp]] -k %hlrcon.socket [[$sock]](%hlrcon.socket).saddr [[$sock]](%hlrcon.socket).sport &amp;amp;hlrcon.cmd&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 ; If the user has closed the HL Rcon window, clear the socket.&lt;br /&gt;
 on *:CLOSE:@: {&lt;br /&gt;
   ; Construct the sock name.&lt;br /&gt;
   [[Local_Variables|var]] %hlrcon.socket = [[DollarPlus|$+]]($hlrcon.prefix, [[$remove]]($target, @))&lt;br /&gt;
 &lt;br /&gt;
   ; If the input is not for the HL Rcon window, ignore it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$|$]]([[DollarPlus|$+]](%, $hlrcon.prefix, .rconpw., %hlrcon.socket), 2) == [[$null]]) { [[return]] }&lt;br /&gt;
 &lt;br /&gt;
   ; If there&#039;s a socket named accordingly, close it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$sock]](%hlrcon.socket)) {&lt;br /&gt;
     [[sockclose]] %hlrcon.socket&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   ; Clear any variables set for this socket.&lt;br /&gt;
   [[Unset|unset]] [[$$|$]]([[DollarPlus|$+]](%, $hlrcon.prefix, .*., %hlrcon.socket))&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
* [[How to parse HL log data]]&lt;br /&gt;
* [[How to RCON a source engine based server]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/Server_queries Server Queries on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=How_to_RCON_a_source_engine_based_server&amp;diff=5737</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=5737"/>
		<updated>2011-06-11T18:38:11Z</updated>

		<summary type="html">&lt;p&gt;NaNg: Fixed some stuff to not override other scripts&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;
   ; If the input is not for the Source Rcon window, ignore it.&lt;br /&gt;
   [[If-Then-Else|if]] ([[$$|$]]([[DollarPlus|$+]](%, srcon.id., %srcon.socket), 2) == [[$null]]) { [[return]] }&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 RCON a HL1 engine based server]]&lt;br /&gt;
* [[How to query a CS Server]]&lt;br /&gt;
* [[How to parse HL log data]]&lt;br /&gt;
* [http://developer.valvesoftware.com/wiki/Source_RCON_Protocol Source RCON Protocol on valvesoftware]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Socket]]&lt;/div&gt;</summary>
		<author><name>NaNg</name></author>
	</entry>
</feed>