Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Basic Runescape bot framework [v0.3]

Recommended Posts

  • Administrators
>alias release return 0.3

alias Hermes dialog -md cpanel

alias Botchan return $remove($readini(Hermes.ini,settings,Botchan),$chr(126))

alias c1 return $+($chr(3),14,$1-)

alias c2 return $+($chr(3),$iif($readini(Hermes.ini,settings,Colour),$v1,13),$1-)

alias exploitcheckup if ($regex($1-,/[%$]/)) { return $true }

alias nohtml var %a,%b $regsub($1-,/(]+>)/g,$null,%a) | return %a

alias logo return $+($c2(*ยค*),$c1($+($chr(40),$chr(40))),$c2($1),$c1($+($chr(41),$chr(41))))

alias chstop { var %y $iif($remove($readini(Hermes.ini,settings,noreply),$chr(96),$chr(126)),$v1,#bots) | $iif($istok(%y,$1,32),halt) }

alias botexempt { var %bots Babylon* Vectra* *Runescript *Grandexchange,%n $numtok(%bots,32) 

 while (%n) { var %a $calc($wildtok($1,$gettok(%bots,%n,32),0,32) + %a) | dec %n }

 return %a

}

on *:text:*:*: { if ($hget(aflood,$nick)) { halt }

 $chstop($chan) 

 if ($exploitcheckup($2-)) && ($botexempt($nick) == 0) { /ignore $+(-u,60) $address | .msg $Botchan $logo(Exploit) Detected potential exploit by: $c2($nick) $+($c1([),$c2($address($nick,2)),$c1(])) $c1(on) $c2($chan) $c1(Ignored for) $c2(60) $c1(seconds) $c2($1-) | halt 

 }

 if ($query($nick)) { close -m 

 }

 if ($regex($1,/^[!@~.](rsp|rsplayers)$/Si)) { hadd -mu4 aflood $nick $chan

   var %r $+(rsp.,$right($ticks,5))

   hadd -m %r output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %r runescape.com 80

 }

 elseif ($regex($1,/^[!@~.](rs|runescape)news$/Si)) { hadd -mu4 aflood $nick $chan

   var %rn $+(rsnews.,$right($ticks,5))

   hadd -m %rn output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %rn beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.]name(check)?/Si)) { hadd -mu4 aflood $nick $chan

   var %n $+(ncheck.,$right($ticks,5))

   hadd -m %n output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %n name $replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),$chr(95))

   sockopen %n rscript.org 80

 }

 elseif ($regex($1,/^[!@~.]stats/Si)) { hadd -mu4 aflood $nick $chan

   if ($regex($2-,/[#]/)) { .notice $nick $logo(Hermes) $c1(Possible future additions:) $c2(Highlow) $c1(|) $c2(skills  level) | halt 

   }

   var %st $+(st.,$right($ticks,5))

   hadd -m %st output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick)) 

   hadd %st rsn $iif(!$2,$iif($readini(Default.ini,n,Defname,$address($nick,3)),$v1,$nick),$replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),$chr(95)))

   hadd %st errorout .notice $nick 

   sockopen %st hiscore.runescape.com 80

 }

 elseif ($skill($remove($1,!,@,~,.))) && ($regex($1,/^[!@~.]/Si)) && (!$regex($1,/^[!@~.](defname|defaultname|fml|cookie)/Si)) {  hadd -mu4 aflood $nick $chan

   var %st $+(st.,$right($ticks,5))

   hadd -m %st output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick)) 

   hadd %st rsn $iif(!$wildtok($2-,#*,1,32),$iif(!$2,$iif($readini(Default.ini,n,Defname,$address($nick,3)),$v1,$nick),$replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),$chr(95))), $&

     $iif(!$3,$iif($readini(Default.ini,n,Defname,$address($nick,3)),$v1,$nick),$replace($regsubex($3-,/^(.)/S,$upper(\t)),$chr(32),$chr(95))))

   hadd %st goal $iif(!$wildtok($2-,#*,1,32),no,$iif($remove($wildtok($2-,#*,1,32),$chr(35)) && $v1 isnum 4-99,$v1,99))

   hadd %st errorout .notice $nick 

   hadd %st skill $skill($remove($1,!,@,~,.))

   sockopen %st hiscore.runescape.com 80

 }

 elseif ($regex($1,/^[!@~.](cmb|combat)/Si)) { hadd -mu4 aflood $nick $chan

   var %st $+(st.,$right($ticks,5))

   hadd -m %st output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %st rsn $iif(!$2,$iif($readini(Default.ini,n,Defname,$address($nick,3)),$v1,$nick),$replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),$chr(95)))

   hadd %st errorout .notice $nick 

   hadd %st cmb yes

   sockopen %st hiscore.runescape.com 80

 }

 elseif ($regex($1,/^[!@~.](set|def(ault|ine)?)name/Si)) { hadd -mu4 aflood $nick $chan

   if ($len($2-) 
     writeini default.ini Defname $address($nick,3) %n

     .notice $nick $logo(Defname) $c2(Default username is now $c1($+(%n,.)) $c2(Username associated with address:) $c1($address($nick,3)))

   }

   else { .notice $nick $logo(Error) $c2(Syntax: !defname ) | halt }

 }

 elseif ($regex($1,/^[!@~.](gu|geupdate)$/Si)) { hadd -mu4 aflood $nick $chan  

   var %gu $+(geup.,$right($ticks,5))

   hadd -m %gu output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %gu rscript.org 80

 }

 elseif ($regex($1,/^[!@~.]ge/Si)) { hadd -mu4 aflood $nick $chan | if ($regex($1,geup)) { halt }

   if (!$2) { .notice $nick $logo(GE) $c1(Please specify an item to lookup) | halt 

   }

   var %g $+(ge.,$right($ticks,5)) 

   hadd -m %g item $qt($replace($iif($remove($2,k,m) isnum,$3-,$2-),$chr(32),+))

   hadd %g quan $iif($3 && $remove($2,k,m,t,b) isnum,$regsubex($2,/([\d])([kmbt])/g,\1 $+ $str(000,$pos(kmbt,\2))))

   hadd %g output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %g itemdb-rs.runescape.com 80

 }

 elseif ($regex($1,/^[!@~.]clan/Si)) { hadd -mu4 aflood $nick $chan 

   var %cl $+(clan.,$right($ticks,5))

   hadd -m %cl user $iif(!$2,$iif($readini(Default.ini,n,Defname,$address($nick,3)),$v1,$nick),$replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),$chr(95)))

   hadd %cl output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %cl runehead.com 80

 }

 elseif ($regex($1,/^[!@~.]ml/Si)) { hadd -mu4 aflood $nick $chan 

   if (!$2) { .notice $nick $logo(Memberlist) $c1(Please specify a clan to lookup) | halt }

   var %ml $+(ml.,$right($ticks,5))

   hadd -m %ml clan $replace($2-,$chr(32),$chr(95)))

   hadd %ml output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %ml runehead.com 80

 }

 elseif ($regex($1,/^[!@~.]alog/Si)) { hadd -mu4 aflood $nick $chan 

   var %al $+(alog.,$right($ticks,5))

   hadd -m %al rsn $iif(!$2,$iif($readini(Default.ini,n,Defname,$address($nick,3)),$v1,$nick),$replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),$chr(95)))

   hadd %al output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %al beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.](npc|monster)/Si)) { hadd -mu4 aflood $nick $chan 

   if (!$2) { 

     .notice $nick $logo(Npc) $c1(Correct syntax is:) $c2(!npc ) | halt 

   }

   var %m $+(npcid.,$right($ticks,5))

   hadd -m %m output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %m search $replace($2-,$chr(32),+)

   sockopen %m www.tip.it 80 

 }

 elseif ($regex($1,/^[!@~.]quest/Si)) { hadd -mu4 aflood $nick $chan 

   if (!$2) { 

     .notice $nick $logo(Quest) $c1(Correct syntax is) $c2(!quest ) | halt 

   }

   var %q $+(quest.,$right($ticks,5))

   hadd -m %q output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %q search $replace($2-,$chr(32),+)

   sockopen %q beardbot.netii.net 80  

 }

 elseif ($regex($1,/^[!@~.](item|istats)/Si)) { hadd -mu4 aflood $nick $chan 

   if (!$2) { 

     .notice $nick $logo(Item) $c1(Correct syntax is:) $c2(!item ) | halt 

   }

   var %i $+(item.,$right($ticks,5))

   hadd -m %i output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %i item $replace($2-,$chr(32),+)

   sockopen %i beardbot.netii.net 80  

 }

 elseif ($regex($1,/^[!@~.]alch/Si)) { hadd -mu4 aflood $nick $chan 

   if (!$2) { 

     .notice $nick $logo(Alch) $c1(Correct syntax is:) $c2(!alch ) | halt 

   }

   var %a $+(alch.,$right($ticks,5))

   hadd -m %a output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %a item $replace($2-,$chr(32),+)

   sockopen %a beardbot.netii.net 80  

 }

 elseif ($regex($1,/^[!@~.]track/Si)) { hadd -mu4 aflood $nick $chan 

   if (!$skill($2-)) {

     var %trn $+(tracker.,$right($ticks,5)),%d $iif($readini(Default.ini,n,Defname,$address($nick,3)),$v1,$nick)

     hadd -m %trn nick $iif(!$2,%d,$iif(!$3 && $wildtok($2-,@*,1,32),%d,$2))

     hadd %trn time $duration($iif(!$2 || !$wildtok($2-,@*,1,32),1w,$remove($wildtok($2-,@*,1,32),@))) 

     hadd %trn t $iif(!$2 || !$wildtok($2-,@*,1,32),1w,$remove($wildtok($2-,@*,1,32),@))

     hadd %trn output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

     sockopen %trn rscript.org 80

   }

   elseif ($skill($2-)) { 

     var %sn $+(track.,$right($ticks,5)),%dfn $readini(default.ini,n,Defname,$address($nick,3)),%n $nick,%a $iif($wildtok($2-,@*,1,32),$remove($v1,@),1w)

     if (*secs* iswm $duration(%a)) || ($left(%a,1) !isnum) { .notice $nick $logo(Track) $c2(syntax: [!@.~]track   ) $c1(e.g. !track magic Riffpilgrim @4w) | halt 

     }

     hadd -m %sn nick $iif(!$3 && %dfn,%dfn,$iif(!$3 && !%dfn,%n,$iif(!$4,$iif(@ isin $3,$iif(%dfn,$v1,%n),$3),$3)))

     hadd -m %sn time $duration($iif(!%a,1d,%a))

     hadd -m %sn t $iif(!%a,1w,%a) | hadd %sn skill $skill($2) 

     hadd %sn output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

     sockopen %sn rscript.org 80

   }

 }

 elseif ($regex($1,/^[!@~.]fml$/Si)) { hadd -mu4 aflood $nick $chan

   var %f $+(fml.,$right($ticks,5))

   hadd -m %f output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %f beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.]tfln$/Si)) { hadd -mu4 aflood $nick $chan

   var %tf $+(tfln.,$right($ticks,5))

   hadd -m %tf output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   sockopen %tf beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.]bash/Si)) { hadd -mu4 aflood $nick $chan

   var %b $+(bash.,$right($ticks,5))

   hadd -m %b output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   $iif($2,hadd %b id $remove($2,$chr(35)))

   sockopen %b beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.](urban|ud)/Si)) { hadd -mu4 aflood $nick $chan

   if (!$2) { 

     .notice $nick $logo(Urban) $c1(Please specify a term to lookup) | halt 

   }

   var %u $+(urban.,$right($ticks,5))

   hadd -m %u output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %u word $replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),+)

   sockopen %u beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.]h(alo|3)?/Si)) { hadd -mu4 aflood $nick $chan

   if (!$2) && (!$readini(hermes.ini,ConsoleDefname,$address($nick,3))) { 

     .notice $nick $logo(Halo3) $c1(Please specify a gamertag to lookup) | halt 

   }

   var %h $+(halo.,$right($ticks,5)),%cdn $readini(hermes.ini,ConsoleDefname,$address($nick,3))

   hadd -m %h output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %h user $iif(!$2 && %cdn,%cdn,$replace($regsubex($2-,/^(.)/S,$upper(\t)),$chr(32),+)))

   sockopen %h beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.](xbl|gc)/Si)) { hadd -mu4 aflood $nick $chan

   if (*-d* iswm $2) { var %o $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

     if (!$3) { remini Hermes.ini ConsoleDefname $address($nick,3)

       %o $logo(ConsoleDefname) $c1(Default console name unset) | halt

     }

     var %d on | writeini Hermes.ini ConsoleDefname $address($nick,3) $&

       $remove($replace($regsubex($3-,/^(.)/S,$upper(\t)),$chr(32),+),$,#,%,^,&,*)

     %o $logo(ConsoleDefname) $c2($qt($3-)) $c1(set as default console name)

   }

   if (!$2) && (!$readini(hermes.ini,ConsoleDefname,$address($nick,3))) {  

     .notice $nick $logo(Xbl) $c1(Please specify a gamertag to lookup) | halt 

   }

   var %x $+(xbl.,$right($ticks,5)),%cdn $readini(hermes.ini,ConsoleDefname,$address($nick,3)) 

   hadd -m %x output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %x user $iif(!$2 && %cdn,%cdn,$replace($regsubex($iif(%d,$3-,$2-),/^(.)/S,$upper(\t)),$chr(32),+)))

   sockopen %x beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.](gf|googlefight)/Si)) { hadd -mu4 aflood $nick $chan

   if (!$2) || (!$3) { 

     .notice $nick $logo(Googlefight) $c1(You have to state two words to lookup) | halt 

   }

   var %gf $+(gf.,$right($ticks,5))

   hadd -m %gf output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %gf word1 $2 | hadd %gf word2 $3

   sockopen %gf beardbot.netii.net 80

 }

 elseif ($regex($1,/^[!@~.]version$/Si)) { hadd -mu4 aflood $nick $chan 

   var %v $+(version.,$right($ticks,5))

   hadd -m %v output $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   hadd %v item $replace($2-,$chr(32),+)

   sockopen %v beardbot.netii.net 80  

 }

 elseif ($regex($1,/^[!@~.]calc(ulator)?/Si)) { hadd -mu4 aflood $nick $chan 

   var %r $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick))

   if (!$2) { 

     %r $logo(Calc) $c1(Please state an equation to calculate)

   }

   elseif (!$regex($1-,/[-+*/d]/)) {

     %r $logo(Calc) $c2($2-) $c1(is an invalid equation) 

   }

   else {

     var %e $2-,%x $rp(%e) | %r $logo(Calc) $+($c2(%e),=,$c1($bytes(%x,bd)),$chr(32)) $c2($sn(%x))

   }

 }

 elseif ($regex($1,/^[~]go/Si)) && ($chan == $botchan) { 

   if ($2 == join) {

     .join $3

     $iif(!$chstop($3),.msg $3 $iif($readini(Hermes.ini,settings,invmsg),$c2($remove($v1,$chr(96),$chr(126))),$c1(Runescape Bot Framework "Hermes") $c2(Hello world!)))

     .msg $botchan $logo(Join) Sent by $nick $address($nick,2) to channel $3

   }

   elseif ($2 == part) {

     .part $3

     .msg $botchan $logo(part) $me has left $3 $c2(forced by $nick)

   }

 }

 elseif ($regex($1,/^[~](blacklist|bl)/Si)) && ($chan == $botchan) {

   if ($2 == add) { writeini Hermes.ini Blacklist $3 $3

     .notice $nick $logo(Hermes) Blacklisted $c2($3) $c1(Reason:) $c2($iif($4,$4,no reason)) 

   }

   elseif ($2 == del) { remini Hermes.ini Blacklist $3 $3

     .notice $nick $logo(Hermes) Removed $c2($3) $c1(from blacklist)

   }

 }

 elseif ($regex($1,/^[!@~.](part|gtfo)/Si)) { hadd -mu30 itimer $chan on

   if ($nick isop #) || ($nick ishop #) && ($2 == $me) {

     /part $chan $c1(Requested by) $c2($nick)

     .msg $botchan $logo(Part) $c1(I have parted:) $c2($chan) $c1(Requested by:) $c2($nick) $+($c2([),$c1($address($nick,2)),$c2(]))

   }

 }

 elseif ($regex($1,/^[!@~.](command(s)?|control)$/Si)) { hadd -mu4 aflood $nick $chan

   $iif(!$chan,.msg $nick,$iif($left($1,1) == @,.msg $chan,.notice $nick)) $logo(Commands) $c1(http://hermes.beard-bot.co.uk)

 }

}

on *:sockopen:*: {

 if ($sockerr) {

   .msg $botchan $logo(SocketError) $c2($sockname) $c1($sock($sockname).wsmsg) | hfree $sockname | halt

 }

 var %path,%host beardbot.netii.net,%type $gettok($sockname,1,46)

 if (%type == rsnews) { 

   var %path /parsers/rsnews.php

 }

 elseif (%type == alog) {

   var %path $+(/parsers/alog.php?user=,$hget($sockname,rsn))

 }

 elseif (%type == quest) {

   var %path $+(/parsers/quest.php?s=,$hget($sockname,search))

 }

 elseif (%type == item) {

   var %path $+(/parsers/item.php?i=,$hget($sockname,item))

 }

 elseif (%type == alch) {

   var %path $+(/parsers/alch.php?item=,$hget($sockname,item))

 }

 if (%type == fml) {

   var %path /parsers/fml.php

 }

 elseif (%type == tfln) {

   var %path /parsers/tfln.php?

 }

 elseif (%type == bash) {

   var %path $+(/parsers/bash.php?id=,$hget($sockname,id))

 }

 elseif (%type == urban) {

   var %path $+(/parsers/urban.php?term=,$hget($sockname,word))

 }

 elseif (%type == halo) {

   var %path $+(/parsers/Halo3.php?player=,$hget($sockname,user))

 }

 elseif (%type == xbl) {

   var %path $+(/parsers/xbl.php?tag=,$hget($sockname,user))

 }

 elseif (%type == gf) {

   var %path $+(/parsers/gf.php?&w1=,$hget($sockname,word1),&w2=,$hget($sockname,word2))

 }

 elseif (%type == version) {

   var %path /parsers/version.php

 }

 elseif (%type == rsp) {

   var %path /title.ws,%host runescape.com

 }

 elseif (%type == st) {

   var %path $+(/index_lite.ws?player=,$hget($sockname,rsn)),%host hiscore.runescape.com

 }

 elseif (%type == ge) {

   var %path $+(/results.ws?query=,$hget($sockname,item),&price=all&members=),%host itemdb-rs.runescape.com

 }

 elseif (%type == ge2) {

   var %path $+(/m=itemdb_rs/,$hget($+(ge.,$right($sockname,5)),item),/viewitem.ws?obj=,$hget($sockname,id)),%host services.runescape.com

 }

 elseif (%type == ncheck) {

   var %path $+(/flookup.php?type=namecheck&name=,$hget($Sockname,name)),%host rscript.org

 }

 elseif (%type == geup) {

   var %path /lookup.php?type=geupdate

 }

 elseif (%type == tracker) {

   var %path $+(/flookup.php?type=track&user=,$hget($sockname,nick),&time=,$hget($sockname,time),&skill=all)

 }

 elseif (%type == track) {

   var %path $+(/flookup.php?type=track&user=,$hget($sockname,nick),&time=,$hget($sockname,time),$chr(44),$duration(4w), $&

     &skill=,$iif($hget($sockname,skill) == overall,0,$s2($hget($sockname,skill))))

 }

 elseif (%type == clan) {

   var %path $+(/feeds/lowtech/searchuser.php?user=,$hget($sockname,user),&type=2),%host runehead.com

 }

 elseif (%type == ml) {

   var %path $+(/feeds/lowtech/searchclan.php?search=,$hget($sockname,clan),&type=2)

 }

 elseif (%type == npcid) {

   var %path $+(/runescape/index.php?rs2monster=&orderby=&keywords=,$hget($sockname,search),&levels=All&race=0),%host www.tip.it

 }

 elseif (%type == npc) {

   var %path $+(/runescape/index.php?rs2monster_id=,$hget($sockname,id))

 }

 if ((%host != $null) && (%path != $null)) {

   sockwrite -nt $sockname GET %path HTTP/1.1

   sockwrite -nt $sockname Host: %host

   sockwrite -nt $sockname $crlf

 }

}

on *:sockread:*: { 

 if ($sockerr) {

   .msg $botchan $logo(SocketError) $c2($sockname) $c1($sock($sockname).wsmsg) | hfree $sockname | halt

 }

 if (rsp.* iswm $sockname) { 

   var %r | sockread %r

   if (*There are currently* iswm %r) {

     $hget($sockname,output) $logo(Rsplayers) $nohtml(%r) 

     hfree $sockname

     sockclose $sockname

   }

 }

 elseif (ncheck.* iswm $sockname) {

   var %n | sockread %n

   if (*NAMECHECK:* iswm %n) { 

     $hget($Sockname,output) $logo(Name check) $c2($hget($sockname,name)) $c1(is) $iif(*NOT* iswm %n,$c2(unavailable),$c2(available))

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (ge.* iswm $sockname) {

   var %a | sockread %a

   if (*0 items matched the search term* iswm %a) {

     $hget($sockname,output) $logo(GE) $c1(Your Search For) $c2($qt($hget($sockname,item))) $c1(Was Not Found On The Runescape Grand Exchange Database)

     hfree $sockname | halt

   }

   elseif (*viewitem.ws?obj=* iswm %a) {

     hadd $sockname name $nohtml(%a)

     hadd -m $+(ge2.,$right($sockname,5)) id $gettok($nohtml($gettok(%a,4,61)),1,34)

     var %a | sockread %a

     hadd $sockname midprice $nohtml(%a)

     var %a | sockread %a

     hadd $sockname change $iif(0 isin $nohtml(%a),n/a,$v2)

     sockopen $+(ge2.,$right($sockname,5)) services.runescape.com 80

     sockclose $sockname

   }

 }

 elseif (ge2.* iswm $sockname) {

   var %a | sockread %a

   if (*
     hadd $sockname description %a

     var %a sockread %a

   }

   elseif (*Minimum price:* iswm %a) { 

     hadd $sockname min $gettok($nohtml(%a),3,32)

   }

   elseif (*Maximum price:* iswm %a) { 

     hadd $sockname max $gettok($nohtml(%a),3,32)

   }

   elseif (*30 Days:* iswm %a) {

     hadd $sockname 30d $nohtml(%a)

   }

   elseif (*90 Days:* iswm %a) {

     hadd $sockname 90d $nohtml(%a)

   }

   elseif (*180 Days:* iswm %a) { var %b $+(ge.,$right($sockname,5))

     hadd $sockname 180d $nohtml(%a)

     var %30 $hget($sockname,30d),%90 $hget($sockname,90d),%180 $hget($sockname,180d), $&

       %min $iif($hget(%b,quan),$calc($hget(%b,quan)*$rp($hget($sockname,min))),$hget($sockname,min)),$&

       %mid $iif($hget(%b,quan),$calc($hget(%b,quan)*$rp($hget(%b,midprice))),$hget(%b,midprice)), $&

       %max $iif($hget(%b,quan),$calc($hget(%b,quan)*$rp($hget($sockname,max))),$hget($sockname,max))

     $hget(%b,output) $logo(Ge) $c2($iif($hget(%b,quan),$+($v1,x,$chr(160)))) $+ $c1($hget(%b,name)) $+(03,$iif($hget(%b,quan),$bytes(%min,bd),%min)) $&

       $sn(%min) $c2($iif($hget(%b,quan),$bytes(%mid,bd),%mid))) $sn(%mid) $+(04,$iif($hget(%b,quan),$bytes(%max,bd),%max)) $sn(%max) $c1(Today:) $iif(*-* iswm $hget(%b,change),4 $v2,3 $v2) $&

       $+($c2($chr(40)),$c1($+($gettok(%30,1,58),:)),$iif(*-* iswm $gettok(%30,2,58),$+(4,$v2),$+(3,$v2)) $&

       $c1($+($gettok(%90,1,58),:)),$iif(*-* iswm $gettok(%90,2,58),$+(4,$v2),$+(3,$v2)) $&

       $c1($+($gettok(%180,1,58),:)),$iif(*-* iswm $gettok(%180,2,58),$+(4,$v2),$+(3,$v2)),$c2($chr(41)))

     $hget(%b,output) $logo(Ge) $c1(Description:) $c2($hget($sockname,description)) $c1(Link:) $c2($+(http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj=,$hget($sockname,id)))

     hfree %b | hfree $sockname | sockclose $sockname

   }

 }

 elseif (rsnews.* iswm $sockname) {

   var %r | sockread %r

   if (*Title:* iswm %r) { tokenize 124 %r

     $hget($sockname,output) $logo(RsNews) $c2($qt($remove($1,Title:))) $c1($2) $c2($3) $c1($4)

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (st.* iswm $sockname) { 

   var %s | sockread %s

   if (Page isin %s) { $hget($sockname,errorout) $logo(Stats) $c2(The username) $c1($hget($sockname,rsn)) $c2(was not found in the RuneScape Hiscores.)

     hfree $sockname | sockclose $sockname | halt 

   }

   if (*,*,* iswm %s) { 

     hinc $sockname snum 1 

     tokenize 44 %s

     $iif($hget($sockname,skill) == $s1($hget($sockname,snum)),hadd $sockname skline %s)

     hadd $sockname $gettok($s1($hget($sockname,snum)),1,32) $2

   }

   elseif ($hget($sockname,snum) >= 23) { var %b 1 

     while (%b 
       hadd $sockname statsline $hget($sockname,statsline) $+($c1($gettok($s1(%b),1,32)),$chr(58),$chr(32),$c2($hget($sockname,$gettok($s1(%b),1,32))),$chr(44),$iif(%b 
       $iif($hget($sockname,cmb), hadd $sockname cmbline $hget($sockname,cmbline) $hget($sockname,$gettok($s1(%b),1,32))))

       inc %b

     }

     if ($hget($sockname,skill)) { 

       if (-1 isin $hget($sockname,skline)) { 

         $hget($sockname,output) $logo(Stats) NOU YOU $c2($upper($hget($sockname,rsn))) $c1(FOR NOT BEING RANKED) 

         hfree $sockname | sockclose $sockname | halt 

       }

       var %rank $gettok($hget($sockname,skline),1,44),%lvl $gettok($hget($sockname,skline),2,44),%xp $gettok($hget($sockname,skline),3,44),%next $iif($hget($sockname,goal) != no,$iif($v1 > %lvl,$v1,$calc(%lvl + 1)),$calc(%lvl + 1)),%exptogoal $calc($exp(%lvl)-%xp) 

       $hget($sockname,output) $logo($hget($sockname,skill)) $c1(Level:) $c2(%lvl) $c1(Exp:) $c2($bytes(%xp,bd)) $iif($hget($sockname,skill) != overall,$+($c1($chr(40)),$round($calc($iif(%xp == 0,1,$v1)/$exp(99)*100),1),% $c1(of 99),$chr(41))) $&

         $c1(Rank:) $c2($bytes(%rank,bd)) $iif($hget($sockname,skill) != overall,$c1(Experience to %next) $c2($bytes($calc($exp(%next)-%xp),bd)) $+($c1($chr(40)),$round($calc(%exptogoal / ($exp(%lvl) - $exp(%next))*100),2),% $c1(of %next),$chr(41))) 

       hfree $sockname | sockclose $sockname | halt

     }

     elseif ($hget($sockname,cmb)) { tokenize 32 $hget($sockname,cmbline)

       var %cmbstats $2 $4 $3 $5-8 $25,%cmbstring $replace(%cmbstats,$chr(32),$chr(44))

       $hget($sockname,output) $logo(Combat) $c2($hget($sockname,rsn)) $c1(is level) $c2($cmb( [ $+(%cmbstring,$chr(44),y) ] )) $c1(F2P:) $c2($cmb( [ $+(%cmbstring,f2p) ] )) $c1(ASDHRPM(SU)) $c2(%cmbstats)

       hfree $sockname | sockclose $sockname | halt

     }

     elseif ($hget($sockname,statsline)) { tokenize 44 $hget($sockname,statsline)

       $hget($sockname,output) $logo(Stats) $+($c1([),$c2($hget($sockname,rsn)),$c1(])) $1-13

       $iif($14,$hget($sockname,output) $logo(Stats) $remove($14,$chr(124)) $15-25)

       hfree $sockname | sockclose $sockname

     }

   }

 }

 elseif (geup.* iswm $sockname) { 

   var %ge | sockread %ge

   if (Update isin %ge) {

     $hget($sockname,output) $logo(Geupdate) $c1(The Grand Exchange was last updated:) $c2($duration($calc($ctime - $gettok(%ge,2,58)))) $c1(ago.)

     hfree $sockname

     sockclose $sockname

   }

 }

 elseif (clan.* iswm $sockname) {

   var %c | sockread %c

   if (*@@Not Found* iswm %c) { $hget($sockname,output) $logo(Clan) Your search for $c2($hget($Sockname,user)) $c1(was not found) 

     hfree $sockname | sockclose $sockname | halt

   } 

   if (*http://* iswm %c) {  

     while ($sock($sockname).rq) { 

       if (*@@end* iswm %c) { break 

       }

       hadd $sockname info $remove($hget($sockname,info),@@start) $gettok($v2,1,124)

       var %a %a $v2  

       sockread %c

     }

   }

   if (*@@end* iswm %c) { 

     var %n $calc($numtok(%a,124)-1)

     $hget($sockname,output) $logo(Clan) $c2($hget($sockname,user)) $c1(is in) $c2(%n) $c1(clans) $&

       $c2($replace($hget($sockname,info),$chr(124),$+($chr(58),$chr(32)))) $c1($chr(124) $&

       Link: $+(http://runehead.com/clans/search.php?search=,$replace($hget($sockname,user),_,$+($chr(37),$chr(65),$chr(48)))))

     hfree $sockname | sockclose $sockname 

   }

 }

 elseif (ml.* iswm $sockname) {

   var %m | sockread %m

 }

 if (*@@start* iswm %m) { 

   var %m,%br $c1($chr(124)) | sockread %m

   tokenize 124 %m 

   if (*@@Not Found* iswm $1) { 

     $hget($sockname,output) $logo(Clan Info) $c2($hget($sockname,clan)) $c1(Does not appear to be a valid Runehead memberlist) 

     hfree $sockname | sockclose $sockname | halt 

   }

   else {

     $hget($sockname,output) $logo(Clan Info) $+($c1([),$c2($5),$c1(])) $c2($1) $+($c1($chr(40)),$c2($2),$c1($chr(41))) %br $&

       Members: $c2($6) %br Average: F2P: $c2($16) $c1(P2P:) $c2($7) $c1(HP:) $c2($8) $c1(Mage:) $c2($10) $c1(Range:) $c2($11) $c1(Total:) $c2($9) %br $&

       $c2($12) $c1(based, Homeworld:) $c2($15) %br Cape: $c2($14) %br Category: $c2($4) %br RHlink: $c2($3)

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (alog.* iswm $sockname) {

   var %a | sockread %a

   if (*@@Not found* iswm %a) { $hget($sockname,output) $logo(Alog) $c2($qt($hget($sockname,rsn))) $c1(does not exist)

     hfree $sockname | sockclose $sockname | halt 

   }

   elseif (*@@Non member* iswm %a) { $hget($sockname,output) $logo(Alog) $c2($qt($hget($sockname,rsn))) $c1(Has settings set to private or is a non member)

     hfree $sockname | sockclose $sockname | halt 

   }

   elseif (*ALOG:* iswm %a) {

     while ($sock($sockname).rq) { 

       if (*End@@* iswm %a) { break 

       }

       hadd $sockname info $remove($hget($sockname,info),ALOG:~) $+($gettok($v2,1,64),$chr(126))

       sockread %a

     }

   }

   if (*End@@* iswm %a) { var %b $pos($hget($sockname,info),$chr(126),0)

     $hget($sockname,output) $logo(Alog) $c2($hget($Sockname,rsn)) $c1($replace($remtok($hget($sockname,info),$chr(126),%b,126),$chr(126),$chr(44)))

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (npcid.* iswm $sockname) {

   var %a | sockread %a

   var %b $+(*,$replace($gettok($hget($sockname,search),2-3,43),+,$chr(32)),*),%m2 $+(npc.,$right($sockname,5))

   if ($+(*,[url="?rs2monster_id=*"],%b,[/url],*) iswm %a) {

     hadd -m $sockname monster $remove($gettok(%a,3,62),)

     hadd -m %m2 id $gettok($replace($nohtml($gettok(%a,3,61)),",$chr(32),>,),1,32)

     var %a | sockread %a | hadd $sockname Race $nohtml(%a)

     var %a | sockread %a | hadd $sockname members $nohtml(%a)

     var %a | sockread %a | hadd $sockname Quest $nohtml(%a)

     var %a | sockread %a | hadd $sockname Ratio $nohtml(%a)

     var %a | sockread %a | hadd $sockname HP $nohtml(%a)

     sockopen %m2 www.tip.it 80 

     sockclose $sockname   

   }

   if (** iswm %a) { $hget($sockname,output) $logo(Npc) $c1(Your search for) $c2($replace($hget($sockname,search),+,$chr(32))) $c1(didn't return any results.)

     hfree $sockname | sockclose $sockname | halt 

   }

 }

 elseif (npc.* iswm $sockname) { 

   var %c $+(npcid.,$right($sockname,5)),%a 

   sockread %a

   if (*Level:* iswm %a) { var %a | sockread %a

     hadd $sockname level $nohtml(%a)

   }

   elseif (*Aggressive?* iswm %a) {

     hadd $sockname Aggressive $nohtml(%a)

   }

   elseif (*Retreats?* iswm %a) {

     hadd $sockname Retreats $nohtml(%a)

   }

   elseif (*Poisonous?* iswm %a) {

     hadd $sockname poison $nohtml(%a)

   }

   elseif (*habitat:* iswm %a) { var %a | sockread %a

     hadd $sockname habitat $nohtml(%a) 

     $hget(%c,output) $logo(Npc) $hget(%c,monster) $c2(Lvl:) $c1($hget($sockname,level)) $c2(HP:) $c1($hget(%c,hp)) $c2(Ratio:) $c1($hget(%c,Ratio)) $c2(Race) $c1($hget(%c,race)) $&

       $iif(*yes* iswm $hget($sockname,poison),3Poisonous) $iif(*yes* iswm $hget($sockname,aggressive),4+Aggressive,3Non Aggressive) $iif(*yes* iswm $hget(%c,members),10P2P,12F2P)

     $hget(%c,output) $logo(Npc) $c2(Location:) $c1($hget($sockname,habitat)) $c2(Link:) $c1($+(http://www.tip.it/runescape/index.php?rs2monster_id=,$hget($sockname,id)))

     hfree %c | hfree $sockname | sockclose $sockname 

   }

 }

 elseif (quest.* iswm $sockname) { 

   var %q | sockread %q

   if (*@@Error* iswm %q) { 

     $hget($sockname,output) $logo(Quest) $c1(Quest not found in database)

     hfree $sockname | sockclose $sockname | halt

   }

   elseif (*ID:* iswm %q) {

     hadd $sockname link $c1(Link:) $c2($+(http://www.tip.it/runescape/index.php?rs2quest_id=,$gettok(%q,2,58)))

   }

   elseif (*NAME:* iswm %q) {

     hadd $sockname name $c2($gettok(%q,2,58))

   }

   elseif (*DIFFICULTY:* iswm %q) {

     hadd $sockname difficulty $c1(Difficulty:) $c2($gettok(%q,2,58))   

   }

   elseif (*QP:* iswm %q) {

     hadd $sockname qp $c1(QP) $c2($gettok(%q,2,58))   

   }

   elseif (*REWARD:* iswm %q) {

     $hget($sockname,output) $logo(Quest) $hget($sockname,name) $c1(|) $hget($sockname,difficulty) $c1(|) $hget($sockname,qp) $c1(|) $c2($hget($sockname,link))

     $hget($sockname,output) $logo(Quest Rewards) $gettok(%q,2-,58)

     hfree $sockname | sockclose $sockname | halt

   }

 }

 elseif (item.* iswm $sockname) { 

   var %i | sockread %i

   if (*@@Error* iswm %i) { 

     $hget($sockname,output) $logo(item) $c1(Item not found in database)

     hfree $sockname | sockclose $sockname | halt

   }

   elseif (*ID:* iswm %i) {

     hadd $sockname link $c1(Link:) $c2($+(http://www.tip.it/runescape/index.php?rs2item_id=,$gettok(%i,2,58)))

   }

   elseif (*NAME:* iswm %i) {

     hadd $sockname name $c2($gettok(%i,2,58))

   }

   elseif (*MEMBERS:* iswm %i) {

     hadd $sockname members $c2($iif(*yes* iswm $gettok(%i,2,58),2[M],10[F]))

   }

   elseif (*QUEST:* iswm %i) {

     hadd $sockname quest $iif(*yes* iswm $gettok(%i,2,58),3Quest,4Non-Quest)

   }

   elseif (*TRADE:* iswm %i) {

     hadd $sockname trade $iif(*yes* iswm $gettok(%i,2,58),3Tradeable,4Non-Tradeable)

   }

   elseif (*STACK:* iswm %i) {

     hadd $sockname stack $iif(*yes* iswm $gettok(%i,2,58),3Stacks,4Non-Stackable)

   }

   elseif (*LOCATION:* iswm %i) {

     hadd $sockname location $gettok(%i,2,58)

   }

   elseif (*EQUIP:* iswm %i) { 

     $hget($sockname,output) $logo(Item) $hget($sockname,members) $hget($sockname,name) $c1(|) $hget($sockname,quest) $c1(|) $&

       $hget($sockname,trade) $c1(|) $hget($sockname,stack) $c1(|) $c2($iif(*Equipable* iswm $gettok(%i,2,58),Equipable,Non-Equipable)) $&

       $c1(|) $hget($sockname,location) $c1(||) $hget($Sockname,link)

   }

   if (*@@STATS* iswm %i) {

     if (*None* iswm %i) { hfree $sockname | sockclose $sockname | halt

     }

     elseif (*STAB:* iswm %i) { tokenize 32 %i  

       var %sta $c2($gettok($gettok($2,2,58),1,124)),%std $c2($gettok($gettok($2,2,58),2,124)),%sla $c2($gettok($gettok($3,2,58),1,124)),%sld $c2($gettok($gettok($3,2,58),2,124)), $&

         %cra $c2($gettok($gettok($4,2,58),1,124)),%crd $c2($gettok($gettok($4,2,58),2,124)),%ma $c2($gettok($gettok($5,2,58),1,124)),%md $c2($gettok($gettok($5,2,58),2,124)), $&

         %ra $c2($gettok($gettok($6,2,58),1,124)),%rd $c2($gettok($gettok($6,2,58),2,124))

       $hget($sockname,output) $logo(iStats) Stab: $c1(Att:) %sta $c1(Def:) %std $c1(|) Slash: Att: %sla $c1(Def:) %sld $c1(|) Crush: Att: %cra $c1(Def:) %crd $c1(|) $&

         Magic: Att: %ma $c1(Def:) %md $c1(|) Range: Att: %ra $c1(Def:) %rd $c1(|) Summoning: $c2($gettok($7,2,58)) $c1(|) Strength: $&

         $c2($iif(*shared* iswm $gettok($8,2,58),Shared,$v2)) $c1(|) Prayer: $c2($gettok($9,2,58)) $c1(|) Ranged Strength: $c2($gettok($10,2,58))

       hfree $sockname | sockclose $sockname | halt

     }

   }

 }

 elseif (alch.* iswm $sockname) { 

   var %a | sockread %a

   if (*@@Error* iswm %a) { 

     $hget($sockname,output) $logo(Alch) $c1(Item not found in database)

     hfree $sockname | sockclose $sockname | halt

   }

   if (*NAME:* iswm %a) {

     hadd $sockname name $c2($gettok(%a,2,58))

   }

   elseif (*HIGH:* iswm %a) {

     hadd $sockname high $c2($gettok(%a,2,58))

   }

   elseif (*LOW:* iswm %a) {

     $hget($sockname,output) $logo(Alch) $hget($sockname,name) $c1(High:) $hget($sockname,high) $c1(Low:) $c2($gettok(%a,2,58))

     hfree $sockname | sockclose $sockname | halt

   }

 }

 elseif (tracker.* iswm $sockname) {

   var %t | sockread %t

   if (*END* iswm %t) { $hget($sockname,output) $logo(Track) $c1($hget($sockname,nick)) $c2(Invalid username)

     hfree $sockname | sockclose sockname 

   }

   if (*START* iswm %t) { 

     var %t | sockread %t 

     if (*start:* iswm %t) { 

       while ($sock($sockname).rq) { 

         if (*started:* iswm %t) { break 

         } 

         var %v $replace($v2,:,$chr(32),start,)

         hadd $sockname $+(start.,$gettok(%v,1,32)) $hget($sockname,$+(start.,$gettok(%v,1,32))) $gettok($v2,3,58)

         $iif(*overall* !iswm %t && *fog* !iswm %t && *Bounty* !iswm %t, hinc $sockname $+(start.,total) $lvl($gettok($v2,3,58)))

         sockread %t 

       }

     }

     if (*started:* iswm %t) { 

       var %t | sockread %t 

       if (*gain:* iswm %t) { 

         while ($sock($sockname).rq) { 

           if (*END* iswm %t) { break 

           } 

           var %v $replace($v2,:,$chr(32),gain,)

           hadd $sockname $+(gain.,$gettok(%v,1,32)) $hget($sockname,$+(gain.,$gettok(%v,1,32))) $calc($hget($sockname,$+(start.,$gettok(%v,1,32)))-$gettok($v2,4,58))

           $iif(*overall* !iswm %t && *fog* !iswm %t && *Bounty* !iswm %t,hinc $sockname $+(gain.,total) $lvl($calc($hget($sockname,$+(start.,$gettok(%v,1,32)))-$gettok($v2,4,58))))

           sockread %t 

         }

       }

       if (*END* iswm %t) { 

         var %x 2

         while (%x 
           var %a %a $iif($hget($sockname,$+(start.,$t1(%x))) > $hget($sockname,$+(gain.,$t1(%x))),$c2($t1(%x)) $+($c1($lvl($hget($sockname,$+(gain.,$t1(%x))))),$&

             $iif($lvl($hget($sockname,$+(start.,$t1(%x)))) != $lvl($hget($sockname,$+(gain.,$t1(%x)))),$iif($lvl($hget($sockname,$+(start.,$t1(%x)))) > 0,$+($c2(->),$c1($lvl($hget($sockname,$+(start.,$t1(%x))))))))) $&

             $c2($+(+,$bytes($calc($hget($sockname,$+(start.,$t1(%x)))-$hget($sockname,$+(gain.,$t1(%x)))),bd))) $c2(|))

           inc %x 

         }

         var %os $hget($sockname,$+(start.,total)),%og $hget($sockname,$+(gain.,total)),%o $+(+,$calc(%os - %og))

         $hget($sockname,output) $logo(Track) Exp gains for $c1($hget($sockname,nick)) $c2(in last $hget($sockname,t)) $&

           Overall: %o $c1($bytes($calc($hget($sockname,$+(start.,overall))-$hget($sockname,$+(gain.,overall))),bd)) $gettok(%a,1-8,124)

         $iif($numtok(%a,124) > 8,$hget($sockname,output) $logo(Track) $gettok(%a,9-16,124))

         $iif($numtok(%a,124) > 16,$hget($sockname,output) $logo(Track) $gettok(%a,17-,124))

         $hget($sockname,output) $logo(Graph) $c1($+(http://runetracker.org/track-,$hget($sockname,nick)))

         hfree $sockname | sockclose $sockname

       }   

     }

   } 

 }

 elseif (track.* iswm $sockname) {

   var %r | sockread %r

   if (*Invalid argument* iswm %r) {

     $hget($sockname,output) $logo(Track) $c1($hget($sockname,nick)) $c2(Is an invalid username)

     hfree $sockname | sockclose $sockname

   }

   if (0:* iswm %r) {

     if (-1 isin $gettok(%r,2,58)) { $hget($sockname,return) $logo(Track) $c1($hget($sockname,nick)) $c2(invalid username) | hfree $sockname | sockclose $sockname

     } 

     else {

     hadd $sockname xp $gettok(%r,2,58) }

   }

   if (2419200:* iswm %r) { var %plvl $lvl($calc($hget($sockname,xp) - $gettok(%r,2,58))), %lvl $lvl($hget($sockname,xp))

     hadd $sockname month $bytes($gettok(%r,2,58),bd) $iif($hget($sockname,skill) != overall,$iif(%plvl ,%lvl),%lvl))

   }

   if ($+($hget($sockname,time),:,*) iswm %r) { 

     hadd $sockname Gain $gettok(%r,2,58)

     if ($gettok(%r,2,58) == 0) { $hget($sockname,output) $logo(Track) $c1($hget($sockname,nick)) $c2(has gained no exp in) $&

         $c1($hget($sockname,skill)) $c2(for) $c1($hget($sockname,t)) | hfree $sockname | sockclose $sockname

     }

     var %plvl $lvl($calc($hget($sockname,xp) - $hget($sockname,Gain))),%lvl $lvl($hget($sockname,xp))

     $hget($sockname,output) $logo(Track) $c1($hget($sockname,skill)) $c2(exp achieved by) $c1($hget($sockname,nick)) $&

       $c2(in the last $+($hget($sockname,t),:)) $c1($+(+,$bytes($hget($sockname,Gain),bd)))) $&

       $iif($hget($sockname,skill) != overall,$c2($chr(124)) $c2(lvl:) $c1($iif(%plvl 
     $hget($sockname,output) $logo(Track) $c2(Graph:) $c1($+(http://runetracker.org/track-,$hget($sockname,nick))) $&

       $iif($hget($sockname,month),$c2(||) $c1(Month:) $c2($hget($sockname,month)))

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (fml.* iswm $sockname) { 

   var %f | sockread %f

   if (*Today,* iswm %f) {

     hadd $sockname fml %f

   }

   elseif (*AGREE:* iswm %f) {

     hadd $sockname agree $gettok(%f,2,58)

   }

   elseif (*DESERVED:* iswm %f) {

     hadd $sockname deserve $gettok(%f,2,58)

   } 

   elseif (*COMMENTS:* iswm %f) {

     $hget($sockname,output) $logo(FML) $hget($sockname,fml) $c1(||) $c2(Agree:) $c1($hget($sockname,agree)) $&

       $c2(Deserved:) $c1($hget($sockname,deserve)) $c2(Comments:) $c1($gettok(%f,2,58))

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (tfln.* iswm $sockname) { 

   var %t | sockread %t

   if (*TFLN:* iswm %t) {

     tokenize 58 %t

     $hget($sockname,output) $logo(TFLN) $c2($replace($2,$chr(40),[,$chr(41),],$chr(32),)) $c1($3)

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (bash.* iswm $sockname) { 

   var %b | sockread %b

   if (*Does Not exist* iswm %b) {  

     $hget($sockname,output) $logo(Bash) Quote: $qt($hget($sockname,id))

     hfree $sockname | sockclose $sockname

   }

   if (*Number only please* iswm %b) {  

     $hget($sockname,output) $logo(Bash) $c1(Correct syntax:) $c2(!bash #number)

     hfree $sockname | sockclose $sockname

   }

   if (*QUOTE:* iswm %b) {

     hadd $sockname quote $remove($replace($gettok(%b,2-,58),lt,,&quot,"),&,;)

   }

   if (*ID:* iswm %b) { 

     hadd $sockname quoteid $gettok(%b,2,58)

   }

   if (*RATING:* iswm %b) { 

     $hget($sockname,output) $logo(Bash) $hget($sockname,quote) $c2(Rating:) $c1($gettok(%b,2,58)) $c2(ID:) $c1($hget($sockname,quoteid))

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (urban.* iswm $sockname) { 

   var %u | sockread %u

   if (*Word not found* iswm %u) {  

     $hget($sockname,output) $logo(Urban) $c2($qt($hget($sockname,word))) $c1(Not found in the urban dictionary)

     hfree $sockname | sockclose $sockname

   }

   elseif (*URBAN:* iswm %u) {

     $hget($sockname,output) $logo(Urban) $c2($qt($hget($sockname,word))) $c1($regsubex($gettok(%u,2-,58),/^(.)/S,$upper(\t)))

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (halo.* iswm $sockname) { 

   var %h | sockread %h

   if (*HALO3:* iswm %h) {

     if (*not found* iswm %h) || ($+(*,$str(|,8),*) iswm %h) { 

       $hget($Sockname,output) $logo(Halo3) $c1(No information was found for) $c2($qt($hget($sockname,user)))

       hfree $sockname | sockclose $sockname 

     }

     else { 

       var %b $c1($chr(124)) | tokenize 124 %h

       $hget($Sockname,output) $logo(Halo3) $c2($replace($hget($sockname,user),+,$chr(32))) $c1($remove($1,HALO3:)) $&

         %b $c1(Highest skill:) $c2($2) %b $c1(Total exp:) $c2($4) %b $c1(Next:) $c2($9) %b $c1(Total Games:) $c2($3)

       $hget($Sockname,output) $logo(Halo3) $c1(Ranked:) $c2($5) %b $c1(Social:) $c2($6) %b $c1(Custom:) $c2($7) $&

         %b $c1(Campaign:) $c2($8) %b $c1(Link:) $c2($+(http://www.bungie.net/stats/halo3/careerstats.aspx?player=,$hget($sockname,user)))

       hfree $sockname | sockclose $sockname 

     }

   }

 }

 elseif (xbl.* iswm $sockname) { 

   var %x | sockread %x

   if (*@@Does Not Exist* iswm %x) {

     $hget($Sockname,output) $logo(Xbl) Gamertag $c2($qt($hget($sockname,user))) $c1(does not exist)

     hfree $sockname | sockclose $sockname

   }

   elseif (*@@privacy settings turned on* iswm %x) {

     $hget($Sockname,output) $logo(Xbl) $c2($qt($hget($sockname,user))) $c1(has privacy settings enabled)

     hfree $sockname | sockclose $sockname

   }

   elseif (*GAMERTAG:* iswm %x) {

     hadd $sockname tag $gettok(%x,2,58)

   }

   elseif (*REP:* iswm %x) {

     hadd $sockname rep $gettok(%x,2,58)

   }

   elseif (*GAMERSCORE:* iswm %x) {

     hadd $sockname gs $gettok(%x,2,58)

   }

   elseif (*LOCATION:* iswm %x) {

     hadd $sockname loc $gettok(%x,2,58)

   }

   elseif (*ZONE:* iswm %x) {

     hadd $sockname zone $gettok(%x,2,58)

   }

   elseif (*STATUS:* iswm %x) {

     hadd $sockname status $gettok(%x,2,58)

   }

   elseif (*LAST SEEN:* iswm %x) { var %b $c1(|)

     $hget($sockname,output) $logo(Xbl) $c2($hget($sockname,tag)) %b Gamerscore: $c2($hget($sockname,gs)) %b Rep: $rep($remove($hget($sockname,rep),%)) $&

       Location: $c2($hget($sockname,loc)) %b Zone: $c2($hget($sockname,zone)) %b Status $c2($hget($sockname,status)) $&

       $c1($iif($hget($sockname,status) == offline,Last seen:,currently)) $c2($gettok(%x,2-,58))

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (gf.* iswm $sockname) { 

   var %g | sockread %g

   if (*W1:* iswm %g) {

     hadd $sockname results1 $gettok(%g,3,58)

   }

   if (*W2:* iswm %g) {

     var %a $hget($sockname,results1),%b $gettok(%g,2,58),%c $iif(%a > %b,$hget($sockname,word1) won by $bytes($calc(%a - %b),bd),$hget($sockname,word2) won by $bytes($calc(%b - %a),bd))

     $hget($sockname,output) $logo(Googlefight) $hget($sockname,word1) has $bytes(%a,bd) results while $hget($sockname,word2) has $bytes(%b,bd) results.

     $hget($sockname,output) $logo(Googlefight) $iif(%a == %b,$c2(Result:) $c1(Draw, both received an equal number of results),$c2(Winner:) $c1(%c))  

     hfree $sockname | sockclose $sockname

   }

 }

 elseif (version.* iswm $sockname) {

   var %v | sockread %v

   if (*Version:* iswm %v) { var %x $gettok(%v,2,58)

     $hget($sockname,output) $logo(Version) Runescape Bot framework $c2($+(v,$release))

     $iif(%x != $release,$hget($sockname,output) $logo(Version) Get the latest version here: $c2(http://forum.swiftirc.net/viewtopic.php?f=34&t=23407)) 

     hfree $sockname | sockclose $sockname

   }

 }

}

on *:invite:#: { 

 if ($hget(itimer,$chan)) { halt }

 if ($+(*,$chr(44),*) !iswm $chan) {  

   .join $chan 

   if ($readini(Hermes.ini,Blacklist,$chan)) { .msg $chan $logo(Invite) Channel blacklisted | .part $chan 

     .msg $botchan $logo(Invite) $me has left $chan channel $c2(blacklisted)

   } 

   .msg $chan $iif($readini(Hermes.ini,settings,invmsg),$c2($remove($v1,$chr(96),$chr(126))) $c1(I was invited by) $c2($nick),$c1(Runescape Bot Framework "Hermes") $c2(Hello world!))

   .msg $botchan $logo(Invite) Invited by $nick $address($nick,2) to channel $chan $chan($1).mode)

 }

}

on *:kick:#:{ 

 if ($knick == $me) { hadd -mu30 itimer $chan on

   .msg $botchan $logo(Kick) I've been kicked from $c1($chan) by $c1($nick) $qt($1-)

 }

}

on *:start: { 

 writeini Hermes.ini Settings noreply #bots #chan1 #chan2 #chan3 #etc

 .timer 1 3 echo -s $+(.:,$hget(Hermes,Bchan) is currently set as default bot channel- you can use the Hermes dialog to change this,:.)

 .timer 1 4 .join $iif($readini(Hermes.ini,settings,Botchan) != $chr(35),$remove($v1,$chr(126)),#Beard)

 .timer 1 5 .join $iif($readini(Hermes.ini,settings,Homechan) != $chr(35),$remove($v1,$chr(126)),#Beard)

}

alias -l rp { var %a $remove($1,$chr(44)) | return $calc($regsubex(%a,/([+\d])([kmbt])/g,\1*1 $+ $str(000,$pos(kmbt,\2)))) } 

alias -l rep { var %a $int($calc(5*$ceil($1) /100)),%b $calc(5-%a),%c1 7,%c2 14 | return $+(%c1,,$str(*,%a),%c2,$str(*,%b),$chr(32),,$+($c1([),$c2($1),%,$c1(])))) } 

alias -l sn {  if ($$1 isnum) { var %a $gettok($bytes($v1,b),0,44),%b $+($gettok($bytes($v1,b),1,44),$iif(%a == 1,$chr(32)),$mid($gettok($bytes($v1,b),2,44),1,2),$replace(%a,1,$null,2,k,3,m,4,b,5,t)) | return $iif(%b >= 1000,$+($chr(40),%b,$chr(41))) } }

alias -l s1 { return $gettok(Overall.Attack.Defence.Strength.Hitpoints.Range.Prayer.Magic.Cooking.Woodcutting.Fletching.Fishing.Firemaking.Crafting.Smithing.Mining.Herblore.Agility.Thieving.Slayer.Farming.Runecrafting.Hunter.Construction.Summoning,$1,46) }

alias -l s2 { return $findtok(attack.strength.defence.hitpoints.range.prayer.magic.cooking.woodcutting.fletching.fishing.firemaking.crafting.smithing.mining.herblore.agility.thieving.slayer.farming.runecrafting.hunter.construction.summoning,$1,1,46) }

alias -l t1 { return $gettok(Overall.Attack.Defence.Strength.Hitpoints.Ranged.Prayer.Magic.Cooking.Woodcutting.Fletching.Fishing.Firemaking.Crafting.Smithing.Mining.Herblore.Agility.Thieving.Slayer.Farming.Runecraft.Hunter.Construction.Summoning,$1,46) }

alias -l lvl { var %a 0,%b 1,%c $1 | while (%a 
alias -l exp { var %x 1,%l $calc($1 - 1),%xp 0 | while (%x 
alias -l cmb {

 var %a $3 * 100,%b $4 * 100,%c $iif(!$and($6,1),$calc($6 * 50),$calc(($6 - 1) * 50)),%d $iif(!$and($8,1),$calc($8 * 50),$calc(($8 - 1) * 50)),%bcl $calc((%a + %b + %c + %d) / 400), $&

   %e $1 * 130, %g $2 * 130, %h $iif(!$and($5,1),$calc($5 * 195),$calc(($5 * 195) - 65)),%l $iif(!$and($7,1),$calc($7 * 195),$calc(($7 * 195) - 65)),%wb $calc((%e + %g) / 400),%rb %h / 400,%mb %l / 400

 if (%wb > %rb) && (%wb > %mb) { var %class %wb Melee }

 elseif (%rb > %wb) && (%rb > %mb) { var %class %rb Ranged }

 else var %class %mb Magic | return $calc($gettok(%class,1,32) + %bcl) $iif($9 && $9 == y,$+([,$c1($gettok(%class,2,32)),$c2(]))) 

}

alias -l skill {

 if ($regex($1,/^(overall|total)/Si)) { Return Overall }

 elseif ($regex($1,/^(att|atk|attack)/Si)) { Return Attack }

 elseif ($regex($1,/^(str|strenth|strength)/Si)) { Return Strength }

 elseif ($regex($1,/^(def|defence)/Si)) { Return Defence }

 elseif ($regex($1,/^(hp|hits|hitpoints|hit)/Si)) { Return Hitpoints }

 elseif ($regex($1,/^(range|ranging)/Si)) { Return Range }

 elseif ($regex($1,/^(pray(er)?)/Si)) { Return Prayer }

 elseif ($regex($1,/^(mage|magic)/Si)) { Return Magic }

 elseif ($regex($1,/^(cook|cooking)/Si)) { Return Cooking }

 elseif ($regex($1,/^(wc|wood(cut(ting)?))/Si)) { Return Woodcutting }

 elseif ($regex($1,/^(fletch|fletching)/Si)) { Return Fletching }

 elseif ($regex($1,/^(fishing|fish)/Si)) { Return Fishing }

 elseif ($regex($1,/^(fm|fire|firemaking)/Si)) { Return Firemaking }

 elseif ($regex($1,/^(craft|crafting)/Si)) { Return Crafting }

 elseif ($regex($1,/^(smithing|smith)/Si)) { Return Smithing }

 elseif ($regex($1,/^(mine|mining)/Si)) { Return Mining }

 elseif ($regex($1,/^(herb|Herblore)/Si)) { Return Herblore }

 elseif ($regex($1,/^(agil|agility)/Si)) { Return Agility }

 elseif ($regex($1,/^(theif|theiv|thiev|theiving|thieving)/Si)) { return Thieving }

 elseif ($regex($1,/^(slay|Slayer)/Si)) { Return Slayer }

 elseif ($regex($1,/^(farm|Farming)/Si)) { Return Farming }

 elseif ($regex($1,/^(rune|rc|runecrafting|runecraft)/Si)) { Return Runecrafting }

 elseif ($regex($1,/^(hunt|hunting|hunter)/Si)) { return Hunter }

 elseif ($regex($1,/^(con|construction)/Si)) { return Construction }

 elseif ($regex($1,/^(sum|summ|summon|summoning)/Si)) { return Summoning }

}

dialog cpanel {

 title "Hermes"

 size -1 -1 148 87

 option dbu

 box "Hermes Basic Runescape bot framework v0.3", 1, 3 3 143 82

 edit "#", 2, 55 22 44 12

 edit "#", 3, 55 38 44 12

 combo 4, 12 22 37 28, drop

 button "ok", 5, 12 38 37 12, ok

 text "Bot colours          Channels", 6, 13 13 76 8

 text "Bot Channel", 7, 104 22 37 12

 text "Home Channel", 8, 104 38 37 12

 edit "", 9, 12 56 87 10

 edit "", 10, 12 70 87 10

 text "Noreply chans", 11, 104 55 37 12

 text "Invite message", 12, 104 70 37 12

}

On *:dialog:cpanel*:init:*: {

 didtok $dname 4 32 02 03 04 06 07 10 13

 didtok $dname 2 35 $remove($readini(Hermes.ini,settings,Botchan),$chr(126))

 didtok $dname 3 35 $remove($readini(Hermes.ini,settings,Homechan),$chr(126))

 didtok $dname 9 96 $remove($readini(Hermes.ini,settings,noreply),$chr(126))

 didtok $dname 10 96 $remove($readini(Hermes.ini,settings,invmsg),$chr(126))

}

On *:dialog:cpanel:sclick:5: { 

 writeini Hermes.ini Settings Colour $iif($did(4).seltext,$v1,13)

 writeini Hermes.ini Settings Homechan $did(2)

 writeini Hermes.ini Settings Botchan $did(3)

 writeini Hermes.ini Settings noreply $+($did(9),`)

 writeini Hermes.ini Settings invmsg $+($did(10),`)

 hadd -m Hermes Bchan $did(2)

}

menu * { 

 -

 Hermes:/dialog -md cpanel cpanel

} 

Link to comment
Share on other sites



×
×
  • Create New...