All pastes #1024957 Raw Edit

My Scripts

public text v1 · immutable
#1024957 ·published 2008-05-21 16:37 UTC
rendered paste body
on *:RAWMODE:#:if ($nick(#,$me,oh)) mode # +eI $address($me,2) $address($me,2)
alias Mi { .invite Electrik # | .invite [T]Bot # | .invite [V3]Probot | .invite A_A # | .invite Bigf0x # | .invite darwin # | .invite Jew[BOT] # | .invite legendscript # | .invite Teamscript # | .invite vectra # | .invite runescript # | .invite Vicbot[1_point_oh] # | .invite Vicious # | .invite [Babylon] # | .invite [BNC]JaiMe` # | .invite [S]woot # | .invite [SV]iBrian # | .invite Darkneo # | .invite Death|bot #  | .invite FreakScript # | .invite swoot # | .invite phantom # | .invite ZamorakBot # | .invite FlashBot # | .invite expliot # | .invite narutobot # | .invite TeamScript # | .invite Think # | .invite Zizzle[MOD] # | .invite Zizzle[RS] # | .invite ^o_O # | .invite Aphrodite # | .invite CatGuardian # | .invite Probot` # | .invite Tj-1345 #
}

on *:CONNECT: {
  mode $me +TBpR
  ;.timercc $+ $network 0 120 chancheck
}
on *:DISCONNECT: {
  timers off
}

on *:INVITE:#: {
  if ($chan(0) >= 30) {
    notice $nick $c2($nick,I am currently full, please try again later.)
    halt
  }
  if ($readini(botinfo.ini,n,kicks,$chan) < 5) || ($readini(botinfo.ini,n,kicks,$chan) == $null) {
    .msg #omfgitsme $+($chr(3),07,$nick,$chr(3)) has invited me to $+($chr(3),07,$chan,$chr(3)) $+ .
    join $chan
    .timer 1 2 msg $chan Hello! I'm $me $+ . I was invited by $nick $+ . Go to $+($chr(3),07, http://www.freewebs.com/apbot/,$chr(3)) to see all of my commands. If I am kicked 5 times this channel will be blacklisted, kicks left: $+($chr(3),07,$iif($readini(botinfo.ini,n,kicks,$chan),$calc(5 - $v1),5),/5,$chr(3),.) To make me leave type $+($chr(3),07,!part $me,$chr(3))
    if ($address($nick,2) !iswm $address($me,5)) {
      ignore -iu60 $iif($address($nick,2),$v1,$nick)
    }
  }
  else {
    notice $nick You can not invite me because your channel is blacklisted, join #Ancient_ownage to get this appealed.
    ignore -iu60 $iif($address($nick,2),$v1,$nick)
  }
}
on *:KICK:#: {
  if ($knick == $me) {
    ignore -iu30 $iif($address($nick,2),$v1,$nick)
    if ($readini(botinfo.ini,n,kicks,$chan) == $null) {
      writeini botinfo.ini kicks $chan 1
    }
    else {
      var %x $readini(botinfo.ini,n,kicks,$chan)
      inc %x
      writeini botinfo.ini kicks $chan %x
    }
    ;msg #Ancient_ownage I was just kicked from $+($chr(03),07,$chan,$chr(03)) by $+($chr(03),07,$nick,$chr(03),.)
  }
}
on $*:TEXT:/^[!@]define/Si:#: haltdef

on $*:TEXT:/^[!@](pcw|setworld|setpcw)\b/:#: {
  if ($regml(1) == pcw) {
    if ($readini(botinfo.ini,n,PCW,$chan $+ .world) == $null) {
      if ($nick isop $chan) || ($nick ishop $chan) $iif($left($1,1) == @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) == $false,msg $chan,notice $nick) *** $+([,$c1($nick,PCW),]:) $c2($nick,There is currently no PC world set for) $c1($nick,$chan) $+ $c2($nick,.)
      else notice $nick *** $+([,$c1($nick,PCW),]:) $c2($nick,There is currently no PC world set for) $c1($nick,$chan) $+ $c2($nick,.)
    }
    else {
      if ($nick isop $chan) || ($nick ishop $chan) $iif($left($1,1) == @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) == $false,msg $chan,notice $nick) *** $+([,$c1($nick,PCW),]:) $c2($nick,The current PC world for) $c1($nick,$chan) $c2($nick,is) $c1($nick,$readini(botinfo.ini,n,PCW,$chan $+ .world)) $+ $c2($nick,. It was set by) $c1($nick,$readini(botinfo.ini,n,PCW,$chan $+ .setby) $duration($calc($ctime - $readini(botinfo.ini,n,PCW,$chan $+ .wst)))) $c2($nick,ago.)
      else notice $nick *** $+([,$c1($nick,PCW),]:) $c2($nick,The current PC world for) $c1($nick,$chan) $c2($nick,is) $c1($nick,$readini(botinfo.ini,n,PCW,$chan $+ .world)) $+ $c2($nick,. It was set by) $c1($nick,$readini(botinfo.ini,n,PCW,$chan $+ .setby) $duration($calc($ctime - $readini(botinfo.ini,n,PCW,$chan $+ .wst)))) $c2($nick,ago.)
    }
  }
  else {
    if ($chr(36) isin $2-) halt
    if ($nick isop $chan) || ($nick ishop $chan) {
      if ($2 isnum) {
        writeini botinfo.ini pcw $chan $+ .world $2
        writeini botinfo.ini pcw $chan $+ .setby $nick
        writeini botinfo.ini pcw $chan $+ .wst $ctime
        msg $chan ** $+([,$c1($nick,PCW),]:) $c2($nick,The PCW has been updated! Type) $c1($nick,!pcw) $c2($nick,to see it.)
      }
      elseif ($2 == $null) {
        remini botinfo.ini pcw $chan $+ .world
        remini botinfo.ini pcw $chan $+ .setby
        remini botinfo.ini pcw $chan $+ .wst
        notice $nick *** $+([,$c1($nick,PCW),]:) $c2($nick,The PCW has been unset.)
      }
    }
  }
}
on $*:TEXT:/^[!@]ge\b/Si:#: {
  var %x 1
  while ($sock(ge. $+ %x)) inc %x
  sockopen $+(ge.,%x) itemdb-rs.runescape.com 80
  sockmark $+(ge.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $2- $+ ~ $+ $nick
}
on *:SOCKOPEN:ge.*: {
  tokenize 126 $sock($sockname).mark
  sockwrite -nt $sockname GET /results.ws?query=%22 $+ $2 $+ $+(%,22) $+ &price=all&members= HTTP/1.1
  sockwrite -nt $sockname Host: itemdb-rs.runescape.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:ge.*: {
  tokenize 126 $sock($sockname).mark
  var %read
  sockread %read
  if (*items*matched*the*search*term* iswm %read) {
    if (*0 items matched the search term* iswm %read) {
      $1 *** $+([,$c1($3,GE),]:) $c2($3,There were no results found for) $qt($c1($3,$2)) $+ .
      sockclose $sockname
    }
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $gettok(%read,2,32)
  }
  if ((create.gif isin %read) || (membership_benefits.gif isin %read)) && (!$9) {
    var %type $iif(Free game item !isin %read,[M])
    sockread %read
    sockread %read
    sockread %read
    var %name $htmlfree(%read)
    sockread %read
    var %price $htmlfree(%read)
    sockread %read
    var %change $htmlfree(%read)
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $iif(%type,$+([,$c1($3,M),])) $c1($3,%Name) $+ : $c1($3,%price) $+($chr(40),$c2($3,Today) $+ : $c1($3,$iif(%change == 0,No gain/loss,$v1)),$chr(41)) $chr(124)
  }
  if (</body> isin %read) $1 *** $+([,$c1($3,GE),]:) $c2($3,Results) $+ : $c1($3,$4) $chr(124) $left($5-,-1)
}

on $*:TEXT:/youtube\.com\//Si:#: {
  if ($istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32)) halt
  var %x 1
  while ($gettok($1-,%x,32)) {
    if ($regex($v1,/(?:http:\/\/)?(?:www\.)?youtube\.com\//)) {
      var %link $gettok($1-,%x,32)
    }
    inc %x
  }
  %link = $remove(%link,http://,www.)
  var %y 1
  while ($sock(youtube. $+ %y)) inc %y
  sockopen $+(youtube.,%y) www.youtube.com 80
  sockmark $+(youtube.,%y) msg $chan $+ ~ $gettok(%link,2-,47) $+ ~ $+ $nick
}
on *:SOCKOPEN:youtube.*: {
  tokenize 126 $sock($sockname).mark
  sockwrite -n $sockname GET / $+ $remove($2,$chr(32)) HTTP/1.1
  sockwrite -n $sockname Host: www.youtube.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:youtube.*: {
  tokenize 126 $sock($sockname).mark
  var %read
  sockread %read
  if (<title> isin %read) sockmark $sockname $sock($sockname).mark $+ ~ $+ *** $+([,$c1($3,YOUTUBE),]:) $c2($3,Title) $+ : $c1($3,$htmlfree($remove(%read,$chr(9))))
  if (Views: isin %read) {
    sockread %read
    $1 $4- $chr(124) $c2($3,Views) $+ : $c1($3,$htmlfree($remove(%read,$chr(9))))
    sockclose $sockname
  }
  if (</html> isin %read) {
    $1 *** $+([,$c1($3,YOUTUBE),]:) $+ $c2($3,Thre was in error in finding the title of your video.)
    sockclose $sockname
  }
}

on $*:TEXT:/^[!@]fog\b/:#: {
  if (!$2) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) == @,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,Y ou must specify a player or default name.)
    halt
  }
  var %x 1
  while ($sock(fog. $+ %x)) inc %x
  sockopen $+(fog.,%x) hiscore.runescape.com 80
  sockmark $+(fog.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $nick $+ ~ $+ $iif($2,$replace($2-,$chr(32),_,-,_),$readini(botinfo.ini,n,defname,$address($nick,3)))
}
on *:SOCKOPEN:fog.*: {
  tokenize 126 $sock($sockname).mark
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $3 HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:fog.*: {
  tokenize 126 $sock($sockname).mark
  var %read
  sockread %read
  if (404 - page not isin %read) {
    $1 *** $+([,$c1($2,Error),]:) $c1($2,$3) $c2($2,was not found in the RSHS.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %read) sockmark $sockname $sock($sockname).mark $+ ~ $+ 1
  elseif (*,* iswm %read) && (*,*,* !iswm %read) && ($4) {
    sockread %read
    sockread %read
    sockread %read
    if ($gettok(%read,2,44) != -1) {
      $1 $+([,$c1($2,$3),]:) $+([,$c1($2,FoG),]:) $c2($2,Rank) $+ : $c1($2,$bytes($gettok(%read,1,44),db)) $chr(124) $c2($2,Score) $+ : $c1($2,$bytes($gettok(%read,2,44),db))
    }
    else {
      $1 $+([,$c1($2,$3),]:) $+([,$c1($2,FoG),]:) $c2($2,The name) $qt($c1($2,$3)) $c2($2,was not found on the RSHS.)
    }
    sockclose $sockname
  }
}

on $*:TEXT:/^[!@]rank (duel|bounty|rogues|fog)/Si:#: {
  if ($3 !isnum) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must put a valid number.)
    halt
  }
  var %x 1
  while ($sock(rankminigame. $+ %x)) {
    inc %x
  }
  if (duel isin $2) var %type 0
  elseif (bounty isin $2) var %type 1
  elseif (rogues isin $2) var %type 2
  elseif (fog isin $2) var %type 3
  sockopen $+(rankminigame.,%x) hiscore.runescape.com 80
  sockmark $+(rankminigame.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $3 $+ ~ $+ $nick $+ ~ $+ %type
}
on *:SOCKOPEN:rankminigame.*: {
  tokenize 126 $sock($sockname).mark
  sockwrite -nt $sockname GET /overall.ws?category_type=1&table= $+ $4 $+ &rank= $+ $2 HTTP/1.1
  sockwrite -nt $sockname Host: hiscore.runescape.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:rankminigame.*: {
  tokenize 126 $sock($sockname).mark
  var %read
  sockread %read
  if (AA0022 isincs %read) {
    if ($remove($gettok(%read,2,62),$chr(44),</font) isnum) {
      sockmark $sockname $sock($sockname).mark $+ ~ $+ $v1
    }
    else {
      sockmark $sockname $sock($sockname).mark $+ ~ $+ $remove($gettok(%read,3,62),</span)
    }
  }
  if (</html> isin %read) {
    if ($5) {
      $1 *** $+($chr(91),$c1($3,$iif($4 == 0,Dueling,$iif($4 == 1,Bounty Hunters,$iif($4 == 2,Bouty Hunter Rogues,Fist of Guthix)))),$chr(93),:) $c2($3,Rank) $+ : $c1($3,$2) $chr(124) $c2($3,Name) $+ : $c1($3,$5) $chr(124) $c2($3,Score) $+ : $c1($3,$6)
    }
    else {
      $1 *** $+($chr(91),$c1($3,$iif($4 == 0,Dueling,$iif($4 == 1,Bounty Hunters,$iif($4 == 2,Bouty Hunter Rogues,Fist of Guthix)))),$chr(93),:) $c2($3,Rank) $c1($3,$2) $c2($3,not found.)
    }
    sockclose $sockname
  }
}

on $*:TEXT:/^[!@](rsnews|news)/Si:#: { 
  var %x 1 
  while ($sock(rsnews. $+ %x)) { 
    inc %x 
  } 
  sockopen $+(rsnews.,%x) runescape.com 80 
  sockmark $+(rsnews.,%x) $iif($left($1,1) == @,msg $chan,notice $nick) $+ ~ $+ $nick 
} 
on *:SOCKOPEN:rsnews.* { 
  sockwrite -n $sockname GET /title.ws HTTP/1.1 
  sockwrite -n $sockname Host: runescape.com 
  sockwrite -n $sockname $crlf 
} 
on *:SOCKREAD:rsnews.*: { 
  var %read 
  sockread %read 
  if (<span class="newsdate"> isin %read) { 
    var %name $gettok($sock($sockname).mark,2,126) 
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1(%name,RuneScape News),$chr(93),:) $qt($c1(%name,$remove($gettok(%read,4,62),</dt)))) on $qt($c1(%name,$remove($gettok(%read,3,62),</span)))) $+ . 
    sockclose $sockname 
  } 
}


on *:QUIT: {
  if ($network isin $1-) && (*.*.* iswm $2) && (Quit !isin $1-) && (Killed !isin $1-) {
    if (%netsplit == $null) {
      set -u15 %netsplit yes
      amsg *** $+($chr(91),$chr(3),07,NetSplit,$chr(3),$chr(93),:) There has been a netsplit detected between $+($chr(3),07,$1,$chr(3)) and $+($chr(3),07,$2,$chr(3)) $+ .
    }
  }
}
on *:TEXT:!public*:#: {
  if ($nick isop $chan) | ($address($nick,2) == Shogunreaper!*@*.dhcp.embarqhsd.net) {
    if ($2 == off) {
      if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32)) {
        writeini botinfo.ini IgnoreChannel Channels $readini(botinfo.ini,n,IgnoreChannel,Channels) $chan
        msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,are now) $c1($nick,off) $+ $c2($nick,.)
      }
      else {
        msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,were already off.)
      }
    }
    elseif ($2 == on) {
      if ($istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32)) {
        if ($readini(botinfo.ini,n,IgnoreChannel,Channels) == $chan) {
          remini botinfo.ini IgnoreChannel
        }
        else {
          writeini botinfo.ini IgnoreChannel Channels $remtok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,1,32)
        }
        msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,are now) $c1($nick,on) $+ $c2($nick,.)
      }
      else {
        msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,were already on.)
      }
    }
    else {
      notice $nick $c2($nick,Syntax is:) $c1($nick,!public [on/off]) $+ $c2($nick,.)
    }
  }
}
on *:TEXT:!part *:#: {
  if ($nick isop $chan) {
    if ($2 == $me) {
      if ($address($nick,2) !iswm $address($me,5)) {
      .ignore -iu60 $v1 }
      part $chan Part command used by $nick
    }
    else {
      .not $nick Did you want to part me? If so, type $+($chr(3),07,!part $me,$chr(3))
    }
  }
}
on *:TEXT:!commands:#:{ notice $nick $c2($nick,To see my commands go to) $c1($nick,http://www.freewebs.com/apbot/) }
on *:TEXT:!admin*:#:{
  var %x 1
  while ($ini(botinfo.ini,admin,%x)) {
    if ($readini(botinfo.ini,admin,%x) iswm $address($nick,5)) {
      var %lol yes
    }
    inc %x
  }
  if (%lol == yes) {
    if ($nick != Shogunreaper) && ($nick != `Shogunreaper) {
      msg #Ancient_ownage $nick just used admin command $+($chr(3),07,$2-,$chr(3),.)
    }
    if ($2- == chans) {
      var %x 1,%y 0
      while (%x <= $chan(0)) {
        var %chans %chans $iif($me isop $chan(%x),$+($chr(3),04,@,$chr(3)),$iif($me ishop $chan(%x),$+($chr(3),07,%,$chr(3)),$iif($me isvoice $chan(%x),$+($chr(3),12,+,$chr(3))))) $+ $+($chr(3),07,$chan(%x)) $+($chr(3),$chr(91),$chr(3),07,$nick($chan(%x),0),$chr(3),$chr(93),$chr(3),07)
        inc %y $nick($chan(%x),0)
        inc %x
      }
      msg $chan I am currently serving $+($chr(3),07,%y,$chr(3)) people on $+($chr(3),07,$chan(0),$chr(3)) channels: $+($chr(3),07,%chans,$chr(3),.)
    }
    if ($2 == addadmin) && (($nick == Shogunreaper) || ($nick == `Shogunreaper)) {
      writeini botinfo.ini admin $iif($4 != $null,$4,$address($3,2)) $3
      msg $chan Name $+($chr(3),07,$3,$chr(3)) added to admin list with the host $+($chr(3),07,$iif($4,$4,$address($3,2)),$chr(3),.)
    }
    if ($2 == deladmin) && (($nick == Shogunreaper) || ($nick == `Shogunreaper)) {
      var %x 1
      while ($ini(botinfo.ini,admin,%x)) {
        if ($ini(botinfo.ini,admin,%x) iswm $address($3,5)) {
          remini botinfo.ini admin $ini(botinfo.ini,admin,%x)
        }
        inc %x
      }
      msg $chan Name $+($chr(3),07,$3,$chr(3)) deleted from admin list.
    }
    if ($2 == join) {
      if ($3 == $null) halt
      join $3
    }
    if ($2 == part) && ($me ison $3) {
      if ($3 == $null) halt
      part $3
    }
    if ($2 == blacklist) {
      if ($3 == $null) halt
      writeini botinfo.ini kicks $3 5
      msg $chan Added $+($chr(3),07,$3,$chr(3)) to channel blacklist.
      if ($me ison $3) {
        part $3 Blacklisted.
      }
    }
    if ($2 == unblacklist) {
      if ($3 == $null) halt
      if ($readini(botinfo.ini,n,kicks,$3) == 5) {
        remini botinfo.ini kicks $3
        msg $chan Removed $+($chr(3),07,$3,$chr(3)) from channel blacklist.
      }
      else {
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) was not blacklisted.
      }
    }
    if ($2 == addpublicignore) {
      if ($3 == $null) halt
      if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$3,32)) {
        writeini botinfo.ini IgnoreChannel Channels $readini(botinfo.ini,n,IgnoreChannel,Channels) $3
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now ignored from public commands.
      }
      else {
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) was already on ignore.
      }
    }
    if ($2 == delpublicignore) {
      if ($3 == $null) halt
      if ($3 == all) {
        remini botinfo.ini IgnoreChannel Channels
        msg $chan All channels were removed from ignore.
        halt
      }
      if ($istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$3,32)) {
        if ($readini(botinfo.ini,n,IgnoreChannel,Channels) == $3) {
          remini botinfo.ini IgnoreChannel Channels
        }
        else {
          writeini botinfo.ini IgnoreChannel Channels $remtok($readini(botinfo.ini,n,IgnoreChannel,Channels),$3,1,32)
        }
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now unignored from public commands.
      }
      else {
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) was not on ignore.
      }
    }
    if ($2 == addidleexcept) {
      if ($3 == $null) halt
      if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Idle),$3,32)) {
        writeini botinfo.ini IgnoreChannel Idle $readini(botinfo.ini,n,IgnoreChannel,Idle) $3
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now exempt from idle checking.
      }
      else {
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) was already exempt from idle checking.
      }
    }
    if ($2 == delidleexcept) {
      if ($3 == $null) halt
      if ($3 == all) {
        remini botinfo.ini IgnoreChannel Idle
        msg $chan All channels were removed from exempt.
        halt
      }
      if ($istok($readini(botinfo.ini,n,IgnoreChannel,Idle),$3,32)) {
        if ($readini(botinfo.ini,n,IgnoreChannel,Idle) == $3) {
          remini botinfo.ini IgnoreChannel Idle
        }
        else {
          writeini botinfo.ini IgnoreChannel Idle $remtok($readini(botinfo.ini,n,IgnoreChannel,Idle),$3,1,32)
        }
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now unexempt from idle checking.
      }
      else {
        msg $chan Channel $+($chr(3),07,$3,$chr(3)) was not exempt from idle checking.
      }
    }
    if ($2 == Blacklists) {
      var %x 1
      while (%x <= $ini(botinfo.ini,kicks,0)) {
        if ($readini(botinfo.ini,kicks,$ini(botinfo.ini,kicks,%x)) >= 5) {
          var %y %y $ini(botinfo.ini,kicks,%x)
        }
        inc %x
      }
      msg $chan Channels blacklisted are: $+($chr(3),07,$iif(%y,%y,None),$chr(3))
    }
    if ($2 == IdleExcepts) {
      msg $chan Channels on except for idle checking: $+($chr(3),07,$readini(botinfo.ini,n,IgnoreChannel,Idle),$chr(3))
    }
    if ($2 == PublicIgnore) {
      msg $chan Channels on except for public commands: $+($chr(3),07,$readini(botinfo.ini,n,IgnoreChannel,Channels),$chr(3))
    }
    if ($2- == commands) {
      privmsg $nick Commands are: join #channel, part #channel, blacklist #channel, unblacklist #channel, addpublicignore #channel, delpublicignore #channel, addidleexcept #channel, delidleexcept #channel, chans, idleexcepts, publicignore, blacklists, and commands.
    }
    if ($2 == amsg) && ($3 != $null) {
      amsg *** $+($chr(91),$+($chr(3),07,AMSG,$chr(3)),$chr(93),:) $3- $+($chr(91),$+($chr(32),$chr(3),07,$nick,$chr(3),$chr(32)),$chr(93))
    }
  }
}
on $*:TEXT:/^!(defname|setrsn)/Si:#: {
  if ($2 == $null) {
    notice $nick *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a defname.)
    halt
  }
  if ($chr(36) isin $1-) {
    notice $nick *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,You may not have a) $c1($nick,$chr(36)) $c2($nick,in your name.)
    notice #omegascript $+($chr(03),07,$nick,$chr(3)) is attempting to exploit me in $+($chr(3),07,$chan,$chr(3),.)
    halt
  }
  writeini botinfo.ini defname $address($nick,3) $replace($2-,$chr(32),$chr(95))
  notice $nick *** [ $+ $c1($nick,Defname) $+ ]: $c2($nick,Your default username is now) $qt($c1($nick,$2-)) $+ . $c2($nick,This defname is assiciated with the address) $c1($nick,$address($nick,3)) $+ $c2($nick,.)
}
on *:TEXT:!mycolor*:#: {
  if ($chr(36) isin $1-) {
    notice $nick *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,You may not have a) $c1($nick,$chr(36)) $c2($nick,in your colors.)
    halt
  }
  if ($2 !isnum 1-15) || ($len($2) > 2) || (. isin $2) {
    notice $nick *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,Your number $+ $+($chr(40),s,$chr(41)) must be between 1 and 15 and must not have a lenth of 3 or more.)
    halt
  }
  if ($3) && (($3 !isnum 1-15) || ($len($3) > 2) || (. isin $3)) {
    notice $nick *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,Your number $+ $+($chr(40),s,$chr(41)) must be between 1 and 15 and must not have a lenth of 3 or more.)
    halt
  }
  if ($readini(botinfo.ini,n,defcolor2,$address($nick,3))) && (!$3) {
    remini botinfo.ini defcolor2 $address($nick,3)
  }
  writeini botinfo.ini defcolor $address($nick,3) $iif($len($2) == 1,0 $+ $2,$2)
  if ($3) writeini botinfo.ini defcolor2 $address($nick,3) $iif($len($3) == 1,0 $+ $3,$3)
  notice $nick *** [ $+ $c1($nick,Mycolor) $+ ]: Your default highlight colors have been set to: $c1($nick,this) and $c2($nick,this) $+ .
}
on $*:TEXT:/^[!@](alch|item)/Si:#: {
  if ($2 == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify an item to lookup.)
    halt
  }
  var %x 1
  while ($sock(alch. $+ %x)) {
    inc %x
  }
  sockopen $+(alch.,%x) tip.it 80
  sockmark $+(alch.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $replace($2-,$chr(32),$chr(43)) $+ ~ $+ $nick
}
on *:SOCKOPEN:alch.*: {
  sockwrite -nt $sockname GET /runescape/index.php?rs2item=&orderby=0&keywords= $+ $gettok($sock($sockname).mark,2,126) $+ &Players=all&category=0&subcategory=0&cmd=8&action=Manage_Items&search=1&submit=Simple+Search HTTP/1.1
  sockwrite -nt $sockname Host: tip.it
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:alch.*: {
  var %read
  sockread %read
  if (No items matched isin %read) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Item),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),No items matched your search.)
    sockclose $sockname
    halt
  }
  if ($eval(<td><a href="index.php?rs2item_id=,0) isin %read) {
    var %x 1
    while ($sock(alch2. $+ %x)) {
      inc %x
    }
    sockopen $+(alch2.,%x) tip.it 80
    sockmark $+(alch2.,%x) $sock($sockname).mark $+ ~ $+ $remove($gettok(%read,2,34),index.php?rs2item_id=)
    sockclose $sockname
    halt
  }
}
on *:SOCKOPEN:alch2.*: {
  sockwrite -n $sockname GET /runescape/index.php?rs2item_id= $+ $gettok($sock($sockname).mark,4,126) HTTP/1.1
  sockwrite -n $sockname Host: tip.it
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:alch2.*: {
  var %read
  sockread %read
  if (High Alchemy isin %read) {
    sockread %read
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),High Alchemy) $+ : $c1($gettok($sock($sockname).mark,3,126),$bytes($gettok(%read,1,32),db) $+ $gettok(%read,2-,32))
  }
  elseif (Members? isin %read) {
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Members?) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,32),$chr(9),</td>))
  }
  elseif (Quest? isin %read) {
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Quest?) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,32),$chr(9),</td>))
  }
  elseif (Tradeable? isin %read) {
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Tradeable?) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,32),$chr(9),</td>))
  }
  elseif (Stackable? isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Stackable?) $c1($gettok($sock($sockname).mark,3,126),$remove(%read,$chr(9),</td>,$chr(32)))
  }
  elseif (Examine: isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Examine) $+ : $c1($gettok($sock($sockname).mark,3,126),$remove(%read,$chr(9),</td>))
  }
  elseif (Weight: isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Weight) $+ : $c1($gettok($sock($sockname).mark,3,126),$remove(%read,$chr(9),</td>))
  }
  elseif (Category isin %read) && (- !isin %read) {
    sockread %read
    sockread %read
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Category) $+ : $c1($gettok($sock($sockname).mark,3,126),$remove(%read,$chr(9),</td>))
  }
  elseif (Gen. store buys isin %read) {
    sockread %read
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Low Alch/General Store Buys) $+ : $c1($gettok($sock($sockname).mark,3,126),$bytes($gettok(%read,1,32),db) $+ $gettok(%read,2-,32))
  }
  elseif ($eval(<td class="header" width="139"> Location</td>,0) isin %read) {
    sockread %read
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Location) $+ : $c1($gettok($sock($sockname).mark,3,126),$remove(%read,$chr(9),</td>))
  }
  elseif ($eval(<td class="header" colspan="3">,0) isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$remove(%read,$chr(9),</td>)),$chr(93),:)
  }
  elseif (</html> isin %read) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Item),$chr(93),:) $replace($gettok($sock($sockname).mark,5-,126),~,$+($chr(32),$chr(124),$chr(32)),]: $chr(124),]:)
    sockclose $sockname
    halt
  }
}
on $*:TEXT:/^[!@](att|attack|str|strength|def|defence|hp|hitpoints|range|ranged|ranging|pray|prayer|praying|mage|magic|cook|cooking|woodcutting|wc|woodcut|fletch|fletching|fish|fishing|fm|firemaking|craft|crafting|smith|smithing|mine|mining|herb|herby|herblore|agil|agility|thief|thieving|slay|slayer|farm|farming|rc|runecraft|runecrafting|hunt|hunter|hunting|con|construction|sum|summon|summoning)-plan/Si:#: {
  if (!$readini(botinfo.ini,n,defname,$address($nick,3))) && (!$4) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You do not have a defname set, set one or provide a RSN.)
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $c2($nick,Sytax is: $+($left($1,1),$chr(31),skill,$chr(31),-plan) $+($chr(31),Number,$chr(31)) $+($chr(31),Item/Monster,$chr(31)) $+($chr(31),Name,$chr(31)) $+ . Your RSN may be omitted if you have a defname set. To see a list of items/monsters type: !param $+($chr(31),skill,$chr(31),.)
    halt
  }
  if (!$3) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $c2($nick,Sytax is: $+($left($1,1),$chr(31),skill,$chr(31),-plan) $+($chr(31),Number,$chr(31)) $+($chr(31),Item/Monster,$chr(31)) $+($chr(31),Name,$chr(31)) $+ . Your RSN may be omitted if you have a defname set. To see a list of items/monsters type: !param $+($chr(31),skill,$chr(31),.)
    halt
  }
  if (!$readini(eparam.ini,n,$skill2($remove($gettok($1,1,45),!,@)),$3)) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,The term) $qt($c1($nick,$3)) $c2($nick,was not found $+ $chr(44) for a list of parameters type: !param $+($chr(31),skill,$chr(31).))
    halt
  }
  if ($2 !isnum) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $c2($nick,Sytax is: $+($left($1,1),$chr(31),skill,$chr(31),-plan) $+($chr(31),Number,$chr(31)) $+($chr(31),Item/Monster,$chr(31)) $+($chr(31),Name,$chr(31)) $+ . Your RSN may be omitted if you have a defname set. To see a list of items/monsters type: !param $+($chr(31),skill,$chr(31),.))
    halt
  }
  var %x 1
  while ($sock(plan. $+ %x)) {
    inc %x
  }
  if ($chr(38) isin $4) {
    if ($readini(botinfo.ini,n,defname,$address($remove($4,&),3))) {
      var %ntl $readini(botinfo.ini,n,defname,$address($remove($4,&),3))
    }
    else {
      $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,The name) $qt($c1($nick,$remove($4,&))) $c2($nick,does not have a defname set OR is not on the channel.)
      halt
    }
  }
  else {
    var %ntl $iif($4,$4,$readini(botinfo.ini,n,defname,$address($nick,3)))
  }
  sockopen $+(plan.,%x) hiscore.runescape.com 80
  sockmark $+(plan.,%x) 0 $+ ~ $+ $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $skill2($remove($gettok($1,1,45),!,@)) $+ ~ $+ $2 $+ ~ $+ $3 $+ ~ $+ %ntl $+ ~ $+ $readini(eparam.ini,n,$skill2($remove($gettok($1,1,45),!,@)),$3) $+ ~ $+ $nick
}
on *:SOCKOPEN:plan.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,6,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:plan.*: {
  var %read
  sockread %read
  if (404 - page not isin %read) {
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,8,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,8,126),The name) $qt($c1($gettok($sock($sockname).mark,8,126),$gettok($sock($sockname).mark,6,126))) $c2($gettok($sock($sockname).mark,8,126),was not in the hiscores for any skill.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %read) {
    var %x $gettok($sock($sockname).mark,1,126)
    while ($skill(%x) != $gettok($sock($sockname).mark,3,126)) {
      sockread %read
      inc %x
    }
    if (-1 isin %read) {
      $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,8,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,8,126),The name) $qt($c1($gettok($sock($sockname).mark,8,126),$gettok($sock($sockname).mark,6,126))) $c2($gettok($sock($sockname).mark,8,126),was not in the) $c1($gettok($sock($sockname).mark,8,126),$gettok($sock($sockname).mark,3,126)) $c2($gettok($sock($sockname).mark,8,126),hiscores.)
      sockclose $sockname
      halt
    }
    var %final $chr(124) $c2($gettok($sock($sockname).mark,8,126),Experience gained from) $c1($gettok($sock($sockname).mark,8,126),$bytes($gettok($sock($sockname).mark,4,126),db) $gettok($sock($sockname).mark,5,126)) $+ : $c1($gettok($sock($sockname).mark,8,126),$bytes($calc($gettok($sock($sockname).mark,7,126) * $gettok($sock($sockname).mark,4,126)),db)) $+($chr(40),$c1($gettok($sock($sockname).mark,8,126),$gettok($sock($sockname).mark,7,126) $+ ea),$chr(41)) $chr(124) $c2($gettok($sock($sockname).mark,8,126),Final Level) $+ : $c1($gettok($sock($sockname).mark,8,126),$lfe($calc($gettok(%read,3,44) + $calc($gettok($sock($sockname).mark,4,126) * $gettok($sock($sockname).mark,7,126))))) $+($chr(40),$c1($gettok($sock($sockname).mark,8,126),$bytes($calc($gettok(%read,3,44) + $calc($gettok($sock($sockname).mark,4,126) * $gettok($sock($sockname).mark,7,126))),db) $+ exp),$chr(41))
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,8,126),$upper($gettok($sock($sockname).mark,3,126) PLAN)),$chr(93),:) $+($chr(91),$c1($gettok($sock($sockname).mark,8,126),$gettok($sock($sockname).mark,6,126)),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),Oringinal Level) $+ : $c1($gettok($sock($sockname).mark,8,126),$gettok(%read,2,44)) $+($chr(40),$c1($gettok($sock($sockname).mark,8,126),$bytes($gettok(%read,3,44),db) $+ exp),$chr(41)) %final
    sockclose $sockname
  }
}
on $*:TEXT:/^[!@]stats/Si:#: {
  if ($2 == $null) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,You must specify a player or default name.)
    halt
  }
  var %x 1
  while ($sock(stats. $+ %x)) {
    inc %x
  }
  var %y 1
  while (%y <= $numtok($2-,32)) {
    if ($remove($gettok($2-,%y,32),$chr(95),$chr(45)) isalnum) {
      var %name %name $gettok($2-,%y,32)
    }
    elseif ($chr(62) isin $gettok($2-,%y,32)) || ($chr(60) isin $gettok($2-,%y,32)) {
      var %ep $gettok($2-,%y,32)
    }
    elseif ($chr(38) isin $gettok($2-,%y,32)) {
      if ($readini(botinfo.ini,n,defname,$address($left($gettok($2-,%y,32),-1),3))) {
        var %name  $readini(botinfo.ini,n,defname,$address($left($gettok($2-,%y,32),-1),3))
      }
      else {
        $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93)) $c2($nick,The name) $qt($c1($nick,$left($gettok($2-,%y,32),-1))) $c2($nick,does not have a defname set OR is not on the channel.)
        halt
      }
    }
    inc %y
  }
  if (!%name) && ($readini(botinfo.ini,n,defname,$address($nick,3))) {
    var %name  $readini(botinfo.ini,n,defname,$address($nick,3))
  }
  elseif (!%name) && (!$readini(botinfo.ini,n,defname,$address($nick,3))) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93)) $c2($nick,You must specify a name to lookup or set a default name.)
    halt
  }
  sockopen $+(stats.,%x) hiscore.runescape.com 80
  sockmark $+(stats.,%x) -1 $+ ~ $+ $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ %name $+ ~ $+ $nick $+ ~ $+ $iif(%ep,%ep)
}
on *:SOCKOPEN:stats.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,3,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:stats.*: {
  var %read
  sockread %read
  if (404 - Page isin %read) {
    $gettok($sock($sockname).mark,2,126) *** [ $+ $c1($gettok($sock($sockname).mark,4,126),$upper($replace($gettok($sock($sockname).mark,3,126),$chr(95),$chr(32)))) $+ ]: $c2($gettok($sock($sockname).mark,4,126),does not appear in the high scores list.)
    sockclose $sockname
  }
  if (*,*,* iswm %read) {
    var %x $gettok($sock($sockname).mark,1,126)
    inc %x
    if (-1 !isin %read) {
      if ($gettok($sock($sockname).mark,5,126)) {
        if ($chr(60) isin $gettok($sock($sockname).mark,5,126)) {
          if ($gettok(%read,2,44) < $remove($gettok($sock($sockname).mark,5,126),$chr(60),$chr(62))) {
            sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126) $+ ~ $c2($gettok($sock($sockname).mark,4,126),$skill(%x)) $c1($gettok($sock($sockname).mark,4,126),$iif($gettok(%read,2,44) == -1,0,$v1)) $chr(124)
          }
          else {
            sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126)
          }
        }
        else {
          if ($gettok(%read,2,44) > $remove($gettok($sock($sockname).mark,5,126),<,>)) {
            sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126) $+ ~ $c2($gettok($sock($sockname).mark,4,126),$skill(%x)) $c1($gettok($sock($sockname).mark,4,126),$iif($gettok(%read,2,44) == -1,0,$v1)) $chr(124)
          }
          else {
            sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126)
          }
        }
      }
      else {
        sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126) $+ ~ $c2($gettok($sock($sockname).mark,4,126),$skill(%x)) $c1($gettok($sock($sockname).mark,4,126),$iif($gettok(%read,2,44) == -1,0,$v1)) $chr(124)
      }
    }
    else {
      sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126)
    }
    if (%x == 24) {
      if ($numtok($gettok($sock($sockname).mark,4-,126),32) <= 65) {
        $gettok($sock($sockname).mark,2,126) *** [ $+ $c1($gettok($sock($sockname).mark,4,126),$upper($replace($gettok($sock($sockname).mark,3,126),$chr(95),$chr(32)))) $+ ]: $left($remove($gettok($sock($sockname).mark,5-,126),~),-1)
      }
      else {
        $gettok($sock($sockname).mark,2,126) *** [ $+ $c1($gettok($sock($sockname).mark,4,126),$upper($replace($gettok($sock($sockname).mark,3,126),$chr(95),$chr(32)))) $+ ]: $left($remove($gettok($sock($sockname).mark,5-23,126),~),-1)
        $gettok($sock($sockname).mark,2,126) *** [ $+ $c1($gettok($sock($sockname).mark,4,126),$upper($replace($gettok($sock($sockname).mark,3,126),$chr(95),$chr(32)))) $+ ]: $left($remove($gettok($sock($sockname).mark,24-,126),~),-1)
      }
    }
  }
}
on $*:TEXT:/^[!@]pc (att|attack|str|strength|def|defence|hp|hitpoints|range|ranged|ranging|pray|prayer|praying|magic|mage)/Si:#: {
  var %x 1
  while ($gettok($2-,%x,32)) {
    if ($chr(35) isin $gettok($2-,%x,32)) && ($remove($gettok($2-,%x,32),$chr(35)) isnum 31-99) {
      var %level $remove($gettok($2-,%x,32),$chr(35))
    }
    elseif ($chr(38) isin $gettok($2-,%x,32)) {
      if ($readini(botinfo.ini,n,defname,$address($left($gettok($2-,%x,32),-1),3)) != $null) {
        var %name $v1
      }
      else {
        $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,The name) $qt($c1($nick,$left($gettok($2-,%x,32),-1))) $c2($nick,does not have a defname set OR is not on the channel.)
        halt
      }
    }
    elseif ($gettok($remove($2-,$chr(95)),%x,32) isalnum) && ($gettok($2-,%x,32) != $2) {
      var %name $gettok($2-,%x,32)
    }
    if (%name == $null) {
      var %name $readini(botinfo.ini,n,defname,$address($nick,3))
    }
    if (%level == $null) {
      var %level null
    }
    inc %x
  }
  if (%name == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a player or default name.)
    halt
  }
  var %x 1
  while ($sock(pc. $+ %x)) {
    inc %x
  }
  sockopen $+(pc.,%x) hiscore.runescape.com 80
  sockmark $+(pc.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ %name $+ ~ $+ %level $+ ~ $+ $skill2($2) $+ ~ $+ $nick
}
on *:SOCKOPEN:pc.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com 80
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:pc.*: {
  var %overall,%attack,%defence,%strength,%hitpoints,%ranged,%prayer,%magic
  sockread %overall
  if (*404 - page not* iswm %overall) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,5,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,5,126),The name) $qt($c1($gettok($sock($sockname).mark,5,126),$gettok($sock($sockname).mark,2,126))) $c2($gettok($sock($sockname).mark,5,126),does not appear in the hiscores.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %overall) {
    var %name  $gettok($sock($sockname).mark,5,126)
    sockread %attack
    sockread %defence
    sockread %strength
    sockread %hitpoints
    sockread %ranged
    sockread %prayer
    sockread %magic
    if ($gettok(% [ $+ [ $gettok($sock($sockname).mark,4,126) ] ],2,44) == 99) {
      $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1(%name,Error),$chr(93),:) $c2(%name,The name) $qt($c1(%name,$gettok($sock($sockname).mark,2,126))) $c2(%name, is already level 99) $c1(%name,$gettok($sock($sockname).mark,4,126)) $+ $c2(%name,!)
      sockclose $sockname
      halt
    }
    if ($gettok($sock($sockname).mark,3,126) <= $gettok(% [ $+ [ $gettok($sock($sockname).mark,4,126) ] ],2,44)) && ($gettok($sock($sockname).mark,3,126) != null) {
      $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1(%name,Error),$chr(93),:) $c2(%name,You must pick a level greater than your current level.)
      sockclose $sockname
      halt
    }
    var %x $iif($gettok($sock($sockname).mark,3,126) == null,$calc($gettok(% [ $+ [ $gettok($sock($sockname).mark,4,126) ] ],2,44) + 1),$v1)
    var %y $gettok(% [ $+ [ $gettok($sock($sockname).mark,4,126) ] ],2,44)
    var %single 0,%100 0,%10 0
    while (%y < %x) {
      var %exp $calc($floor($calc(%y * %y / 600)) * 35)
      if (%y == $gettok(% [ $+ [ $gettok($sock($sockname).mark,4,126) ] ],2,44)) {
        var %xpneeded $calc($xpforlevel($calc(%y + 1)) - $gettok(% [ $+ [ $gettok($sock($sockname).mark,4,126) ] ],3,44))
      }
      else {
        var %xpneeded $calc($xpforlevel($calc(%y + 1)) - $xpforlevel(%y))
      }
      inc %single $calc(%xpneeded / %exp)
      inc %10 $calc(%xpneeded / $calc($calc($calc(%exp * 10) * .01) + $calc(%exp * 10)))
      inc %100 $calc(%xpneeded / $calc($calc($calc(%exp * 100) * .1) + $calc(%exp * 100)))
      inc %y
    }
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1(%name,$upper($gettok($sock($sockname).mark,2,126))),$chr(93),:) $c1(%name,$ceil(%single)) $c2(%name,single points $+ $chr(44)) $c1(%name,$ceil(%10)) $c2(%name,sets of 10) $+($chr(40),$c1(%name,$calc($ceil(%10) * 10)),$chr(32) $+ $c2(%name,points),$chr(41))) $+ $c2(%name,$chr(44) or) $c1(%name,$ceil(%100)) $c2(%name,sets of 100 points) $+($chr(40),$c1(%name,$calc($ceil(%100) * 100)),$c2(%name,$chr(160) $+ points),$chr(41)) $c2(%name,needed for level) $c1(%name,%x $gettok($sock($sockname).mark,4,126)) $+ $c2(%name,.)
    sockclose $sockname
  }
}
on $*:TEXT:/^[!@]rank/Si:#: {
  if ($2 == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,The syntax is: !rank <skill> <position>)
    halt
  }
  if ($skill2($2) == $null) || ($3 !isnum 1-1000000) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93).:) $c2($nick,The syntax is: !rank <skill> <position>)
    halt
  }
  var %x 1
  while ($sock(rank. $+ %x)) {
    inc %x
  }
  sockopen $+(rank.,%x) hiscore.runescape.com 80
  sockmark $+(rank.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $skill2($2) $+ ~ $+ $3 $+ ~ $+ $nick
}
on *:SOCKOPEN:rank.*: {
  sockwrite -nt $sockname GET /overall.ws?table= $+ $skill3($gettok($sock($sockname).mark,2,126)) $+ &rank= $+ $gettok($sock($sockname).mark,3,126) HTTP/1.1
  sockwrite -nt $sockname Host: hiscore.runescape.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:rank.*: {
  var %read
  sockread %read
  if (*AA0022* iswm %read) && (*hiscorepersonal.ws* !iswm %read) {
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $remove($gettok(%read,2,62),</span,</font)
  }
  if (*AA0022* iswm %read) && (*hiscorepersonal.ws* iswm %read) {
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $remove($gettok(%read,3,62),</span)
  }
  if (*</html>* iswm %read) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,2,126)),$chr(93),:) $c2($gettok($sock($sockname).mark,4,126),Rank) $+ : $c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,5,126)) $chr(124) $c2($gettok($sock($sockname).mark,4,126),Name) $+ : $c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,6,126)) $chr(124) $c2($gettok($sock($sockname).mark,4,126),Experience) $+ : $c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,8,126)) $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,7,126)),$chr(93))
    sockclose $sockname
  }
}
on $*:TEXT:/^[!@](overall|att|attack|str|strength|def|defence|hp|hitpoints|range|ranged|ranging|pray|prayer|praying|mage|magic|cook|cooking|woodcutting|wc|woodcut|fletch|fletching|fish|fishing|fm|firemaking|craft|crafting|smith|smithing|mine|mining|herb|herby|herblore|agil|agility|thief|thieving|slay|slayer|farm|farming|rc|runecraft|runecrafting|hunt|hunter|hunting|con|construction|sum)/Si:#: {
  if ($2- == $null) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,You must specify a player or default name.)
    halt
  }
  var %x 1,%y
  while (%x <= $numtok($replace($2-,$chr(95),$chr(32),$chr(45),$chr(32)),32)) {
    if ($gettok($replace($2-,$chr(95),$chr(32),$chr(45),$chr(32)),%x,32) !isalnum) {
      inc %y
    }
    inc %x
  }
  if (%y == $numtok($replace($2-,$chr(95),$chr(32),$chr(45),$chr(32)),32)) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,You must specify a player or default name.)
    halt
  }
  var %x 1
  while ($sock(level. $+ %x)) {
    inc %x
  }
  var %y 1
  while (%y <= $numtok($2-,32)) {
    if ($gettok($remove($2-,$chr(95)),%y,32) isalnum) {
      var %name  %name $gettok($2-,%y,32)
    }
    elseif (#* iswm $v1) {
      var %# $v2
    }
    elseif ($chr(38) isin $gettok($2-,%y,32)) {
      var %name  $readini(botinfo.ini,n,defname,$address($left($v2,-1),3))
    }
    elseif (@* iswm $gettok($2-,%y,32)) {
      var %clu $v2
    }
    inc %y
  }
  sockopen $+(level.,%x) hiscore.runescape.com 80
  sockmark $+(level.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $iif(%name,%name,$readini(botinfo.ini,n,defname,$address($nick,3))) $+ ~ $+ $nick $+ ~ $+ $right($1,-1) $+ ~ $+ $iif(%#,$right(%#,-1),0) $+ ~ $+ $iif(%clu,%clu)
}
on *:SOCKOPEN:level.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:level.*: {
  var %read
  sockread %read
  if (404 - page isin %read) {
    $gettok($sock($sockname).mark,1,126) *** $chr(91) $+ $c1($gettok($sock($sockname).mark,3,126),$upper($gettok($sock($sockname).mark,2,126))) $+ $chr(93) $+ : $c2($gettok($sock($sockname).mark,3,126),does not appear in the) $c1($gettok($sock($sockname).mark,3,126),$skill2($gettok($sock($sockname).mark,4,126))) $c2($gettok($sock($sockname).mark,3,126),high scores list.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %read) {
    var %x 0
    if ($gettok($sock($sockname).mark,4,126) == Overall) {
      if (-1 isin %read) {
        $gettok($sock($sockname).mark,1,126) *** $chr(91) $+ $c1($gettok($sock($sockname).mark,3,126),$upper($gettok($sock($sockname).mark,2,126))) $+ $chr(93) $+ : $c2($gettok($sock($sockname).mark,3,126),does not appear in the) $c1($gettok($sock($sockname).mark,3,126),Overall) $c2($gettok($sock($sockname).mark,3,126),high scores list.)
        sockclose $sockname
        halt
      }
      var %ranged,%magic,%att,%str,%def,%hp,%prayer
      sockread %att
      sockread %def
      sockread %str
      sockread %hp
      sockread %ranged
      sockread %prayer
      sockread %magic
      var %att $iif($gettok(%att,2,44) == -1,1,$v1)
      var %def $iif($gettok(%def,2,44) == -1,1,$v1)
      var %str $iif($gettok(%str,2,44) == -1,1,$v1)
      var %hp $iif($gettok(%hp,2,44) == -1,10,$v1)
      var %ranged $iif($gettok(%ranged,2,44) == -1,1,$v1)
      var %prayer $iif($gettok(%prayer,2,44) == -1,1,$v1)
      var %magic $iif($gettok(%magic,2,44) == -1,1,$v1)
      var %1 1, %summon
      while (%1 <= 17) {
        sockread %summon
        inc %1
      }
      var %summon = $iif(- !isin $gettok(%summon,2,44),$v2,1)
      var %f $gettok($sock($sockname).mark,3,126)
      $gettok($sock($sockname).mark,1,126) *** $chr(91) $+ $c1($gettok($sock($sockname).mark,3,126),$upper($gettok($sock($sockname).mark,2,126))) $+ $chr(93) $+ : $chr(91) $+ $c1(%f,$skill(%x)) $+ $chr(93) $c2(%f,Level) $+ : $c1(%f,$bytes($gettok(%read,2,44),db)) $chr(124) $c2(%f,Experience) $+ : $c1(%f,$bytes($gettok(%read,3,44),db)) $chr(40) $+ $c1(%f,$round($calc($gettok(%read,3,44) / 299791913 * 100),2) $+ $chr(37)) $c2(%f,of 99) $+ $chr(41) $chr(124) $c2(%f,Rank) $+ : $c1(%f,$bytes($gettok(%read,1,44),db)) $chr(124) $c2(%f,Combat) $+ : $c1(%f,$cmblvl(%att,%str,%def,%hp,%ranged,%prayer,%magic,%summon))
      sockclose $sockname
      halt
    }
    while ($skill2($gettok($sock($sockname).mark,4,126)) != $skill(%x)) {
      sockread %read
      inc %x
    }
    if ($gettok($sock($sockname).mark,5,126) != 0) && ($gettok($sock($sockname).mark,5,126) <= $gettok(%read,2,44)) {
      $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),You must specify a level higher than your current.)
      sockclose $sockname
      halt
    }
    if (-1 isin %read) {
      $gettok($sock($sockname).mark,1,126) *** $chr(91) $+ $c1($gettok($sock($sockname).mark,3,126),$upper($gettok($sock($sockname).mark,2,126))) $+ $chr(93) $+ : $c2($gettok($sock($sockname).mark,3,126),does not appear in the) $c1($gettok($sock($sockname).mark,3,126),$skill(%x)) $c2($gettok($sock($sockname).mark,3,126),high scores list.)
      sockclose $sockname
      halt
    }
    var %f $gettok($sock($sockname).mark,3,126)
    if ($gettok($sock($sockname).mark,5,126)) && (@ !isin $gettok($sock($sockname).mark,5,126)) {
      var %level $gettok($sock($sockname).mark,5,126)
    }
    else {
      var %level $calc($gettok(%read,2,44) + 1)
    }
    var %level $iif($gettok($sock($sockname).mark,5,126) != 0,$v1,$calc($gettok(%read,2,44) + 1))
    var %y $calc($gettok(%read,3,44) - $xpforlevel($gettok(%read,2,44)))
    var %y $calc(%y / $calc($xpforlevel($iif($gettok($sock($sockname).mark,5,126),$v1,$calc($gettok(%read,2,44) + 1))) - $xpforlevel($gettok(%read,2,44))))
    var %y $round($calc(%y * 100),1)
    var %y $chr(40) $+ $c1($gettok($sock($sockname).mark,3,126),%y $+ $chr(37)) $c2(%f,to %level) $+ $chr(41)
    $gettok($sock($sockname).mark,1,126) *** $chr(91) $+ $c1(%f,$upper($gettok($sock($sockname).mark,2,126))) $+ $chr(93) $+ : $chr(91) $+ $c1(%f,$skill(%x)) $+ $chr(93) $c2(%f,Level) $+ : $c1(%f,$gettok(%read,2,44)) $chr(124) $c2(%f,Experience) $+ : $c1(%f,$bytes($gettok(%read,3,44),db)) $chr(40) $+ $c1(%f,$round($calc($gettok(%read,3,44) / 13034431 * 100),2) $+ $chr(37)) $c2(%f,of 99) $+ $chr(41) $chr(124) $c2(%f,Rank) $+ : $c1(%f,$bytes($gettok(%read,1,44),db)) $iif($gettok(%read,2,44) != 99,$chr(124) $c2(%f,Experience to level) $c1(%f,%level) $+ : $c1(%f,$bytes($calc($xpforlevel(%level) - $gettok(%read,3,44)),db))) $iif($gettok(%read,2,44) != 99,%y)
    if ($gettok(%read,2,44) != 99) && ($skill(%x) != Slayer) {
      notice $gettok($sock($sockname).mark,3,126) $FNL($skill(%x),$calc($xpforlevel(%level) - $gettok(%read,3,44)),$gettok($sock($sockname).mark,3,126),$iif($gettok($sock($sockname).mark,6,126),$right($gettok($sock($sockname).mark,6,126),-1)))
    }
    sockclose $sockname
  }
}
on *:TEXT:!param*:#: {
  if (% [ $+ [ $gettok($address($nick,2),2-,64) ] ] != $null) {
    notice $nick $c2($nick,Please wait) $c1($nick,% [ $+ [ $gettok($address($nick,2),2-,64) ] ]) $c2($nick,more seconds before useing) $c1($nick,!param) $c2($nick,again.)
    halt
  }
  set -z $+(%,$gettok($address($nick,2),2-,64)) 30
  if ($skill2($2) == Construction) {
    notice $nick $c2($nick,Parameters for) $c1($nick,$skill2($2)) $+ : $c2($nick,Normal Plank) $+ , $c2($nick,Oak Plank) $+ , $c2($nick,Teak Plank) $+ , $c2($nick,Mahogany Plank) $+ . $c2($nick,There are also the individual things you can make with the planks, but they are too numerous to list.)
    halt
  }
  if ($skill2($2)) {
    var %x 1
    while ($ini(eparam.ini,%x) != $skill2($2)) {
      inc %x
    }
    var %y 1
    while (%y <= $ini(eparam.ini,%x,0)) {
      if ($len($replace(%z,$chr(44),a)) >= 900) {
        var %c %z
        unset %z
      }
      var %z %z $+ $iif(%z,$chr(44)) $c2($nick,$ini(eparam.ini,%x,%y))
      inc %Y
    }
    if ($len($replace(%z,$chr(44),a)) >= 290) {
      var %c $gettok(%z,1- $+ $calc($numtok(%z,44) / 2),44)
      var %z $gettok(%z,$calc($numtok(%z,44) / 2 + 1) $+ -,44)
    }
    if (%c != $null) {
      if ($len($replace(%c,$chr(44),a)) >= 324) {
        var %d $gettok(%c,1- $+ $calc($numtok(%c,44) / 2),44)
        var %c $gettok(%c,$calc($numtok(%c,44) / 2 + 1) $+ -,44)
      }
      if (%d != $null) {
        notice $nick $c2($nick,Parameters for) $c1($nick,$skill2($2)) $+ : %d $+ ,
        notice $nick $gettok(%c,1-27,44) $+ ,
        notice $nick $gettok(%c,28-,44) $gettok(%z,1- $+ $calc($numtok(%z,32) / 2),32)
        if ($gettok(%z,$calc($floor($calc($numtok(%z,32) / 2)) + 1) $+ -,32)) {
          notice $nick $v1 $+ .
        }
      }
      else {
        notice $nick $c2($nick,Parameters for) $c1($nick,$skill2($2)) $+ : %c $+ ,
        notice $nick %z $+ .
      }
    }
    else {
      notice $nick $c2($nick,Parameters for) $c1($nick,$skill2($2)) $+ : %z $+ .
    }
  }
}
on $*:TEXT:/^[!@]compare/Si:#: {
  if ($skill2($2) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,Syntax is: !compare <skill> <user1> [user2]. Spaces in names must be underscores. User2 may be ommited if you have a defname set.)
    halt
  }
  if ($4 == $null) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,you must specify a second user or set a default name.)
    halt
  }
  var %y 1
  while (%y <= $numtok($2-,32)) {
    if ($chr(38) isin $gettok($2-,%y,32)) {
      if ($readini(botinfo.ini,n,defname,$address($left($gettok($2-,%y,32),-1),3)) == $null) {
        $iif($left($1,1) == @,msg $chan,notice $nick) $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,The name) $qt($c1($nick,$left($gettok($2-,%y,32),-1))) $c2($nick,does not have a defname set OR is not in the channel.)
        halt
      }
      if (%nick1 == $null) {
        var %nick1 $readini(botinfo.ini,n,defname,$address($left($gettok($2-,%y,32),-1),3))
      }
      else {
        var %nick2 $readini(botinfo.ini,n,defname,$address($left($gettok($2-,%y,32),-1),3))
      }
    }
    inc %y
  }
  if (%nick1 == $null) {
    var %nick1 $iif($4,$3,$readini(botinfo.ini,n,defname,$address($nick,3)))
    var %nick2 $iif($4,$4,$3)
  }
  if (%nick2 == $null) {
    if ($4) {
      var %nick2 $iif($chr(38) !isin $4,$4,$3)
    }
    else {
      var %nick2 %nick1
      var %nick1 $readini(botinfo.ini,n,defname,$address($nick,3))
    }
  }
  if (%nick1 == %nick2) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Compare),$chr(93),:) $c2($nick,Wow!) $c1($nick,%nick1) $c2($nick,has the same levels and experience as) $c1($nick,%nick2) $+ $c2($nick,. Who knew?)
    halt
  }
  var %x 1
  while ($sock(compare. $+ %x)) {
    inc %x
  }
  sockopen $+(compare.,%x) hiscore.runescape.com 80
  sockmark $+(compare.,%x) -1 $+ ~ $+ $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $skill2($2) $+ ~ $+ $nick $+ ~ $+ %nick1 $+ ~ $+ %nick2
}
on *:SOCKOPEN:compare.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,5,126) HTTP/1.1
  sockwrite -n $sockname host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:compare.*: {
  var %read
  sockread %read
  if (*404 - page not* iswm %read) {
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Compare),$chr(93).:) $c2($gettok($sock($sockname).mark,4,126),The stats of) $qt($c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,5,126))) $c2($gettok($sock($sockname).mark,4,126),were not found.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %read) {
    var %x 0
    while ($gettok($sock($sockname).mark,3,126) != $skill(%x)) {
      sockread %read
      inc %x
    }
    if (-1 isin %read) {
      $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Compare),$chr(93),:) $c2($gettok($sock($sockname).mark,4,126),The name) $qt($c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,5,126))) $c2($gettok($sock($sockname).mark,4,126),is not ranked in the skill) $c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,3,126)) $+ $c2($gettok($sock($sockname).mark,4,126),.)
      sockclose $sockname
      halt
    }
    sockopen $+(compare2.,$gettok($sockname,2,46)) hiscore.runescape.com 80
    sockmark $+(compare2.,$gettok($sockname,2,46)) -1 $+ ~ $+ $gettok($sock($sockname).mark,2-,126) $+ ~ $+ %read
    sockclose $sockname
    halt
  }
}
on *:SOCKOPEN:compare2.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,6,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:compare2.*: {
  var %p2
  sockread %p2
  if (*404 - page not* iswm %p2) {
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Compare),$chr(93).:) $c2($gettok($sock($sockname).mark,4,126),The stats of) $qt($c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,6,126))) $c2($gettok($sock($sockname).mark,4,126),were not found.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %p2) {
    var %x 0
    while ($gettok($sock($sockname).mark,3,126) != $skill(%x)) {
      sockread %p2
      inc %x
    }
    if (-1 isin %p2) {
      $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Compare),$chr(93),:) $c2($gettok($sock($sockname).mark,4,126),The name) $qt($c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,6,126))) $c2($gettok($sock($sockname).mark,4,126),is not ranked in the skill) $c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,3,126)) $+ $c2($gettok($sock($sockname).mark,4,126),.)
      sockclose $sockname
      halt
    }
    var %p1 $gettok($sock($sockname).mark,7,126)
    var %name $gettok($sock($sockname).mark,4,126)
    var %name1 $gettok($sock($sockname).mark,5,126)
    var %name2 $gettok($sock($sockname).mark,6,126)
    if ($gettok(%p1,2,44) == $gettok(%p2,2,44)) {
      $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1(%name,Compare),$chr(93),:) $c1(%name,%name1) $c2(%name,has the same) $c1(%name,$gettok($sock($sockname).mark,3,126)) $c2(%name,level as) $c1(%name,%name2) $+($chr(40),$c1(%name,$gettok(%p1,2,44)),$chr(41)) $+ $c2(%name,.) $c1(%name,$iif($gettok(%p1,3,44) > $gettok(%p2,3,44),%name1,%name2)) $c2(%name,has) $c1(%name,$bytes($calc($iif($gettok(%p1,3,44) > $gettok(%p2,3,44),$v1 - $v2,$v2 - $v1)),db)) $c2(%name,more) $c1(%name,$gettok($sock($sockname).mark,3,126)) $c2(%name,experience than) $c1(%name,$iif($gettok(%p1,3,44) > $gettok(%p2,3,44),%name2,%name1))) $+ $c2(%name,.)
      sockclose $sockname
      halt
    }
    else {
      $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1(%name,Compare),$chr(93),:) $c1(%name,$iif($gettok(%p1,2,44) > $gettok(%p2,2,44),%name1,%name2)) $c2(%name,is) $c1(%name,$calc($iif($gettok(%p1,2,44) > $gettok(%p2,2,44),$v1,$v2) - $iif($gettok(%p1,2,44) > $gettok(%p2,2,44),$v2,$v1)) $gettok($sock($sockname).mark,3,126)) $c2(%name,levels higher than) $c1(%name,$iif($gettok(%p1,2,44) > $gettok(%p2,2,44),%name2,%name1)) $+ $c2(%name,.) $c1(%name,$iif($gettok(%p1,3,44) > $gettok(%p2,3,44),%name1,%name2)) $c2(%name,has) $c1(%name,$bytes($calc($iif($gettok(%p1,3,44) > $gettok(%p2,3,44),$v1,$v2) - $iif($gettok(%p1,3,44) > $gettok(%p2,3,44),$v2,$v1)),db)) $c2(%name,more) $c1(%name,$gettok($sock($sockname).mark,3,126)) $c2(%name,experience than) $c1(%name,$iif($gettok(%p1,3,44) > $gettok(%p2,3,44),%name2,%name1)) $+ $c2(%name,.)
      if (($gettok(%p1,2,44) != 99) || ($gettok(%p2,2,44) != 99)) && ($gettok($sock($sockname).mark,3,126) != Overall) && ($gettok($sock($sockname).mark,3,126) != Slayer) {
        notice %name $FNL($gettok($sock($sockname).mark,3,126),$iif($gettok(%p1,3,44) > $gettok(%p2,3,44),$calc($v1 - $v2),$calc($v2 - $v1)),%name)
      }
    }
    sockclose $sockname
    halt
  }
}
on $*:TEXT:/^(`|[!@]Calc)/Si:#: {
  if ($left($1,1) == `) && ($mid($1,2,1) !isnum) halt
  var %x $chr(40) $+ $replace($iif($left($1,1) == `,$remove($1-,`),$2-),k,* 1000,m,* 1000000,b,* 1000000000,/,$+($chr(41),/,$chr(40))) $+ $chr(41)
  $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** [ $+ $c1($nick,Calc) $+ ]: $c1($nick,$iif($left($1,1) == `,$remove($1-,`),$2-)) $c2($nick,=) $c1($nick,$bytes($calc($eval(%x,1)),db))
}
on $*:TEXT:/^[!@]clan/Si:#: {
  if ($2- == $null) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,You must specify a player or default name.)
    halt
  }
  var %x 1
  while ($sock(clan. $+ %x)) {
    inc %x
  }
  if ($chr(38) isin $2) || ($2 == $null) {
    if ($readini(botinfo.ini,n,defname,$address($remove($iif($2,$2,$nick),&),3))) {
      var %name  $v1
    }
    else {
      $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** [ $+ $c1($nick,Error) $+ ]: $c2($nick,The name) $qt($c1($nick,$remove($2,&))) $c2($nick,does not have a defname set OR is not on the channel.)
      halt
    }
  }
  else {
    var %name  $replace($2-,$chr(32),$chr(95),$chr(45),$chr(95))
  }
  sockopen $+(clan.,%x) runehead.com 80
  sockmark $+(clan.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ %name $+ ~ $+ $nick
}
on *:SOCKOPEN:clan.*: {
  sockwrite -nt $sockname GET /clans/search.php?search= $+ $gettok($sock($sockname).mark,2,126) $+ &mltype=0&id=exact HTTP/1.1
  sockwrite -nt $sockname Host: runehead.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:clan.*: {
  var %read
  sockread %read
  if (*no results* iswm %read) {
    $gettok($sock($sockname).mark,1,126) *** $chr(91) $+ $c1($gettok($sock($sockname).mark,3,126),Clan) $+ $chr(93) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,2,126)) $c2($gettok($sock($sockname).mark,3,126),was not found in the RSHSC.)
    sockclose $sockname
  }
  if (*<tr class='hovertr'>* iswm %read) {
    sockread %read
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,3,62),</a)) $c2($gettok($sock($sockname).mark,3,126),$+($chr(40),URL:)) $c1($gettok($sock($sockname).mark,3,126),http://runehead.com/clans/ $+ $gettok(%read,4,39)) $+ $chr(41)
  }
  if (*</table>* iswm %read) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Clan),$chr(93),:) $c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,2,126)) $c2($gettok($sock($sockname).mark,3,126),is in $+(clan,$chr(40),s,$chr(41))) $+ : $replace($gettok($sock($sockname).mark,4-,126),~,$+($chr(32),$chr(124),$chr(32)))
    sockclose $sockname
  }
}
on $*:TEXT:/^[!@]price/Si:#: {
  if ($2- == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Price),$chr(93),:) $c2($nick,You must specify an item to lookup.)
    halt
  }
  var %x 1
  while ($sock(price. $+ %x)) {
    inc %x
  }
  sockopen $+(price.,%x) zybez.net 80
  sockmark $+(price.,%x) 0 $+ ~ $+ $iif($left($1,1) == @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick)nick) $+ ~ $+ $replace($2-,$chr(32),$chr(43)) $+ ~ $+ $nick
}
on *:SOCKOPEN:price.*: {
  sockwrite -nt $sockname GET /priceguide.php?search_terms= $+ $gettok($sock($sockname).mark,3,126) $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1
  sockwrite -nt $sockname Host: www.zybez.net
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:price.*: {
  var %read,%price,%name
  var %price
  sockread %read
  if (*><a href="/items.php* iswm %read) {
    sockread %name
    sockread %price
    sockread %price
    sockread %price
    var %x $gettok($sock($sockname).mark,1,126)
    inc %x
    if ($numtok($sock($sockname).mark,124) < 6) {
      sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126) $+ ~ $+ $c2($gettok($sock($sockname).mark,4,126),$remove($gettok(%name,2,62),</td)) $+ : $c1($gettok($sock($sockname).mark,4,126),$remove($gettok(%price,2,62),</td)) $chr(124)
    }
  }
  if (*</table></form><br* iswm %read) {
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Price),$chr(93),:) $left($replace($gettok($gettok($sock($sockname).mark,5-,126),1-6,126),~,$chr(32)),-2))) $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),zybez.net),$chr(93))
    sockclose $sockname
  }
  if (*your search did not* iswm %read) {
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Price),$chr(93),:) $c2($gettok($sock($sockname).mark,4,126),No results for) $qt($c1($gettok($sock($sockname).mark,4,126),$replace($gettok($sock($sockname).mark,3,126),$chr(43),$chr(32)))) $+ $c2($gettok($sock($sockname).mark,4,126),.) $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),zybez.net),$chr(93))
    sockclose $sockname
  }
}
on $*:TEXT:/^[!@]cmb%/Si:#: {
  if ($2 == $null) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a player or default name.)
    halt
  }
  if ($chr(38) isin $2) {
    if ($readini(botinfo.ini,n,defname,$address($left($2,-1),3)) != $null) {
      var %name  $v1
    }
    else {
      $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,The name) $qt($c1($nick,$left($2,-1))) $c2($nick,does not have a defname set OR is not in the channel.)
      halt
    }
  }
  if ($2 == $null) {
    var %name  $readini(botinfo.ini,n,defname,$address($nick,3))
  }
  if (%name == $null) {
    var %name  $replace($2-,$chr(32),$chr(95))
  }
  var %x 1
  while ($sock(cmbpercent. $+ %x)) {
    inc %x
  }
  sockopen $+(cmbpercent.,%x) hiscore.runescape.com 80
  sockmark $+(cmbpercent.,%x) -1 $+ ~ $+ $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ %name $+ ~ $+ $nick $+ ~ $+ 0 $+ ~ $+ 0
}
on *:SOCKOPEN:cmbpercent.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,3,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:cmbpercent.*: {
  var %read
  sockread %read
  if (*404 - page not* iswm %read) {
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,4,126),The name) $qt($c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,3,126))) $c2($gettok($sock($sockname).mark,4,126),is not ranked in the hiscores.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %read) {
    var %x $gettok($sock($sockname).mark,1,126)
    inc %x
    sockmark $sockname %x $+ ~ $+ $gettok($sock($sockname).mark,2-,126)
    if ($gettok($sock($sockname).mark,1,126) <= 7) && ($gettok($sock($sockname).mark,1,126) >= 1) {
      var %y $gettok($sock($sockname).mark,5,126)
      inc %y $gettok(%read,3,44)
      sockmark $sockname $gettok($sock($sockname).mark,1-4,126) $+ ~ $+ %y
    }
    if ($gettok($sock($sockname).mark,1,126) >= 8) && ($v1 <= 23) {
      var %z $gettok($sock($sockname).mark,6,126)
      inc %z $gettok(%read,3,44)
      sockmark $sockname $gettok($sock($sockname).mark,1-5,126) $+ ~ $+ %z
    }
    if ($gettok($sock($sockname).mark,1,126) == 24) {
      var %y $gettok($sock($sockname).mark,5,126)
      inc %y $gettok(%read,3,44)
      sockmark $sockname $gettok($sock($sockname).mark,1-4,126) $+ ~ $+ %y $+ ~ $+ $gettok($sock($sockname).mark,6-,126)
      $gettok($sock($sockname).mark,2,126) $+($chr(91),$c1($gettok($sock($sockname).mark,4,126),Combat Percent),$chr(93),:) $c1($gettok($sock($sockname).mark,4,126),$gettok($sock($sockname).mark,3,126)) $c2($gettok($sock($sockname).mark,4,126),is) $c1($gettok($sock($sockname).mark,4,126),$calc($calc($gettok($sock($sockname).mark,5,126) / $calc($gettok($sock($sockname).mark,5,126) + $gettok($sock($sockname).mark,6,126))) * 100) $+ %) $c2($gettok($sock($sockname).mark,4,126),combat based $+ $chr(44) with) $c1($gettok($sock($sockname).mark,4,126),$bytes($gettok($sock($sockname).mark,5,126),db)) $c2($gettok($sock($sockname).mark,4,126),combat based experience $+ $chr(44) and) $c1($gettok($sock($sockname).mark,4,126),$bytes($calc($gettok($sock($sockname).mark,5,126) + $gettok($sock($sockname).mark,6,126)),db)) $c2($gettok($sock($sockname).mark,4,126),total experience.)
      sockclose $sockname
    }
  }
}
on $*:TEXT:/^[!@]cmb-est/Si:#: {
  if ($2- == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+($chr(91),$c1($nick,CMB-EST),$chr(93),:) $c2($nick,You must specify an attack, strength, defence, hitpoints, ranged, prayer, magic, and summon level.)
    halt
  }
  if (!$9) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+($chr(91),$c1($nick,CMB-EST),$chr(93),:) $c2($nick,You must specify attack, strength, defence, hitpoints, range, prayer, magic, and summon level.)
    halt
  }
  if ($2 isnum 1-99) && ($3 isnum 1-99) && ($4 isnum 1-99) && ($5 isnum 1-99) && ($6 isnum 1-99) && ($7 isnum 1-99) && ($8 isnum 1-99) && ($9 isnum 1-99) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+($chr(91),$c1($nick,CMB-EST),$chr(93),:) $c2($nick,Level) $+ : $c1($nick,$gettok($cmblvl($2,$3,$4,$5,$6,$7,$8,$9),1,32)) $+($chr(91),$c1($nick,$gettok($cmblvl($2,$3,$4,$5,$6,$7,$8),2,32)),$chr(93)) $chr(124) $c2($nick,$+(ASD,$chr(2),H,$chr(2),RPMU)) $c1($nick,$2 $3 $4 $+($chr(2),$5,$chr(2)) $6 $7 $8 $9)
    if ($floor($gettok($cmblvl($2,$3,$4,$5,$6,$7,$8,$9),1,32)) != 138) {
      var %info $nextcmblvl(,$2,$3,$4,$5,$6,$7,$8,$9)
      $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,CMB-EST),$chr(93),:) $c2($nick,Next level in) $+ : $c2($nick,Attack/Strength) $+ : $c1($nick,$gettok(%info,1,32)) $c2($nick,Defence/Hitpoints) $+ : $c1($nick,$gettok(%info,2,32)) $c2($nick,Prayer) $+ : $c1($nick,$gettok(%info,3,32)) $c2($nick,Summon) $+ : $c1($nick,$gettok(%info,4,32))
    }
  }
}
on $*:TEXT:/^[!@](cmb|combat)/Si:#: {
  if ($2 == $null) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Combat),$chr(93),:) $c2($nick,Error, you must specify a player or have a default name.)
    halt
  }
  if ($2 == $null) {
    var %name  $readini(botinfo.ini,n,defname,$address($nick,3))
  }
  elseif ($chr(38) isin $2) {
    if ($readini(botinfo.ini,n,defname,$address($left($2,-1),3))) {
      var %name  $readini(botinfo.ini,n,defname,$address($left($2,-1),3))
    }
    else {
      $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Combat),$chr(93),:) $c2($nick,The name) $c1($nick,$left($2,-1)) $c2($nick,does not have a defname set OR is not in the channel.)
      halt
    }
  }
  else {
    var %name  $replace($2-,$chr(32),$chr(95))
  }
  var %x 1
  while ($sock(cmb. $+ %x)) {
    inc %x
  }
  sockopen $+(cmb.,%x) hiscore.runescape.com 80
  sockmark $+(cmb.,%x) -1 $+ ~ $+ $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $nick $+ ~ $+ %name
}
on *:SOCKOPEN:cmb.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,4,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:cmb.*: {
  var %read
  var %att
  var %str
  var %def
  var %hp
  var %range
  var %prayer
  var %magic
  var %summon
  sockread %read
  if (*404 - page not* iswm %read) {
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Combat),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),Combat stats of) $qt($c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,4,126))) $c2($gettok($sock($sockname).mark,3,126),not found.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %read) {
    sockread %att
    sockread %def
    sockread %str
    sockread %hp
    sockread %range
    sockread %prayer
    sockread %magic
    var %1 1
    while (%1 <= 17) {
      sockread %summon
      inc %1
    }
    var %att $iif($gettok(%att,2,44) == -1,1,$v1)
    var %def $iif($gettok(%def,2,44) == -1,1,$v1)
    var %str $iif($gettok(%str,2,44) == -1,1,$v1)
    var %hp $iif($gettok(%hp,2,44) == -1,10,$v1)
    var %range $iif($gettok(%range,2,44) == -1,1,$v1)
    var %prayer $iif($gettok(%prayer,2,44) == -1,1,$v1)
    var %magic $iif($gettok(%magic,2,44) == -1,1,$v1)
    var %summon $iif($gettok(%summon,2,44) == -1,1,$v1)
    var %info $cmblvl(%att,%str,%def,%hp,%range,%prayer,%magic,%summon)
    var %f2pcmb $f2pcmblvl(%att,%str,%def,%hp,%range,%prayer,%magic)
    var %info2 $nextcmblvl(,%att,%str,%def,%hp,%range,%prayer,%magic,%summon)
    $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Combat),$chr(93),:) $c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,4,126)) $c2($gettok($sock($sockname).mark,3,126),is level) $c1($gettok($sock($sockname).mark,3,126),$gettok(%info,1,32)) $+($chr(40),$c1($gettok($sock($sockname).mark,3,126),F2P $gettok(%f2pcmb,1,32)),$chr(41)) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$gettok(%info,2,32)),$chr(93)) $chr(124) $c2($gettok($sock($sockname).mark,3,126),$+(ASD,$chr(2),H,$chr(2),RPMU)) $+ : $c1($gettok($sock($sockname).mark,3,126),%att %str %def $+($chr(2),%hp,$chr(2)) %range %prayer %magic %summon)
    if (%info2 != N/A N/A N/A N/A) {
      $gettok($sock($sockname).mark,2,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Combat),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),Next level in) $+ : $c2($gettok($sock($sockname).mark,3,126),Attack/Strength) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok(%info2,1,32)) $c2($gettok($sock($sockname).mark,3,126),Defence/Hitpoints) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok(%info2,2,32)) $c2($gettok($sock($sockname).mark,3,126),Prayer) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok(%info2,3,32)) $c2($gettok($sock($sockname).mark,3,126),Summon) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok(%info2,4,32))
    }
    sockclose $sockname
    halt
  }
}
on $*:TEXT:/^[!@](players?|world)/Si:#: {
  if ($1- == !world) halt
  if ($2 != $null) && ($2 !isnum 1-144) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Players),$chr(93),:) $c2($nick,You must specify a number and it must be between 1 and 144.)
    halt
  }
  if ($2 == $null) {
    var %x 1
    while ($sock(totalplayers. $+ %x)) {
      inc %x
    }
    sockopen $+(totalplayers.,%x) runescape.com 80
    sockmark $+(totalplayers.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $nick
    halt
  }
  var %x 1
  while ($sock(players. $+ %x)) {
    inc %x
  }
  sockopen $+(players.,%x) runescape.com 80
  sockmark $+(players.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $2 $+ ~ $+ $nick
}
on *:SOCKOPEN:players.*: {
  sockwrite -nt $sockname GET /slj.ws?lores.x=0&plugin=0&order=WMLPA HTTP/1.1
  sockwrite -nt $sockname Host: runescape.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:players.*: {
  var %read
  sockread %read
  if ($+(*e,$chr(40),$gettok($sock($sockname).mark,2,126),*) iswm %read) {
    if ($gettok(%read,2,34) != -) {
      var %activity $chr(124) $c2($gettok($sock($sockname).mark,3,126),Activity) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok(%read,2,34))
    }
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Players),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),Server) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok($gettok(%read,2,40),1,44)) $chr(124) $c2($gettok($sock($sockname).mark,3,126),Players) $+ : $c1($gettok($sock($sockname).mark,3,126),$gettok(%read,7,44)) $chr(124) $c2($gettok($sock($sockname).mark,3,126),Type) $+ : $c1($gettok($sock($sockname).mark,3,126),$iif($gettok(%read,2,44) == 1,P2P,F2P)) %activity
    sockclose $sockname
  }
}
on *:SOCKOPEN:totalplayers.*: {
  sockwrite -n $sockname GET /title.ws HTTP/1.1
  sockwrite -n $sockname Host: runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:totalplayers.*: {
  var %read
  sockread %read
  if (*There are currently*people playing* iswm %read) {
    $gettok($sock($sockname).mark,1,126) $+($chr(91),$c1($gettok($sock($sockname).mark,2,126),Players),$chr(93),:) $c2($gettok($sock($sockname).mark,2,126),There are currently) $c1($gettok($sock($sockname).mark,2,126),$bytes($gettok(%read,4,32),db)) $c2($gettok($sock($sockname).mark,2,126),people playing.)
    sockclose $sockname
  }
}
on $*:TEXT:/^[!@](nextlevel|nextlvl)/Si:#: {
  if ($2 == $null) && ($readini(botinfo.ini,n,defname,$address($nick,3)) == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a player to lookup or set a default name.)
    halt
  }
  var %x 1
  while ($sock(nextlevel. $+ %x)) {
    inc %x
  }
  if ($2 != $null) {
    if ($chr(38) !isin $2) {
      var %name  $replace($2-,$chr(32),$chr(95))
    }
    else {
      if ($readini(botinfo.ini,n,defname,$address($left($2,-1),3)) != $null) {
        var %name  $v1
      }
      else {
        $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,The name) $qt($c1($nick,$left($2,-1))) $c2($nick,does not have a defname set OR is not in the channel.)
        halt
      }
    }
  }
  else {
    var %name  $readini(botinfo.ini,n,defname,$address($nick,3))
  }
  sockopen $+(nextlevel.,%x) hiscore.runescape.com 80
  sockmark $+(nextlevel.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ %name $+ ~ $+ $nick
}
on *:SOCKOPEN:nextlevel.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:nextlevel.*: {
  var %overall,%attack,%strength,%defence,%ranged,%prayer,%magic,%runecraft,%construction,%hitpoints,%agility,%herblore,%thieving,%crafting,%fletching,%slayer,%hunter,%mining,%smithing,%fishing,%cooking,%firemaking,%woodcutting,%farming,%summoning
  sockread %overall
  if (*404 - page not* iswm %overall) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),The name) $qt($c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,2,126))) $c2($gettok($sock($sockname).mark,3,126),is not in the hiscores.)
    sockclose $sockname
    halt
  }
  if (*,*,* iswm %overall) {
    if ($gettok(%overall,2,44) == 2376) {
      $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),The name) $qt($c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,2,126))) $c2($gettok($sock($sockname).mark,3,126),can not raise any more levels!)
      sockclose $sockname
      halt
    }
    sockread %attack
    sockread %defence
    sockread %strength
    sockread %hitpoints
    sockread %ranged
    sockread %prayer
    sockread %magic
    sockread %cooking
    sockread %woodcutting
    sockread %fletching
    sockread %fishing
    sockread %firemaking
    sockread %crafting
    sockread %smithing
    sockread %mining
    sockread %herblore
    sockread %agility
    sockread %thieving
    sockread %slayer
    sockread %farming
    sockread %runecraft
    sockread %hunter
    sockread %construction
    sockread %summoning
    var %2attack $calc($xpforlevel($calc($gettok(%attack,2,44) + 1)) - $gettok(%attack,3,44))
    var %2defence $calc($xpforlevel($calc($gettok(%defence,2,44) + 1)) - $gettok(%defence,3,44))
    var %2strength $calc($xpforlevel($calc($gettok(%strength,2,44) + 1)) - $gettok(%strength,3,44))
    var %2hitpoints $calc($xpforlevel($calc($gettok(%hitpoints,2,44) + 1)) - $gettok(%hitpoints,3,44))
    var %2ranged $calc($xpforlevel($calc($gettok(%ranged,2,44) + 1)) - $gettok(%ranged,3,44))
    var %2prayer $calc($xpforlevel($calc($gettok(%prayer,2,44) + 1)) - $gettok(%prayer,3,44))
    var %2magic $calc($xpforlevel($calc($gettok(%magic,2,44) + 1)) - $gettok(%magic,3,44))
    var %2cooking $calc($xpforlevel($calc($gettok(%cooking,2,44) + 1)) - $gettok(%cooking,3,44))
    var %2woodcutting $calc($xpforlevel($calc($gettok(%woodcutting,2,44) + 1)) - $gettok(%woodcutting,3,44))
    var %2fletching $calc($xpforlevel($calc($gettok(%fletching,2,44) + 1)) - $gettok(%fletching,3,44))
    var %2fishing $calc($xpforlevel($calc($gettok(%fishing,2,44) + 1)) - $gettok(%fishing,3,44))
    var %2firemaking $calc($xpforlevel($calc($gettok(%firemaking,2,44) + 1)) - $gettok(%firemaking,3,44))
    var %2crafting $calc($xpforlevel($calc($gettok(%crafting,2,44) + 1)) - $gettok(%crafting,3,44))
    var %2smithing $calc($xpforlevel($calc($gettok(%smithing,2,44) + 1)) - $gettok(%smithing,3,44))
    var %2mining $calc($xpforlevel($calc($gettok(%mining,2,44) + 1)) - $gettok(%mining,3,44))
    var %2herblore $calc($xpforlevel($calc($gettok(%herblore,2,44) + 1)) - $gettok(%herblore,3,44))
    var %2agility $calc($xpforlevel($calc($gettok(%agility,2,44) + 1)) - $gettok(%agility,3,44))
    var %2thieving $calc($xpforlevel($calc($gettok(%thieving,2,44) + 1)) - $gettok(%thieving,3,44))
    var %2slayer $calc($xpforlevel($calc($gettok(%slayer,2,44) + 1)) - $gettok(%slayer,3,44))
    var %2farming $calc($xpforlevel($calc($gettok(%farming,2,44) + 1)) - $gettok(%farming,3,44))
    var %2runecraft $calc($xpforlevel($calc($gettok(%runecraft,2,44) + 1)) - $gettok(%runecrafting,3,44))
    var %2hunter $calc($xpforlevel($calc($gettok(%hunter,2,44) + 1)) - $gettok(%hunter,3,44))
    var %2construction $calc($xpforlevel($calc($gettok(%construction,2,44) + 1)) - $gettok(%construction,3,44))))
    var %2summoning $calc($xpforlevel($calc($gettok(%summoning,2,44) + 1)) - $gettok(%summoning,3,44))))
    var %x 1
    while ($gettok(%2attack %2defence %2strength %2hitpoints %2ranged %2prayer %2magic %2cooking %2woodcutting %2fletching %2fishing %2firemaking %2crafting %2smithing %2mining %2herblore %2agility %2thieving %2slayer %2farming %2runecraft %2hunter %2construction %2summoning,%x,32)) {
      if (- !isin $v1) {
        var %y %y $v2
      }
      inc %x
    }
    var %lowestxp $gettok($sorttok(%y,32,n),1,32)
    var %x 0
    while ($calc($xpforlevel($calc($gettok(% [ $+ [ $skill(%x) ] ],2,44) + 1)) - $gettok(% [ $+ [ $skill(%x) ] ],3,44)) != %lowestxp) {
      inc %x
    }
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$upper($gettok($sock($sockname).mark,2,126))),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),Closest level up is) $c1($gettok($sock($sockname).mark,3,126),$skill(%x)) $c2($gettok($sock($sockname).mark,3,126),level) $c1($gettok($sock($sockname).mark,3,126),$calc($gettok(% [ $+ [ $skill(%x) ] ],2,44) + 1)) $c2($gettok($sock($sockname).mark,3,126),in) $c1($gettok($sock($sockname).mark,3,126),$bytes(%lowestxp,db)) $c2($gettok($sock($sockname).mark,3,126),experience.)
    if ($skill(%x) != Slayer) {
      notice $gettok($sock($sockname).mark,3,126) $FNL($skill(%x),%lowestxp,$gettok($sock($sockname).mark,3,126))
    }
    sockclose $sockname
    halt
  }
}
on $*:TEXT:/^[!@]qfc/Si:#: {
  if ($2 == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a quick find code.)
    halt
  }
  var %x 1
  while ($sock(qfc. $+ %x)) {
    inc %x
  }
  sockopen $+(qfc.,%x) forum.runescape.com 80
  sockmark $+(qfc.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $2 $+ ~ $+ $nick
}
on *:SOCKOPEN:qfc.*: {
  sockwrite -n $sockname GET /forums.ws?uid= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
  sockwrite -n $sockname Host: forum.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:qfc.*: {
  var %read
  sockread %read
  if (*Thread was not found* iswm %read) {
    $gettok($sock($sockname).mark,1,126) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),Invalid Quick Find Code.)
    sockclose $sockname
    halt
  }
  if (*forums.ws* iswm %read) && (*<FORM method=?post* !iswm %read) {
    sockread %read
    sockread %read
    $gettok($sock($sockname).mark,1,126) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),QFC),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),The link for) $c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,2,126)) $c2($gettok($sock($sockname).mark,3,126),is) $c1($gettok($sock($sockname).mark,3,126),http://forum.runescape.com/ $+ $gettok(%read,2,34)) $c2($gettok($sock($sockname).mark,3,126),and is called) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</A))
    sockclose $sockname
    halt
  }
}
on $*:TEXT:/^[!@](level|lvl)/Si:#: {
  if ($2 == $null) || ($2 !isnum 1-99) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a number 1-99.)
    halt
  }
  else {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+($chr(91),$c1($nick,Level),$chr(93),:) $c1($nick,Level $2) $c2($nick,=) $c1($nick,$bytes($xpforlevel($2),db)) $c2($nick,experience.)
    halt
  }
}
on $*:TEXT:/^[!@](congratulations|congratz|gratz)/Si:#: {
  var %x 1
  while ($gettok($2-,%x,32)) {
    if ($gettok($2-,%x,32) isnum) {
      if ($gettok($2-,%x,32) isnum 2-99) {
        var %level $gettok($2-,%x,32)
      }
      else {
        $iif($istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,Your level must be between 2 and 99.)
        halt
      }
    }
    if ($gettok($2-,%x,32) isalpha) {
      if ($skill2($gettok($2-,%x,32)) != $null) {
        var %skill $v1
      }
      else {
        $iif($istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a level and a skill.)
        halt
      }
    }
    inc %x
  }
  describe $chan :D\-< ¤.¡*°*¡.¤ Woot! Congratz on level $c1($nick,%level %skill $nick) $+ !¤.¡*°*¡.¤ :D/-<
}
on $*:TEXT:/^[!@]rsn/Si:#: {
  if ($2 == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a name.)
    halt
  }
  if ($readini(botinfo.ini,n,defname,$address($2,3)) != $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,RuneScape Name),$chr(93),:) $c2($nick,The default RuneScape Name for) $c1($nick,$2) $c2($nick,is) $c1($nick,$readini(botinfo.ini,n,defname,$address($2,3))) $+ $c2($nick,.)
  }
  else {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,RuneScape Name),$chr(93),:) $c2($nick,The name) $qt($c1($nick,$2)) $c2($nick,does not have a default name set.)
  }
}
on $*:TEXT:/^[!@]urban/Si:#: {
  if ($2 == $null) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a term to search for.)
    halt
  }
  var %x 1
  while ($sock(urban. $+ %x)) {
    inc %x
  }
  sockopen $+(urban.,%x) www.urbandictionary.com 80
  sockmark $+(urban.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $replace($2-,$chr(32),$chr(43)) $+ ~ $+ $nick
}
on *:SOCKOPEN:urban.*: {
  sockwrite -n $sockname GET /define.php?term= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
  sockwrite -n $sockname Host: www.urbandictionary.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:urban.*: {
  var %read
  sockread %read
  if (*<p>* iswm %read) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Urban),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),$replace($htmlfree(%read),&quot;,"))
    sockclose $sockname
  }
  if (*isn't defined* iswm %read) {
    $gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Error),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),The search) $qt($c1($gettok($sock($sockname).mark,3,126),$replace($gettok($sock($sockname).mark,2,126),+,$chr(32)))) $c2($gettok($sock($sockname).mark,3,126),returned no results.)
    sockclose $sockname
  }
}
on $*:TEXT:/^[!@]halo3/Si:#: {
  if ($2 == $null) {
    $iif($left($1,1) == @,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a name.)
    halt
  }
  var %x 1
  while ($sock(halo3. $+ %x)) {
    inc %x
  }
  sockopen $+(halo3.,%x) www.bungie.net 80
  sockmark $+(halo3.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $replace($2-,$chr(32),$chr(43),$chr(95),$chr(43)) $+ ~ $+ $nick
}
on *:SOCKOPEN:halo3.*: {
  sockwrite -n $sockname GET /Stats/Halo3/Default.aspx?player= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
  sockwrite -n $sockname Host: www.bungie.net
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:halo3.*: {
  var %read,%next,%next2
  sockread %read
  if (*<td class="fields">*</td>* iswm %read) {
    sockread %next
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td)) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%next,3,62),</span,</a))
  }
  if (<td>Total Games</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Total Games:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td))
  }
  if (<td>Matchmade Games</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Matchmade Games:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td))
  }
  if (<td>Custom Games</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Custom Games:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td))
  }
  if (<td>Campaign Missions</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Campaign Missions:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td))
  }
  if (<td>Total EXP</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Total EXP:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td,$chr(32)))
  }
  if (<td>Enemies KIA</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Enemies KIA:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td))
  }
  if (<td>Friendlies Lost</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Friendlies Lost:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,2,62),</td))
  }
  if (<li><span id="ctl00_mainContent_identityStrip_lblRank"> isin %read) {
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Rank:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,3,62),</span))
  }
  if (<td>Highest Skill</td> isin %read) {
    sockread %read
    sockmark $sockname $sock($sockname).mark $+ ~ $+ $c2($gettok($sock($sockname).mark,3,126),Highest skill:) $c1($gettok($sock($sockname).mark,3,126),$remove($gettok(%read,3,32),</td>))
  }
  if (</html> isin %read) {
    if ($gettok($sock($sockname).mark,4,126)) {
      $gettok($sock($sockname).mark,1,126) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Halo3),$chr(93),:) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$replace($gettok($sock($sockname).mark,2,126),$chr(95),$chr(32),$chr(43),$chr(32))),$chr(93),:) $replace($gettok($sock($sockname).mark,4-,126),~,$chr(32))
    }
    else {
      $gettok($sock($sockname).mark,1,126) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Halo3),$chr(93),:) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$replace($gettok($sock($sockname).mark,2,126),$chr(95),$chr(32),$chr(43),$chr(32))),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),The name) $qt($c1($gettok($sock($sockname).mark,3,126),$gettok($sock($sockname).mark,2,126))) $c2($gettok($sock($sockname).mark,3,126),was not found in the Halo3 gamertags.)
    }
    sockclose $sockname
  }
}

on $*:TEXT:/^[!@](duel|bounty|rogues)/Si:#: {
  if ($2 == $null) && (!$readini(botinfo.ini,n,defname,$address($nick,3))) {
    $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a player or default name.)
    halt
  }
  if ($chr(38) isin $2-) {
    if ($readini(botinfo.ini,n,defname,$address($remove($2-,$chr(38)),3))) {
      var %name $v1
    }
    else {
      $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) *** $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,Error $+ $chr(44) the name) $qt($c1($nick,$remove($2-,$chr(38)))) $c2($nick,does not have a defname set.)
      halt
    }
  }
  else {
    if ($2) {
      var %name $replace($2-,$chr(32),$chr(95))
    }
    else {
      var %name $readini(botinfo.ini,n,defname,$address($nick,3))
    }
  }
  var %x 1
  while ($sock(duel. $+ %x)) {
    inc %x
  }
  if (duel isin $1) {
    var %type Dueling
  }
  elseif (bounty isin $1) {
    var %type Bounty Hunters
  }
  elseif (rogues isin $1) {
    var %type Bounty Hunter Rogues
  }
  sockopen $+(duel.,%x) hiscore.runescape.com 80
  sockmark $+(duel.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ %name $+ ~ $+ $nick $+ ~ $+ %type
}
on *:SOCKOPEN:duel.*: {
  sockwrite -n $sockname GET /index_lite.ws?player= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:duel.*: {
  tokenize 126 $sock($sockname).mark
  var %read
  sockread %read
  if (*,* iswm %read) && (*,*,* !iswm %read) && ($remove(%read,$chr(44),-) isnum) {
    if ($4 == Bounty Hunters) {
      sockread %read
    }
    if ($4 == Bounty Hunter Rogues) {
      sockread %read 
      sockread %read
    }
    if (-1 isin %read) {
      $gettok($sock($sockname).mark,1,126) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$2),$chr(93),:) $c2($3,does not appear in the) $c1($gettok($sock($sockname).mark,3,126),$iif($4 == Dueling,Dueling,$iif($4 == Bounty Hunters,Bounty Hunters,Bounty Hunter Rogues))) $c2($gettok($sock($sockname).mark,3,126),high scores list.)
      sockclose $sockname
    }
    else {
      $gettok($sock($sockname).mark,1,126) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$2),$chr(93),:) $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),$iif($4 == Dueling,Dueling,$iif($4 == Bounty Hunters,Bounty Hunters,Bounty Hunter Rogues))),$chr(93),:) $c2($gettok($sock($sockname).mark,3,126),Rank) $+ : $c1($gettok($sock($sockname).mark,3,126),$bytes($gettok(%read,1,44),db)) $chr(124) $c2($gettok($sock($sockname).mark,3,126),Score) $+ : $c1($gettok($sock($sockname).mark,3,126),$bytes($gettok(%read,2,44),db))
      sockclose $sockname
    }
  }
}

alias skill {
  if ($1 == 0) return Overall
  elseif ($1 == 1) return Attack
  elseif ($1 == 2) return Defence
  elseif ($1 == 3) return Strength
  elseif ($1 == 4) return Hitpoints
  elseif ($1 == 5) return Ranged
  elseif ($1 == 6) return Prayer
  elseif ($1 == 7) return Magic
  elseif ($1 == 8) return Cooking
  elseif ($1 == 9) return Woodcutting
  elseif ($1 == 10) return Fletching
  elseif ($1 == 11) return Fishing
  elseif ($1 == 12) return Firemaking
  elseif ($1 == 13) return Crafting
  elseif ($1 == 14) return Smithing
  elseif ($1 == 15) return Mining
  elseif ($1 == 16) return Herblore
  elseif ($1 == 17) return Agility
  elseif ($1 == 18) return Thieving
  elseif ($1 == 19) return Slayer
  elseif ($1 == 20) return Farming
  elseif ($1 == 21) return Runecrafting
  elseif ($1 == 22) return Hunter
  elseif ($1 == 23) return Construction
  elseif ($1 == 24) return Summoning
  else return Error
}
alias skill2 {
  if (Att* iswm $1-) return Attack
  elseif (Def* iswm $1-) return Defence
  elseif (Str* iswm $1-) return Strength
  elseif (Hit* iswm $1-) || (Hp* iswm $1-) return Hitpoints
  elseif (Range* iswm $1-) return Ranged
  elseif (Pray* iswm $1-) return Prayer
  elseif (Mag* iswm $1-) return Magic
  elseif (Cook* iswm $1-) return Cooking
  elseif (Wood* iswm $1-) || (Wc == $1-) return Woodcutting
  elseif (Fletch* iswm $1-) return Fletching
  elseif (Fish* iswm $1-) return Fishing
  elseif (Fire* iswm $1-) || (Fm == $1-) return Firemaking
  elseif (Craft* iswm $1-) return Crafting
  elseif (Smith* iswm $1-) return Smithing
  elseif (Min* iswm $1-) return Mining
  elseif (Herb* iswm $1-) return Herblore
  elseif (Agil* iswm $1-) return Agility
  elseif (Thie* iswm $1-) return Thieving
  elseif (Slay* iswm $1-) return Slayer
  elseif (Farm* iswm $1-) return Farming
  elseif (Rune* iswm $1-) || (Rc == $1-) return Runecrafting
  elseif (Hunt* iswm $1-) return Hunter
  elseif (Con* iswm $1-) return Construction
  elseif (Over* iswm $1-) return Overall
  elseif (Sum* iswm $1-) return Summoning
}
alias -l skill3 {
  if ($1 == Overall) return 0
  elseif ($1 == Attack) return 1
  elseif ($1 == Defence) return 2
  elseif ($1 == Strength) return 3
  elseif ($1 == Hitpoints) return 4
  elseif ($1 == Ranged) return 5
  elseif ($1 == Prayer) return 6
  elseif ($1 == Magic) return 7
  elseif ($1 == Cooking) return 8
  elseif ($1 == Woodcutting) return 9
  elseif ($1 == Fletching) return 10
  elseif ($1 == Fishing) return 11
  elseif ($1 == Firemaking) return 12
  elseif ($1 == Crafting) return 13
  elseif ($1 == Smithing) return 14
  elseif ($1 == Mining) return 15
  elseif ($1 == Herblore) return 16
  elseif ($1 == Agility) return 17
  elseif ($1 == Thieving) return 18
  elseif ($1 == Slayer) return 19
  elseif ($1 == Farming) return 20
  elseif ($1 == Runecrafting) return 21
  elseif ($1 == Hunter) return 22
  elseif ($1 == Construction) return 23
  elseif ($1 == Summoning) return 24
}
alias -l xpforlevel { 
  var %x = 1, %level = $calc($1 - 1), %xp = 0 
  while (%x <= %level) { 
    var %TempXp = $calc($floor($calc(%x + 300 * 2 ^ (%x / 7))) / 4) 
    inc %xp %TempXp 
    inc %x 
  } 
  return $int(%xp) 
}
alias -l lfe {
  if ($1 < 83) return 1
  elseif ($1 < 174) return 2
  elseif ($1 < 276) return 3
  elseif ($1 < 388) return 4
  elseif ($1 < 512) return 5
  elseif ($1 < 650) return 6
  elseif ($1 < 801) return 7
  elseif ($1 < 969) return 8
  elseif ($1 < 1154) return 9
  elseif ($1 < 1358) return 10
  elseif ($1 < 1584) return 11
  elseif ($1 < 1833) return 12
  elseif ($1 < 2107) return 13
  elseif ($1 < 2411) return 14
  elseif ($1 < 2746) return 15
  elseif ($1 < 3115) return 16
  elseif ($1 < 3523) return 17
  elseif ($1 < 3973) return 18
  elseif ($1 < 4470) return 19
  elseif ($1 < 5018) return 20
  elseif ($1 < 5624) return 21
  elseif ($1 < 6291) return 22
  elseif ($1 < 7028) return 23
  elseif ($1 < 7842) return 24
  elseif ($1 < 8740) return 25
  elseif ($1 < 9730) return 26
  elseif ($1 < 10824) return 27
  elseif ($1 < 12031) return 28
  elseif ($1 < 13363) return 29
  elseif ($1 < 14833) return 30
  elseif ($1 < 16456) return 31
  elseif ($1 < 18247) return 32
  elseif ($1 < 20224) return 33
  elseif ($1 < 22406) return 34
  elseif ($1 < 24815) return 35
  elseif ($1 < 27473) return 36
  elseif ($1 < 30408) return 37
  elseif ($1 < 33648) return 38
  elseif ($1 < 37224) return 39
  elseif ($1 < 41171) return 40
  elseif ($1 < 45529) return 41
  elseif ($1 < 50339) return 42
  elseif ($1 < 55649) return 43
  elseif ($1 < 61512) return 44
  elseif ($1 < 67983) return 45
  elseif ($1 < 75127) return 46
  elseif ($1 < 83014) return 47
  elseif ($1 < 91721) return 48
  elseif ($1 < 101333) return 49
  elseif ($1 < 111945) return 50
  elseif ($1 < 123660) return 51
  elseif ($1 < 136594) return 52
  elseif ($1 < 150872) return 53
  elseif ($1 < 166636) return 54
  elseif ($1 < 184040) return 55
  elseif ($1 < 203254) return 56
  elseif ($1 < 224466) return 57
  elseif ($1 < 247886) return 58
  elseif ($1 < 273742) return 59
  elseif ($1 < 302288) return 60
  elseif ($1 < 333804) return 61
  elseif ($1 < 368599) return 62
  elseif ($1 < 407015) return 63
  elseif ($1 < 449428) return 64
  elseif ($1 < 496254) return 65
  elseif ($1 < 547953) return 66
  elseif ($1 < 605032) return 67
  elseif ($1 < 668051) return 68
  elseif ($1 < 737627) return 69
  elseif ($1 < 814445) return 70
  elseif ($1 < 899257) return 71
  elseif ($1 < 992895) return 72
  elseif ($1 < 1096278) return 73
  elseif ($1 < 1210421) return 74
  elseif ($1 < 1336443) return 75
  elseif ($1 < 1475581) return 76
  elseif ($1 < 1629200) return 77
  elseif ($1 < 1798808) return 78
  elseif ($1 < 1986068) return 79
  elseif ($1 < 2192818) return 80
  elseif ($1 < 2421087) return 81
  elseif ($1 < 2673114) return 82
  elseif ($1 < 2951373) return 83
  elseif ($1 < 3258594) return 84
  elseif ($1 < 3597792) return 85
  elseif ($1 < 3972294) return 86
  elseif ($1 < 4385776) return 87
  elseif ($1 < 4842295) return 88
  elseif ($1 < 5346332) return 89
  elseif ($1 < 5902831) return 90
  elseif ($1 < 6517253) return 91
  elseif ($1 < 7195629) return 92
  elseif ($1 < 7944614) return 93
  elseif ($1 < 8771558) return 94
  elseif ($1 < 9684577) return 95
  elseif ($1 < 10692629) return 96
  elseif ($1 < 11805606) return 97
  elseif ($1 < 13034431) return 98
  else return 99
}
alias FNL {
  if ($4) {
    var %eparam
    if ($1 == Hitpoints) {
      if ($readini(eparam.ini,n,Attack,$4)) {
        %eparam = $chr(124) $c2($3,$4) $+ : $c1($3,$FNL2($2,$calc($readini(eparam.ini,n,Attack,$4) / 4 * 1.33)))
      }
      else {
        %eparam = $chr(124) $c1($3,$4) $c2($3,is not a valid paramater, type) $c1($3,!param $1) $c2($3,to see the parameters.)
      }
    }
    elseif ($1 == Ranged) {
      if ($readini(eparam.ini,n,Attack,$4)) {
        %eparam = $chr(124) $c2($3,$4) $+ : $c1($3,$FNL2($2,$readini(eparam.ini,n,Attack,$4)))
      }
      else {
        %eparam = $chr(124) $c1($3,$4) $c2($3,is not a valid paramater, type) $c1($3,!param $1) $c2($3,to see the parameters.)
      }
    }
    else {
      if ($readini(eparam.ini,n,$1,$4)) {
        %eparam = $chr(124) $c2($3,$4) $+ : $c1($3,$FNL2($2,$readini(eparam.ini,n,$1,$4)))
      }
      else {
        %eparam = $chr(124) $c1($3,$4) $c2($3,is not a valid paramater, type) $c1($3,!param $1) $c2($3,to see the parameters.)
      }
    }
  }
  if ($1 == Overall) halt
  elseif ($1 == Attack) {
    return $c2($3,NPCs for) $c1($3,$bytes($2,db)) $c2($3,attack experience) $+ : $c2($3,Ogre) $+ : $c1($3,$FNL2($2,240)) $+($chr(91),$c1($3,$FNL2($2,$calc(60 * 1.33))),$chr(93)) $chr(124) $c2($3,Shadow Warrior) $+ : $c1($3,$FNL2($2,268)) $+($chr(91),$c1($3,$FNL2($2,$calc(67 * 1.33))),$chr(93)) $chr(124) $c2($3,Earth Warrior) $+ : $c1($3,$FNL2($2,216)) $+($chr(91),$c1($3,$FNL2($2,$calc(54 * 1.33))),$chr(93)) $chr(124) $c2($3,$+(Dagannoth,$chr(40),74,$chr(41))) $+ : $c1($3,$FNL2($2,280)) $+($chr(91),$c1($3,$FNL2($2,$calc(70 * 1.33))),$chr(93)) $chr(124) $c2($3,Axes) $+ : $c1($3,$FNL2($2,176)) $+($chr(91),$c1($3,$FNL2($2,$calc(44 * 1.33))),$chr(93)) $iif(%eparam,$v1)
  }
  elseif ($1 == Defence) {
    return $c2($3,NPCs for) $c1($3,$bytes($2,db)) $c2($3,defence experience) $+ : $c2($3,Ogre) $+ : $c1($3,$FNL2($2,240)) $+($chr(91),$c1($3,$FNL2($2,$calc(60 * 1.33))),$chr(93)) $chr(124) $c2($3,Shadow Warrior) $+ : $c1($3,$FNL2($2,268)) $+($chr(91),$c1($3,$FNL2($2,$calc(67 * 1.33))),$chr(93)) $chr(124) $c2($3,Earth Warrior) $+ : $c1($3,$FNL2($2,216)) $+($chr(91),$c1($3,$FNL2($2,$calc(54 * 1.33))),$chr(93)) $chr(124) $c2($3,$+(Dagannoth,$chr(40),74,$chr(41))) $+ : $c1($3,$FNL2($2,280)) $+($chr(91),$c1($3,$FNL2($2,$calc(70 * 1.33))),$chr(93)) $chr(124) $c2($3,Axes) $+ : $c1($3,$FNL2($2,176)) $+($chr(91),$c1($3,$FNL2($2,$calc(44 * 1.33))),$chr(93)) $iif(%eparam,$v1)
  }
  elseif ($1 == Strength) {
    return $c2($3,NPCs for) $c1($3,$bytes($2,db)) $c2($3,strength experience) $+ : $c2($3,Ogre) $+ : $c1($3,$FNL2($2,240)) $+($chr(91),$c1($3,$FNL2($2,$calc(60 * 1.33))),$chr(93)) $chr(124) $c2($3,Shadow Warrior) $+ : $c1($3,$FNL2($2,268)) $+($chr(91),$c1($3,$FNL2($2,$calc(67 * 1.33))),$chr(93)) $chr(124) $c2($3,Earth Warrior) $+ : $c1($3,$FNL2($2,216)) $+($chr(91),$c1($3,$FNL2($2,$calc(54 * 1.33))),$chr(93)) $chr(124) $c2($3,$+(Dagannoth,$chr(40),74,$chr(41))) $+ : $c1($3,$FNL2($2,280)) $+($chr(91),$c1($3,$FNL2($2,$calc(70 * 1.33))),$chr(93)) $chr(124) $c2($3,Axes) $+ : $c1($3,$FNL2($2,176)) $+($chr(91),$c1($3,$FNL2($2,$calc(44 * 1.33))),$chr(93)) $iif(%eparam,$v1)
  }
  elseif ($1 == Hitpoints) {
    return $c2($3,NPCs for) $c1($3,$bytes($2,db)) $c2($3,hitpoints experience) $+ : $c2($3,Ogre) $+ : $c1($3,$FNL2($2,$calc(60 * 1.33))) $chr(124) $c2($3,Shadow Warrior) $+ : $c1($3,$FNL2($2,$calc(67 * 1.33))) $chr(124) $c2($3,Earth Warrior) $+ : $c1($3,$FNL2($2,$calc(54 * 1.33))) $chr(124) $c2($3,$+(Daganooth,$chr(40),74,$chr(41))) $c1($3,$FNL2($2,$calc(70 * 1.33))) $iif(%eparam,$v1)
  }
  elseif ($1 == Ranged) {
    return $c2($3,NPCs for) $c1($3,$bytes($2,db)) $c2($3,ranging experience) $+ : $c2($3,Blue Dragons) $+ : $c1($3,$FNL2($2,420)) $+($chr(91),$c1($3,$bytes($calc($remove($FNL2($2,420),$chr(44)) * 2),db)),$chr(93)) $chr(124) $c2($3,Greater Demon) $+ : $c1($3,$FNL2($2,348)) $+($chr(91),$c1($3,$bytes($calc($remove($FNL2($2,348),$chr(44)) * 2),db)),$chr(93)) $chr(124) $c2($3,Ogres) $+ : $c1($3,$FNL2($2,240)) $+($chr(91),$c1($3,$bytes($calc($remove($FNL2($2,240),$chr(44)) * 2),db)),$chr(93)) $chr(124) $c2($3,Fire Giants) $+ : $c1($3,$FNL2($2,444)) $+($chr(91),$c1($3,$bytes($calc($remove($FNL2($2,444),$chr(44)) * 2),db)),$chr(93)) $iif(%eparam,$v1)
  }
  elseif ($1 == Prayer) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,prayer experience) $+ : $c2($3,Dragon Bones) $+ : $c1($3,$FNL2($2,72)) $+($chr(91),E:,$c1($3,$bytes($ceil($calc($2 / 288)),db)),$chr(93)) $+($chr(91),A:,$c1($3,$bytes($ceil($calc($2 / 252)),db)),$chr(93)) $chr(124) $c2($3,Baby Dragon Bones) $+ : $c1($3,$FNL2($2,30)) $+($chr(91),E:,$c1($3,$bytes($ceil($calc($2 / 120)),db)),$chr(93)) $+($chr(91),A:,$c1($3,$bytes($ceil($calc($2 / 105)),db)),$chr(93)) $chr(124) $c2($3,Big Bones) $+ : $c1($3,$FNL2($2,15)) $+($chr(91),E:,$c1($3,$bytes($ceil($calc($2 / 60)),db)),$chr(93)) $+($chr(91),A:,$c1($3,$bytes($ceil($calc($2 / 52.5)),db)),$chr(93)) $chr(124) $c2($3,Ourg Bones) $+ : $c1($3,$FNL2($2,140)) $+($chr(91),E:,$c1($3,$bytes($ceil($calc($2 / 560)),db)),$chr(93)) $+($chr(91),A:,$c1($3,$bytes($ceil($calc($2 / 490)),db)),$chr(93)) $iif(%eparam,$v1)
  }
  elseif ($1 == Magic) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,magic experience) $+ : $c2($3,Enchant Level 6 Jewelery) $+ : $c1($3,$FNL2($2,97)) $chr(124) $c2($3,Stun) $+ : $c1($3,$FNL2($2,90)) $chr(124) $c2($3,Fire Wave) $+ : $c1($3,$FNL2($2,62.5)) $chr(124) $c2($3,High Alchemy) $+ : $c1($3,$FNL2($2,65)) $chr(124) $c2($3,Camelot Teleport) $+ : $c1($3,$FNL2($2,55.5)) $iif(%eparam,$v1)
  }
  elseif ($1 == Cooking) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,cooking experience) $+ : $c2($3,Shark) $+ : $c1($3,$FNL2($2,210)) $chr(124) $c2($3,Tuna and Corn Potato) $+ : $c1($3,$FNL2($2,309.5)) $chr(124) $c2($3,Monkfish) $+ : $c1($3,$FNL2($2,150)) $chr(124) $c2($3,Curry) $+ : $c1($3,$FNL2($2,280)) $chr(124) $c2($3,Chocolate Cake) $+ : $c1($3,$FNL2($2,210)) $chr(124) $c2($3,Swordfish) $+ : $c1($3,$FNL2($2,140)) $chr(124) $c2($3,Lobster) $+ : $c1($3,$FNL2($2,120)) $chr(124) $c2($3,Tuna) $+ : $c1($3,$FNL2($2,100)) $iif(%eparam,$v1)
  }
  elseif ($1 == Woodcutting) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,woodcutting experience) $+ : $c2($3,Magic) $+ : $c1($3,$FNL2($2,250)) $chr(124) $c2($3,Yew) $+ : $c1($3,$FNL2($2,175)) $chr(124) $c2($3,Mahogany) $+ : $c1($3,$FNL2($2,125)) $chr(124) $c2($3,Maple) $+ : $c1($3,$FNL2($2,100)) $chr(124) $c2($3,Willow) $+ : $c1($3,$FNL2($2,67.5)) $iif(%eparam,$v1)
  }
  elseif ($1 == Fletching) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,fletching experience) $+ : $c2($3,Magic Long Bow) $+ : $c1($3,$FNL2($2,183)) $chr(124) $c2($3,Yew Long Bow) $+ : $c1($3,$FNL2($2,150)) $chr(124) $c2($3,Maple Long Bow) $+ : $c1($3,$FNL2($2,116.5)) $chr(124) $c2($3,Willow Long Bow) $+ : $c1($3,$FNL2($2,83)) $iif(%eparam,$v1)
  }
  elseif ($1 == Fishing) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,fishing experience) $+ : $c2($3,Shark) $+ : $c1($3,$FNL2($2,110)) $chr(124) $c2($3,Monkfish) $+ : $c1($3,$FNL2($2,120)) $chr(124) $c2($3,Swordfish) $+ : $c1($3,$FNL2($2,100)) $chr(124) $c2($3,Bass) $+ : $c1($3,$FNL2($2,100)) $chr(124) $c2($3,Lobster) $+ : $c1($3,$FNL2($2,90)) $iif(%eparam,$v1)
  }
  elseif ($1 == Firemaking) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,firemaking experience) $+ : $c2($3,Magic Logs) $+ : $c1($3,$FNL2($2,303.75)) $chr(124) $c2($3,Yew Logs) $+ : $c1($3,$FNL2($2,202.5)) $chr(124) $c2($3,Maple Logs) $+ : $c1($3,$FNL2($2,135)) $chr(124) $c2($3,Willow Logs) $+ : $c1($3,$FNL2($2,90)) $iif(%eparam,$v1) $iif(%eparam,$v1)
  }
  elseif ($1 == Crafting) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,crafting experience) $+ : $c2($3,Leather body/chaps) $+ : $c1($3,$FNL2($2,27)) $chr(124) $c2($3,Hard Leather Body) $+ : $c1($3,$FNL2($2,35)) $chr(124) $c2($3,Air Battlestaff) $+ : $c1($3,$FNL2($2,137.5)) $chr(124) $c2($3,Fire Battlestaff) $+ : $c1($3,$FNL2($2,125)) $chr(124) $c2($3,Green Dragonhide) $+ : $c1($3,$FNL2($2,62)) $chr(124) $c2($3,Blue Dragonhide) $+ : $c1($3,$FNL2($2,70)) $chr(124) $c2($3,Red Dragonhide) $+ : $c1($3,$FNL2($2,78)) $iif(%eparam,$v1)
  }
  elseif ($1 == Smithing) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,smithing experience) $+($chr(91),smelt,$chr(47),smith,$chr(47),both,$chr(93)) $+ : $c2($3,Adamant Bars) $+ : $+($c1($3,$FNL2($2,37.5)),/,$c1($3,$FNL2($2,62.5)),/,$c1($3,$FNL2($2,100))) $chr(124) $c2($3,Mithril Bars) $+ : $+($c1($3,$FNL2($2,30)),/,$c1($3,$FNL2($2,50)),/,$c1($3,$FNL2($2,80))) $chr(124) $c2($3,Smelt Gold) $+ : $c1($3,$FNL2($2,22.5)) $+($chr(40),$c2($3,w/guants) $+ : $c1($3,$FNL2($2,56.2)),$chr(41)) $chr(124) $c2($3,4 Cannon Balls) $+ : $c1($3,$FNL2($2,25.6)) $+($chr(40),$c2($3,w/smelt) $+ : $c1($3,$FNL2($2,43.1)),$chr(41)) $chr(124) $c2($3,Steel bars) $+ : $+($c1($3,$FNL2($2,17.5)),/,$c1($3,$FNL2($2,37.5)),/,$c1($3,$FNL2($2,55))) $chr(124) $c2($3,Smelt Silver) $+ : $c1($3,$FNL2($2,13.7)) $iif(%eparam,$v1)
  }
  elseif ($1 == Mining) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,mining experience) $+ : $c2($3,Adamant) $+ : $c1($3,$FNL2($2,95)) $chr(124) $c2($3,Mithril) $+ : $c1($3,$FNL2($2,80)) $chr(124) $c2($3,Granite) $+($chr(91),tiny,/,small,/,medium,$chr(93)) $+ : $+($c1($3,$FNL2($2,50)),/,$c1($3,$FNL2($2,60)),/,$c1($3,$FNL2($2,75))) $chr(124) $c2($3,Gems) $+ : $c1($3,$FNL2($2,65)) $chr(124) $c2($3,Gold) $+ : $c1($3,$FNL2($2,65)) $chr(124) $c2($3,Coal) $+ : $c1($3,$FNL2($2,50)) $chr(124) $c2($3,Iron) $+ : $c1($3,$FNL2($2,35)) $iif(%eparam,$v1)
  }
  elseif ($1 == Herblore) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,herblore experience) $+ : $c2($3,Ranging Potion) $+ : $c1($3,$FNL2($2,162.5)) $chr(124) $c2($3,Clean Dwarf Weed) $+ : $c1($3,$FNL2($2,13.75)) $chr(124) $c2($3,Anti Fire-Breath Potion) $+ : $c1($3,$FNL2($2,157.5)) $chr(124) $c2($3,ID Lantadyme) $+ : $c1($3,$FNL2($2,13)) $chr(124) $c2($3,Super Attack Potion) $+ : $c1($3,$FNL2($2,100)) $chr(124) $c2($3,Super Strength Potion) $+ : $c1($3,$FNL2($2,125)) $chr(124) $c2($3,Super defence potion) $+ : $c1($3,$FNL2($2,150)) $chr(124) $c2($3,Prayer Restore Potion) $+ : $c1($3,$FNL2($2,87.5)) $iif(%eparam,$v1)
  }
  elseif ($1 == Agility) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,agility experience) $+ : $c2($3,Werewolves' Course) $+ : $c1($3,$FNL2($2,540)) $chr(124) $c2($3,Wilderness Course) $+ : $c1($3,$FNL2($2,571.5)) $chr(124) $c2($3,Ape Atoll) $+ : $c1($3,$FNL2($2,580)) $chr(124) $c2($3,Barbarian Course) $+ : $c1($3,$FNL2($2,153.2)) $chr(124) $c2($3,Agility Pyramid) $+ : $c1($3,$FNL2($2,1014)) $chr(124) $c2($3,Gnome Course) $+ : $c1($3,$FNL2($2,86)) $iif(%eparam,$v1)
  }
  elseif ($1 == Thieving) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,thieving experience) $+ : $c2($3,Pick Pollnivian Bandit) $+ : $c1($3,$FNL2($2,84.3)) $+($chr(40),$c2($3,Bearded) $+ : $c1($3,$FNL2($2,65)),$chr(41)) $chr(124) $c2($3,Pick Knight) $+ : $c1($3,$FNL2($2,84.3)) $chr(124) $c2($3,Pick Guard) $+ : $c1($3,$FNL2($2,46.8)) $chr(124) $c2($3,Wall Safes) $+ : $c1($3,$FNL2($2,70)) $iif(%eparam,$v1)
  }
  elseif ($1 == Slayer) halt
  elseif ($1 == Farming) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,farming experience) $+ : $c2($3,Poison Ivy Bush) $+ : $c1($3,$FNL2($2,794)) $chr(124) $c2($3,Palm Tree) $+ : $c1($3,$FNL2($2,10211)) $chr(124) $c2($3,Belladonna) $+ : $c1($3,$FNL2($2,91)) $chr(124) $c2($3,Snapdragon) $+ : $c1($3,$FNL2($2,186)) $chr(124) $c2($3,Yew Tree) $+ : $c1($3,$FNL2($2,7150.5)) $chr(124) $c2($3,Whiteberry Bush) $+ : $c1($3,$FNL2($2,515)) $chr(124) $c2($3,Papaya Tree) $+ : $c1($3,$FNL2($2,6219)) $iif(%eparam,$v1)
  }
  elseif ($1 == Runecrafting) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,runecrafting experience) $+ : $c2($3,Death Rune) $+ : $c1($3,$FNL2($2,10)) $chr(124) $c2($3,Law Rune) $+ : $c1($3,$FNL2($2,9.5)) $chr(124) $c2($3,Nature Rune) $+ : $c1($3,$FNL2($2,9)) $chr(124) $c2($3,Astral Rune) $+ : $c1($3,$FNL2($2,8.7)) $chr(124) $c2($3,Chaos Rune) $+ : $c1($3,$FNL2($2,8.5)) $chr(124) $c2($3,Cosmic Rune) $+ : $c1($3,$FNL2($2,8)) $chr(124) $c2($3,Air Rune) $+ : $c1($3,$FNL2($2,5)) $iif(%eparam,$v1)
  }
  elseif ($1 == Hunter) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,hunter experience) $+ : $c2($3,Imp) $+ : $c1($3,$FNL2($2,450)) $chr(124) $c2($3,Dashing Kebbit) $+ : $c1($3,$FNL2($2,156)) $chr(124) $c2($3,Black Salamander) $+ : $c1($3,$FNL2($2,304)) $chr(124) $c2($3,Red Chinchompa) $+ : $c1($3,$FNL2($2,265)) $chr(124) $c2($3,Red Salamander) $+ : $c1($3,$FNL2($2,272)) $chr(124) $c2($3,Dark Kebbit) $+ : $c1($3,$FNL2($2,132)) $chr(124) $c2($3,Sabretooth Kyatt) $+ : $c1($3,$FNL2($2,300)) $chr(124) $c2($3,Chinchompa) $+ : $c1($3,$FNL2($2,198.5)) $iif(%eparam,$v1)
  }
  elseif ($1 == Construction) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,construction experience) $+ : $c2($3,Mahogany Plank) $+ : $c1($3,$FNL2($2,140)) $+($chr(91),$c1($3,$bytes($calc($FNL2($2,140) * 1500),db) $+ gp),$chr(93)) $chr(124) $c2($3,Team Plank) $+ : $c1($3,$FNL2($2,90)) $+($chr(91),$c1($3,$bytes($calc($FNL2($2,90) * 500),db) $+ gp),$chr(93)) $chr(124) $c2($3,Oak Plank) $+ : $c1($3,$FNL2($2,60)) $+($chr(91),$c1($3,$bytes($calc($FNL2($2,60) * 250),db) $+ gp),$chr(93)) $iif(%eparam,$v1)
  }
  elseif ($1 == Summoning) {
    return $c2($3,Required for) $c1($3,$bytes($2,db)) $c2($3,summoning experience) $+ : $c2($3,Thorny snail) $+ : $c1($3,$FNL2($2,12.6)) $chr(124) $c2($3,Beaver) $+ : $c1($3,$FNL2($2,57.6)) $chr(124) $c2($3,Iron Minotaur) $+ : $c1($3,$FNL2($2,404.8)) $chr(124) $c2($3,Stranger Plant) $+ : $c1($3,$FNL2($2,281.6)) $chr(124) $c2($3,Unicorn Stallion) $+ : $c1($3,$FNL2($2,404.8)) $iif(%eparam,$v1)
  }
}
alias -l f2pcmblvl {
  ;1=attack,2=strength,3=defence,4=hitpoints,5=ranged,6=prayer,7=magic
  var %base $calc($calc($calc($3 * 100) + $calc($4 * 100) + $calc($iif($isbit($6,1),$calc($6 - 1) * 50,$6 * 50))) / 400)
  if ($isbit($5,1) == 1) {
    var %ranged $calc($calc($calc($calc($5 - 1) + $calc($5 * 2)) * 65) / 400)
  }
  else {
    var %ranged $calc($calc($5 * 195) / 400)
  }
  if ($isbit($7,1) == 1) {
    var %magic $calc($calc($calc($calc($7 - 1) + $calc($7 * 2)) * 65) / 400)
  }
  else {
    var %magic $calc($calc($7 * 195) / 400)
  }
  var %melee $calc($calc($calc($1 * 130) + $calc($2 * 130)) / 400)
  return $calc($gettok($sorttok(%melee %ranged %magic,32,nr),1,32) + %base) $iif($gettok($sorttok(%melee %ranged %magic,32,nr),1,32) == %melee,Melee,$iif($gettok($sorttok(%melee %ranged %magic,32,nr),1,32) == %ranged,Ranged,$iif($gettok($sorttok(%melee %ranged %magic,32,nr),1,32) == %magic,Magic)))
}
alias -l cmblvl { 
  ;att,str,def,hit,range,prayer,mage,summoning 
  var %a $calc($3 * 100) 
  var %b $calc($4 * 100) 
  if ($isbit($6,1)) var %c $calc($calc($6 - 1) * 50) 
  else var %c $calc($6 * 50) 
  if ($isbit($8,1)) var %d $calc($calc($8 - 1) * 50) 
  else var %d $calc($8 * 50) 
  var %base $calc($calc(%a + %b + %c + %d) / 400) 
  var %e $calc($1 * 130), %f $calc($2 * 130) 
  if ($isbit($5,1)) var %g $calc($calc($calc($5 - 1) + $calc($5 * 2)) * 65) 
  else var %g $calc($5 * 195) 
  if ($isbit($7,1)) var %h $calc($calc($calc($7 - 1) + $calc($7 * 2)) * 65) 
  else var %h $calc($7 * 195) 
  var %melee $calc($calc(%e + %f) / 400) 
  var %range $calc(%g / 400) 
  var %mage $calc(%h / 400) 
  if ($gettok($sorttok(%melee %range %mage,32,nr),1,32) == %melee) var %type Melee 
  elseif ($v1 == %range) var %type Ranged 
  else var %type Magic 
  return $calc($v1 + %base) %type 
}
alias -l nextcmblvl {
  var %attstr 1
  while ($floor($gettok($cmblvl($calc($2 + %attstr),$3,$4,$5,$6,$7,$8,$9),1,32)) < $calc($floor($gettok($cmblvl($2,$3,$4,$5,$6,$7,$8,$9),1,32)) + 1)) {
    inc %attstr
  }
  var %defhit 1
  while ($floor($gettok($cmblvl($2,$3,$calc($4 + %defhit),$5,$6,$7,$8,$9),1,32)) < $calc($floor($gettok($cmblvl($2,$3,$4,$5,$6,$7,$8,$9),1,32)) + 1)) {
    inc %defhit
  }
  var %pray 1
  while ($floor($gettok($cmblvl($2,$3,$4,$5,$6,$calc($7 + %pray),$8,$9),1,32)) < $calc($floor($gettok($cmblvl($2,$3,$4,$5,$6,$7,$8,$9),1,32)) + 1)) {
    inc %pray
  }
  var %summon 1
  while ($floor($gettok($cmblvl($2,$3,$4,$5,$6,$7,$8,$calc($9 + %summon)),1,32)) < $calc($floor($gettok($cmblvl($2,$3,$4,$5,$6,$7,$8,$9),1,32)) + 1)) {
    inc %summon
  }
  return $iif($calc(198 - $calc($2 + $3)) >= %attstr,$v2,N/A) $iif($calc(198 - $calc($4 + $5)) >= %defhit,$v2,N/A) $iif($calc(99 - $7) >= %pray,$v2,N/A) $iif($calc(99 - $9) >= %summon,$v2,N/A)
}
alias chancheck {
  var %x 1
  while (%x <= $chan(0)) {
    if ($nick($chan(%x),0) <= 2) {
      part $chan(%x) You need at least two other people to keep me.
    }
    inc %x
  }
  var %x 1
  while (%x <= $chan(0)) {
    var %y 1,%unidle 0
    while (%y <= $nick($chan(%x),0)) {
      if ($nick($chan(%x),%y).color == 1) {
        inc %unidle
      }
      inc %y
    }
    if (%unidle < 1) {
      if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Idle),$chan(%x),32)) {
        part $chan(%x) This channel has been detected for having people that are idle.
      }
    }
    inc %x
  }
}
alias -l FNL2 return $bytes($ceil($calc($1 / $2)),db)
alias -l c1 return $+($chr(3),$iif($readini(botinfo.ini,n,defcolor,$address($1,3)),$v1,07),$2-,$chr(3))
alias -l c2 {
  if ($readini(botinfo.ini,n,defcolor2,$address($1,3))) {
    return $+($chr(3),$v1,$2-,$chr(3))
  }
  else {
    return $2-
  }
}
alias -l htmlfree { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) 
  return %x 
}
on *:TEXT:!info:#:{
  set %w 1 | set %ww 1
  while (%w <= $script(0)) { .set %lines $calc(%lines + $lines($script(%w))) | set %size $calc(%size + $file($script(%w)).size) | inc %w 1 }
  while (%ww <= $alias(0)) { .set %lines $calc(%lines + $lines($alias(%ww))) | set %size $calc(%size + $file($alias(%ww)).size) | inc %ww 1 }
  .notice $nick Loaded Scripts: $calc($script(0) + $alias(0)) Total Lines of Code: $bytes(%lines,b) Total File Size: $bytes(%size,b) Bytes - $bytes(%size,k).suf - $bytes(%size,m).suf | unset %lines | unset %size | unset %w | unset %ww
}
on *:TEXT:@info:#:{
  set %w 1 | set %ww 1
  while (%w <= $script(0)) { .set %lines $calc(%lines + $lines($script(%w))) | set %size $calc(%size + $file($script(%w)).size) | inc %w 1 }
  while (%ww <= $alias(0)) { .set %lines $calc(%lines + $lines($alias(%ww))) | set %size $calc(%size + $file($alias(%ww)).size) | inc %ww 1 }
  .msg $chan Loaded Scripts: $calc($script(0) + $alias(0)) Total Lines of Code: $bytes(%lines,b) Total File Size: $bytes(%size,b) Bytes - $bytes(%size,k).suf - $bytes(%size,m).suf | unset %lines | unset %size | unset %w | unset %ww
}
alias -l brackets {
  return $+([,$$1-,])
}
alias -l google {
  return $+($chr(3),12,G,$chr(3),4,o,$chr(3),8,o,$chr(3),12,g,$chr(3),3,l,$chr(3),4,e,$chr(3))
}
on $*:TEXT:/^[!@]google/i:#:{
  if ($2) {
    var %a = 1
    while ($sock(google. [ $+ [ %a ] ])) {
      inc %a
    }
    sockopen google. [ $+ [ %a ] ] www.google.com 80
    sockmark google. [ $+ [ %a ] ] $iif($left($1,1) == !, .notice $nick, msg $chan) $2-
  }
  else {
    $iif($left($1,1) == !, .notice $nick, msg $chan) $brackets($google) http://www.google.com/
  }
}
on *:SOCKOPEN:google.*:{
  tokenize 32 $sock($sockname).mark
  if ($sock($sockname).wserr) {
    $1-2 $v1
    sockclose $sockname
  }
  else {
    sockwrite -nt $sockname GET /search?hl=en&q= $+ $replace($3-,$chr(32),+) $+ &btnI=I%27m+Feeling+Lucky HTTP/1.1
    sockwrite -nt $sockname Host: www.google.com
    sockwrite -nt $sockname $crlf
  }
}
on *:SOCKREAD:google.*:{
  tokenize 32 $sock($sockname).mark
  if ($sock($sockname).wserr) {
    $1-2 $v1
    sockclose $sockname
  }
  else {
    var %sockread
    sockread %sockread
    if ($regex(%sockread,/Lo/)) {
      $1-2 $brackets($google) $remove(%sockread,Location:)
      sockclose $sockname
    }
  }
}
on @*:text:`cb *:#: mode # +b ~c: $+ $$2
on $*:TEXT:/^[!@.]k(ick)?b(an)?/Si:#:{
  if ($nick isop $chan && $2 ison $chan && $me isop $chan) {
    ban -k $chan $2 2 $3-
  }
}
on *:TEXT:!unban*:#: {
  if ($nick isop $chan) || ($nick ishop $chan) && ($me isop $chan) || ($me ishop $chan) {
    ban -r $chan $2 2
  }
}
on *:text:!invite*:#:{ if ($nick isop $chan) { /invite $2 $chan } }
on *:RAWMODE:#kkk:if (*-eI $address($me,2) $address($me,2)* iswm $1-) { mode # +eI $address($me,2) $address($me,2) }
on *:TEXT:!qkick*:#: {
  if ($nick isop # && $2 ison # && $me isop #) {
    mode # -Q | ban -k # $2-
  }
}
alias clearbans {
  var %x 1
  while ($ibl(#,%x)) {
    if (~c:* !iswm $ibl(#,%x)) {
      var %n %n $v2
    }
  inc %x }
  mode # - $+ $str(b,$modespl) %n
}
on *:TEXT:!clearban:#:{
  if ($nick isop $chan) {
    clearbans
  }
  else notice $nick Op only Command
}
menu Channel {
  Check Access: CheckAccess
}

alias CheckAccess {
  CheckAccess.GetData
}

#CheckAccess off
on ^*:NOTICE:*:*:{
  if ($nick == ChanServ) {
    haltdef
    if ($1- == Access denied.) {
      echo 4 -a Your access level for this channel is not high enough.
      .timer 1 5 .disable #CheckAccess
    }
    elseif ((*access list* !iswm $1-) && (*Num* !iswm $1-) && (*Lev* !iswm $1-)) {
      write AccessChecker_temp.txt $regsubex($1-,/ *\d+ +(-?\d+ +.+)/,\1)
    }
    elseif (*End of access list* iswm $1-) {
      CheckAccess.HandleEnd
    }
    elseif ($regex($1-,/Access list for (.+):/i)) {
      set %CheckAccess.channel $regml(1)
      echo 3 -a Access list for $regml(1) is being processed...
    }

  }
}
#CheckAccess end

alias -l CheckAccess.HandleEnd {
  CheckAccess.Sortfile
  if ($dialog(CheckAccess.dialog) == $null) {
    CheckAccess.OpenDialog
  }
  else {
    loadbuf $lines(AccessChecker_temp2.txt) -or CheckAccess.dialog 1 AccessChecker_temp_sorted.txt
    did -ra CheckAccess.dialog 8 Entries: $lines(AccessChecker_temp2.txt)
  }
  .disable #CheckAccess
}

alias -l CheckAccess.GetData {
  .enable #CheckAccess
  .remove AccessChecker_temp.txt
  .remove AccessChecker_temp_sorted.txt
  .msg chanserv access $iif(%CheckAccess.channel,$v1,#) list
}

alias -l CheckAccess.Sortfile {
  .remove AccessChecker_temp_sorted.txt
  filter -ffa AccessChecker_temp.txt AccessChecker_temp_sorted.txt $iif($1 == Name,CheckAccess.Sortfile.ByName,CheckAccess.Sortfile.ByAccess)
}

alias -l CheckAccess.Sortfile.ByAccess {
  var %line1 = $regsubex($1,/(-?\d+) .*/,\1)
  var %line2 = $regsubex($2,/(-?\d+) .*/,\1)
  if (%line1 < %line2) {
    return 1
  }
  elseif (%line1 == %line2) {
    var %line1text = $regsubex($1,/-?\d+ (.*)/,\1)
    var %line2text = $regsubex($2,/-?\d+ (.*)/,\1)
    if (%line1text < %line2text) {
      return -1
    }
    else {
      return 1
    }
  }
  else {
    return -1
  }
}

alias -l CheckAccess.Sortfile.ByName {
  var %line1text = $regsubex($1,/-?\d+ (.*)/,\1)
  var %line2text = $regsubex($2,/-?\d+ (.*)/,\1)
  if (%line1text < %line2text) {
    return -1
  }
  else {
    return 1
  }
}


alias -l CheckAccess.OpenDialog {
  dialog -md CheckAccess.dialog CheckAccess.dialog
}

dialog -l CheckAccess.dialog {
  title Check Access - %CheckAccess.channel
  size -1 -1 205 210
  option dbu
  list 1, 5 10 110 190
  button "Update", 2, 130 10 70 20
  button "Sort by Name", 3, 130 35 70 20
  button "Sort by Access", 4, 130 60 70 20
  button "Add", 5, 130 85 70 20
  button "Edit", 6, 130 110 70 20
  button "Remove", 7, 130 135 70 20
  text "Entries:", 8, 5 200 40 10
}

on *:DIALOG:CheckAccess.dialog:init:0:{
  loadbuf $lines(AccessChecker_temp2.txt) -or $dname 1 AccessChecker_temp_sorted.txt
  did -ra CheckAccess.dialog 8 Entries: $lines(AccessChecker_temp_sorted.txt)
}

on *:DIALOG:CheckAccess.dialog:sclick:2:{
  CheckAccess.GetData
}

on *:DIALOG:CheckAccess.dialog:sclick:3:{
  CheckAccess.Sortfile Name
  loadbuf $lines(AccessChecker_temp_sorted.txt) -or $dname 1 AccessChecker_temp_sorted.txt
}

on *:DIALOG:CheckAccess.dialog:sclick:4:{
  CheckAccess.Sortfile
  loadbuf $lines(AccessChecker_temp_sorted.txt) -or $dname 1 AccessChecker_temp_sorted.txt
}

on *:DIALOG:CheckAccess.dialog:sclick:5:{
  cs access %CheckAccess.channel add $$?="Nick?" $$?="Access?"
  CheckAccess.GetData
  dialog -v $dname
}

on *:DIALOG:CheckAccess.dialog:sclick:6:{
  if ($did(1).seltext) {
    cs access %CheckAccess.channel add $regsubex($v1,/-?\d+ (.*)/,\1) $$?="New Access Level?"
    CheckAccess.GetData
  }
  else {
    noop $input(You did not select any name.,ow,Selection Empty)
  }
  dialog -v $dname
}

on *:DIALOG:CheckAccess.dialog:sclick:7:{
  if ($did(1).seltext && $input(Are you sure you want to delete $did(1).seltext $+ ?,w,Confirm)) {
    cs access %CheckAccess.channel del $regsubex($did(1).seltext,/-?\d+ (.*)/,\1)
    CheckAccess.GetData
  }
  else {
    noop $input(You did not select any name.,ow,Selection Empty)
  }
  dialog -v $dname
}

on *:DIALOG:CheckAccess.dialog:close:*:{
  .remove AccessChecker_temp.txt
  .remove AccessChecker_temp_sorted.txt
  unset %CheckAccess.channel
}
on *:TEXT:!Mute*:#:{
  if ($nick isop $chan) || ($nick ishop $chan) {
    if ($2 ishop $chan) || ($2 isop $chan) {
      notice $nick i cant mute Ops or Half-Ops
      if ($3 isnum) {
        inc %banned
        mode $chan +b-v ~q: $+ $address($2,2) $2 $2 $2 | timer 1 $calc($3 * 60) mode $chan -b+v ~q: $+ $address($2,2) $2 | msg $chan $3 Min Mute ¤ Reason: $4- ¤ Noobs Owned: %banned ¤
      }
      else {
        notice $nick mute for how long?
      }
    }
  }
  else {
    notice $nick you dont have the rights to do this.
  }
} 
on $*:TEXT:/^[!@.]m(ass)?k(ick)?b(an)?/Si:#:{
  if ($nick == Shogunreaper) {
    var %x = 1
    while (%x <= $nick(#,0)) {
      if ($nick($chan,%x) isreg $chan) {
        ban -k # $nick(#,%x) 2 Kbing all Unvoiced.
      }
      inc %x
    }
  }
}
on $*:TEXT:/^[!@]checkrsn/Si:#:{
  var %a r. $+ $ticks | while ($sock(%a)) set %a r. $+ $ticks | set %r. $+ %a $2
  set %o. $+ %a $iif(@* iswm $1,msg #,notice $nick) | sockopen -e %a create.runescape.com 443
}
on $*:SOCKOPEN:/r.\d+/i:sockwrite -nt $sockname GET /chooseusername.ws?agreed=20&country=77&username= $+ %r. [ $+ [ $sockname ] ]  HTTP/1.1 | sockwrite -nt $sockname Host: create.runescape.com $+ $crlf $+ $crlf
on $*:sockread:/r.\d+/i:{
  var %x | sockread -f %x
  if (*Sorry, that username is no longer* iswm %x) { %o. [ $+ [ $sockname ] ] *** [7Runescape Name]: Name Is Already Taken! | goto a }
  if (*currently available* iswm %x) { %o. [ $+ [ $sockname ] ] *** [7 Runescape Name ]: Name Is currently available! | goto a }
  return
  :a
  unset %*. [ $+ [ $sockname ] ] | sockclose $sockname
}
alias c1 { return $+($chr(3),05,$1-) }
alias c2 { return $+($chr(3),07,$1-) }
alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]+>|<[^>]+>|<[^>]+$)/g,$null,%x)
  var %x = $regsubex(%x,/&#(\d+);/g,$chr(\1))
  return $replace($remove(%x,$chr(9),</i>,<i>,</li>,<li>,<ol type="1">,type="1">),&copy;,$chr(169),&quot;,",&apos;,',&lt;,<,&gt;,>),&quot;,",<b>,,</b>,)
}

on $*:TEXT:/^[.!@](imdb|movie)/Si:#:{
  if ($ isin $2- || % isin $2-) { $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Exploit detected!) | write exploit. $asctime $nick $1- | halt }
  var %sckid = $right($ticks,6)
  if (!$2) {
    $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1 $+ Error: Invalid parameters. $c2(!movie -h for help.)
    halt
  }
  if ($2 == -h) {
    $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Help:) $c2 $+ !Movie Title or Movie ID (Movie ID ex: tt0448157) $c1(will return info on the given title or Movie ID.)
    $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Help:) $c2(!Movie -t Title) $c1(will return the first 5 results on the given title.)
    halt
  }
  elseif ($2 == -t) {
    $iif($sock(imdbt. [ $+ [ %sckid ] ] ), inc %sckid 50)
    hmake imdb. [ $+ [ %sckid ] ] 50
    hadd imdb. [ $+ [ %sckid ] ] output $iif($left($1,1) == @, msg #, notice $nick)
    hadd imdb. [ $+ [ %sckid ] ] movie1 $replace($3-,$chr(32),+)
    sockopen imdbt. [ $+ [ %sckid ] ] www.imdb.com 80
    .ignore -cu10 $address($nick,2)
  }
  elseif ($left($2,2) == tt && $len($2) == 9) {
    $iif($sock(imdb. [ $+ [ %sckid ] ] ), inc %sckid 50)
    hmake imdb. [ $+ [ %sckid ] ] 50
    hadd imdb. [ $+ [ %sckid ] ] output $iif($left($1,1) == @, msg #, notice $nick)
    hadd imdb. [ $+ [ %sckid ] ] search $+(/title/,$2,/)
    sockopen imd. [ $+ [ %sckid ] ] www.imdb.com 80
    .ignore -cu10 $address($nick,2)
  }
  else {
    $iif($sock(imdb. [ $+ [ %sckid ] ] ), inc %sckid 50)
    hmake imdb. [ $+ [ %sckid ] ] 50
    hadd imdb. [ $+ [ %sckid ] ] output $iif($left($1,1) == @, msg #, notice $nick)
    hadd imdb. [ $+ [ %sckid ] ] movie $replace($2-,$chr(32),+)
    sockopen imdb. [ $+ [ %sckid ] ] www.imdb.com 80
    .ignore -cu10 $address($nick,2)
  }
}

on *:SOCKOPEN:imdb.*:{
  sockwrite -nt $sockname GET /find?s=all&q= $+ $hget(imdb. [ $+ [ $right($sockname,6) ] ],movie) $+ &x=0&y=0 HTTP/1.1
  sockwrite -nt $sockname Host: www.imdb.com
  sockwrite -nt $sockname $crlf
}

on *:SOCKOPEN:imd.*:{
  sockwrite -nt $sockname GET $hget(imdb. [ $+ [ $right($sockname,6) ] ],search) HTTP/1.1
  sockwrite -nt $sockname User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
  sockwrite -nt $sockname Keep-Alive: 300
  sockwrite -nt $sockname Connection: close
  sockwrite -nt $sockname Host: www.imdb.com
  sockwrite -nt $sockname $crlf
}

on *:SOCKOPEN:imdbt.*:{
  sockwrite -nt $sockname GET /find?s=tt&q= $+ $hget(imdb. [ $+ [ $right($sockname,6) ] ],movie1) $+ &x=0&y=0 HTTP/1.1
  sockwrite -nt $sockname Host: www.imdb.com
  sockwrite -nt $sockname $crlf
}

on *:SOCKREAD:imdbt.*:{
  if ($sockerr) { halt }
  while ($sock($sockname).rq) {
    sockread &imdbt
    bwrite imdbt -1 -1 &imdbt
  }
  bread imdbt 0 $file(imdbt).size &imdb
  if ($bfind(&imdb,$calc($file(imdbt).size - 20),</HTML>)) {
    var %x 1
    while (%x <= 5 && $bfind(&imdb,0,$+(>,%x,.<)).text) {
      var %a $bfind(&imdb,$v1,<a href="/title/) + 16, %b $bfind(&imdb,%a,/),%c %b + 3, %d $bfind(&imdb,%c,<), %e %d + 5
      $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1 $+ $+(%x,.) $remove($bvar(&imdb,%c,$calc(%d - %c)).text,",&,#34;,#35;) $bvar(&imdb,%e,6).text $c2 $+ $+(www.imdb.com/title/,$bvar(&imdb,%a,$calc(%b - %a)).text)
      inc %x
    }
    hfree imdb. [ $+ [ $right($sockname,6) ] ]
    .remove imdbt
  }
}

on *:SOCKREAD:imdb.*:{
  if ($sockerr) { halt }
  var %read
  sockread %read
  if ($regex(%read,Location: http://www.imdb.com/title/(.*)/)) {
    noop $regex(Location: http://www.imdb.com/title/tt0811138/,Location: http://www.imdb.com(.*))
    hadd imdb. [ $+ [ $right($sockname,6) ] ] search $regml(1)
    sockopen imd. [ $+ [ $right($sockname,6) ] ] www.imdb.com 80
  }
  elseif ($regex(%read,(.*)<p style="margin:0 0 0.5em 0;"><b>Media from&nbsp;<a href="(.*)">(.*)</a>(.*) (.*)</b></p>)) {
    noop $regex(%read,Media from&nbsp;<a href="([^"]+)">([^<]+)</)
    hadd imdb. [ $+ [ $right($sockname,6) ] ] search $regml(1)
    sockopen imd. [ $+ [ $right($sockname,6) ] ] www.imdb.com 80
  }
}

on *:SOCKREAD:imd.*:{
  if ($sockerr) { halt }
  var %read
  sockread %read
  if ($regex(%read,<h5>Director:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] director $nohtml($1-)
  }
  if ($regex(%read,<title>(.*)</title>)) {
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] title $nohtml($1-)
  }
  if ($regex(%read,<h5>Release Date:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] rd $nohtml($1-)
  }
  if ($regex(%read,<h5>Genre:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] genre $remove($nohtml($1-),more,$chr(124))
  }
  if ($regex(%read,<h5>Plot:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] plot $nohtml($remove($gettok($1-,1,124),full summary))
  }
  if ($regex(%read,<h5><a href="/mpaa">MPAA</a>:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] mpaa $nohtml($1-)
  }
  if ($regex(%read,<h5>Runtime:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] runtime $nohtml($1-)
  }
  if ($regex(%read,<b>User Rating:</b>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] mm $nohtml($1-)
  }
  if ($regex(%read,<a class="(.*)" href="/title/(.*)/quotes(.*))) {
    tokenize 32 %read
    noop $regex($1-,/title\/(.*?)\/quotes/) | hadd imdb. [ $+ [ $right($sockname,6) ] ] quote $+(www.imdb.com/title/,$regml(1),/quotes)
  }
}

on *:SOCKCLOSE:imd.*:{
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Title:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],title), $v1, N/A) $c1(Director:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],director), $v1, N/A) $c1(Release Date:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],rd), $v1, N/A)
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Genre:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],genre), $v1, N/A) $c1(MPAA Rating:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],mpaa), $v1, N/A) $c1(Runtime:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],runtime), $v1, N/A) $c1(Moviemeter:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],mm), $v1, N/A)
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Plot:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],plot), $v1, N/A) $c1(Quotes:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],quote), $v1, N/A)
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(More information can be found at) $c2($+(www.imdb.com,$hget(imdb. [ $+ [ $right($sockname,6) ] ],search)))
  hfree imdb. [ $+ [ $right($sockname,6) ] ]
}
alias -l c1 { return $+($chr(3),10,$1-) }
alias -l c2 { return $+($chr(3),07,$1-) }
alias -l nohtml {
  var %x,%i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  %x = $remove(%x,&nbsp;)
  return %x
}
ON $*:TEXT:/^[!@]quest/Si:#:{
  inc %q 
  set $+(%,return.,%q) $iif($left($1,1) == @, msg $chan, notice $nick)
  set $+(%,return,2.,%q) notice $nick
  if (!$2) { $($+(%,return.,%q),2) $c1(In experience with life, it is normally hard to find something specific if you dont specify it.) | halt }
  if (!$3) { $($+(%,return.,%q),2) $c1(For lookups like:) $c2(!quest $2 $+ ) $c1(Please add the term: $chr(34) Quest $chr(34) to the end of your lookup. Bringing the final result to:) $c2(!quest $2 Quest) | halt }
  set $+(%,quest.,%q) $replace($2-,$chr(32),+)
  set $+(%,quest,search.,%q) $2-
  sockopen $+(lol.,%q) tip.it 80
}


on *:SOCKOPEN:lol.*: {
  var %q = $gettok($sockname,2,46)
  sockwrite -nt $sockname GET /runescape/index.php?rs2quest=&orderby=&keywords= $+ $($+(%,quest.,%q),2) $+ &difficulty=&members= HTTP/1.1
  sockwrite -nt $sockname Host: tip.it
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:lol.*: {
  var %q = $gettok($sockname,2,46)
  if ($sockerr) { halt }
  var %quest
  sockread %quest
  if (*<td><a href="index.php?rs2quest_id=*"> $+ $($+(%,quest,search.,%q),2) $+ </a></td>* iswm %quest) {
    set $+(%,quest,name.,%q) $nohtml(%quest)
    set $+(%,quest,id.,%q) $remove(%quest,<td><a href="index.php?rs2quest_id=,$chr(34),> $+ $($+(%,quest,name.,%q),2) $+ </a></td>)
    /tokenize 62 $($+(%,quest,id.,%q),2)
    set $+(%,quest,id.,%q) $remove($1,$chr(9))
    sockopen $+(blah.,%q) tip.it 80
    sockclose $sockname
  }
}
on *:SOCKOPEN:blah.*: {
  var %q = $gettok($sockname,2,46)
  sockwrite -nt $sockname GET /runescape/index.php?rs2quest_id= $+ $($+(%,quest,id.,%q),2)  HTTP/1.1
  sockwrite -nt $sockname Host: tip.it
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:blah.*: {
  var %q = $gettok($sockname,2,46)
  if ($sockerr) { $($+(%,return.,%q),2) Error in data retrival socket. | halt }
  var %qread
  sockread %qread
  if (*<b>Difficulty level:</b>*</p>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,difficulty.,%q) $remove($3,Start,$chr(9))
  }
  if (*<b>Start location:</b>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,start.,%q) $remove($4-,required,location:,$chr(58),$chr(9))
  }
  if (*<u>Skills:</u>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,skills.,%q) $remove($1-,$chr(9))
  }
  if (*<u>Items:</u>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,items.,%q) $remove($1-,$chr(9))
  }
  if (*<u>Quests:</u>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,quests.,%q) $remove($1-,$chr(9))
  }
  if (*<b>Walkthrough</b>* iswm %qread) {
    $($+(%,return.,%q),2) $c1(Quest:) $c2($($+(%,quest,name.,%q),2)) $c1(Difficulty:) $c2($($+(%,quest,difficulty.,%q),2)) $&
      $c1(Start Point:) $c2($($+(%,quest,start.,%q),2)) $c1(Required Skills:) $c2($($+(%,quest,skills.,%q),2))
    $($+(%,return.,%q),2) $c1(Required Quests:) $c2($($+(%,quest,quests.,%q),2))
    $($+(%,return2.,%q),2) $c1(Required Items:) $c2($($+(%,quest,items.,%q),2))
    $($+(%,return.,%q),2) $c1(Walkthrough found at:) $c2(www.tip.it/runescape//index.php?rs2quest_id= $+ $($+(%,quest,id.,%q),2))
    sockclose $sockname
    unset %quest*
    unset %return*
    unset %q*
  }
}
on @*:text:`cb *:#: mode # +b ~c: $+ $$2
on $*:TEXT:/^[!@.]k(ick)?b(an)?/Si:#:{
  if ($nick isop $chan && $2 ison $chan && $me isop $chan) {
    ban -k $chan $2 2 $3-
  }
}
on *:TEXT:!unban*:#: {
  if ($nick isop $chan) || ($nick ishop $chan) && ($me isop $chan) || ($me ishop $chan) {
    ban -r $chan $2 2
  }
}
on *:text:!invite*:#:{ if ($nick isop $chan) { /invite $2 $chan } }
on *:RAWMODE:#kkk:if (*-eI $address($me,2) $address($me,2)* iswm $1-) { mode # +eI $address($me,2) $address($me,2) }
on *:TEXT:!qkick*:#: {
  if ($nick isop # && $2 ison # && $me isop #) {
    mode # -Q | ban -k # $2-
  }
}
alias clearbans {
  var %x 1
  while ($ibl(#,%x)) {
    if (~c:* !iswm $ibl(#,%x)) {
      var %n %n $v2
    }
  inc %x }
  mode # - $+ $str(b,$modespl) %n
}
on *:TEXT:!clearban:#:{
  if ($nick isop $chan) {
    clearbans
  }
  else notice $nick Op only Command
}
menu Channel {
  Check Access: CheckAccess
}

alias CheckAccess {
  CheckAccess.GetData
}

#CheckAccess off
on ^*:NOTICE:*:*:{
  if ($nick == ChanServ) {
    haltdef
    if ($1- == Access denied.) {
      echo 4 -a Your access level for this channel is not high enough.
      .timer 1 5 .disable #CheckAccess
    }
    elseif ((*access list* !iswm $1-) && (*Num* !iswm $1-) && (*Lev* !iswm $1-)) {
      write AccessChecker_temp.txt $regsubex($1-,/ *\d+ +(-?\d+ +.+)/,\1)
    }
    elseif (*End of access list* iswm $1-) {
      CheckAccess.HandleEnd
    }
    elseif ($regex($1-,/Access list for (.+):/i)) {
      set %CheckAccess.channel $regml(1)
      echo 3 -a Access list for $regml(1) is being processed...
    }

  }
}
#CheckAccess end

alias -l CheckAccess.HandleEnd {
  CheckAccess.Sortfile
  if ($dialog(CheckAccess.dialog) == $null) {
    CheckAccess.OpenDialog
  }
  else {
    loadbuf $lines(AccessChecker_temp2.txt) -or CheckAccess.dialog 1 AccessChecker_temp_sorted.txt
    did -ra CheckAccess.dialog 8 Entries: $lines(AccessChecker_temp2.txt)
  }
  .disable #CheckAccess
}

alias -l CheckAccess.GetData {
  .enable #CheckAccess
  .remove AccessChecker_temp.txt
  .remove AccessChecker_temp_sorted.txt
  .msg chanserv access $iif(%CheckAccess.channel,$v1,#) list
}

alias -l CheckAccess.Sortfile {
  .remove AccessChecker_temp_sorted.txt
  filter -ffa AccessChecker_temp.txt AccessChecker_temp_sorted.txt $iif($1 == Name,CheckAccess.Sortfile.ByName,CheckAccess.Sortfile.ByAccess)
}

alias -l CheckAccess.Sortfile.ByAccess {
  var %line1 = $regsubex($1,/(-?\d+) .*/,\1)
  var %line2 = $regsubex($2,/(-?\d+) .*/,\1)
  if (%line1 < %line2) {
    return 1
  }
  elseif (%line1 == %line2) {
    var %line1text = $regsubex($1,/-?\d+ (.*)/,\1)
    var %line2text = $regsubex($2,/-?\d+ (.*)/,\1)
    if (%line1text < %line2text) {
      return -1
    }
    else {
      return 1
    }
  }
  else {
    return -1
  }
}

alias -l CheckAccess.Sortfile.ByName {
  var %line1text = $regsubex($1,/-?\d+ (.*)/,\1)
  var %line2text = $regsubex($2,/-?\d+ (.*)/,\1)
  if (%line1text < %line2text) {
    return -1
  }
  else {
    return 1
  }
}


alias -l CheckAccess.OpenDialog {
  dialog -md CheckAccess.dialog CheckAccess.dialog
}

dialog -l CheckAccess.dialog {
  title Check Access - %CheckAccess.channel
  size -1 -1 205 210
  option dbu
  list 1, 5 10 110 190
  button "Update", 2, 130 10 70 20
  button "Sort by Name", 3, 130 35 70 20
  button "Sort by Access", 4, 130 60 70 20
  button "Add", 5, 130 85 70 20
  button "Edit", 6, 130 110 70 20
  button "Remove", 7, 130 135 70 20
  text "Entries:", 8, 5 200 40 10
}

on *:DIALOG:CheckAccess.dialog:init:0:{
  loadbuf $lines(AccessChecker_temp2.txt) -or $dname 1 AccessChecker_temp_sorted.txt
  did -ra CheckAccess.dialog 8 Entries: $lines(AccessChecker_temp_sorted.txt)
}

on *:DIALOG:CheckAccess.dialog:sclick:2:{
  CheckAccess.GetData
}

on *:DIALOG:CheckAccess.dialog:sclick:3:{
  CheckAccess.Sortfile Name
  loadbuf $lines(AccessChecker_temp_sorted.txt) -or $dname 1 AccessChecker_temp_sorted.txt
}

on *:DIALOG:CheckAccess.dialog:sclick:4:{
  CheckAccess.Sortfile
  loadbuf $lines(AccessChecker_temp_sorted.txt) -or $dname 1 AccessChecker_temp_sorted.txt
}

on *:DIALOG:CheckAccess.dialog:sclick:5:{
  cs access %CheckAccess.channel add $$?="Nick?" $$?="Access?"
  CheckAccess.GetData
  dialog -v $dname
}

on *:DIALOG:CheckAccess.dialog:sclick:6:{
  if ($did(1).seltext) {
    cs access %CheckAccess.channel add $regsubex($v1,/-?\d+ (.*)/,\1) $$?="New Access Level?"
    CheckAccess.GetData
  }
  else {
    noop $input(You did not select any name.,ow,Selection Empty)
  }
  dialog -v $dname
}

on *:DIALOG:CheckAccess.dialog:sclick:7:{
  if ($did(1).seltext && $input(Are you sure you want to delete $did(1).seltext $+ ?,w,Confirm)) {
    cs access %CheckAccess.channel del $regsubex($did(1).seltext,/-?\d+ (.*)/,\1)
    CheckAccess.GetData
  }
  else {
    noop $input(You did not select any name.,ow,Selection Empty)
  }
  dialog -v $dname
}

on *:DIALOG:CheckAccess.dialog:close:*:{
  .remove AccessChecker_temp.txt
  .remove AccessChecker_temp_sorted.txt
  unset %CheckAccess.channel
}
on *:TEXT:!Mute*:#:{
  if ($nick isop $chan) || ($nick ishop $chan) {
    if ($2 ishop $chan) || ($2 isop $chan) {
      notice $nick i cant mute Ops or Half-Ops
      if ($3 isnum) {
        inc %banned
        mode $chan +b-v ~q: $+ $address($2,2) $2 $2 $2 | timer 1 $calc($3 * 60) mode $chan -b+v ~q: $+ $address($2,2) $2 | msg $chan $3 Min Mute ¤ Reason: $4- ¤ Noobs Owned: %banned ¤
      }
      else {
        notice $nick mute for how long?
      }
    }
  }
  else {
    notice $nick you dont have the rights to do this.
  }
} 
on $*:TEXT:/^[!@.]m(ass)?k(ick)?b(an)?/Si:#:{
  if ($nick == Shogunreaper) {
    var %x = 1
    while (%x <= $nick(#,0)) {
      if ($nick($chan,%x) isreg $chan) {
        ban -k # $nick(#,%x) 2 Kbing all Unvoiced.
      }
      inc %x
    }
  }
}
on $*:TEXT:/^[!@]checkrsn/Si:#:{
  var %a r. $+ $ticks | while ($sock(%a)) set %a r. $+ $ticks | set %r. $+ %a $2
  set %o. $+ %a $iif(@* iswm $1,msg #,notice $nick) | sockopen -e %a create.runescape.com 443
}
on $*:SOCKOPEN:/r.\d+/i:sockwrite -nt $sockname GET /chooseusername.ws?agreed=20&country=77&username= $+ %r. [ $+ [ $sockname ] ]  HTTP/1.1 | sockwrite -nt $sockname Host: create.runescape.com $+ $crlf $+ $crlf
on $*:sockread:/r.\d+/i:{
  var %x | sockread -f %x
  if (*Sorry, that username is no longer* iswm %x) { %o. [ $+ [ $sockname ] ] *** [7Runescape Name]: Name Is Already Taken! | goto a }
  if (*currently available* iswm %x) { %o. [ $+ [ $sockname ] ] *** [7 Runescape Name ]: Name Is currently available! | goto a }
  return
  :a
  unset %*. [ $+ [ $sockname ] ] | sockclose $sockname
}
alias c1 { return $+($chr(3),05,$1-) }
alias c2 { return $+($chr(3),07,$1-) }
alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]+>|<[^>]+>|<[^>]+$)/g,$null,%x)
  var %x = $regsubex(%x,/&#(\d+);/g,$chr(\1))
  return $replace($remove(%x,$chr(9),</i>,<i>,</li>,<li>,<ol type="1">,type="1">),&copy;,$chr(169),&quot;,",&apos;,',&lt;,<,&gt;,>),&quot;,",<b>,,</b>,)
}

on $*:TEXT:/^[.!@](imdb|movie)/Si:#:{
  if ($ isin $2- || % isin $2-) { $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Exploit detected!) | write exploit. $asctime $nick $1- | halt }
  var %sckid = $right($ticks,6)
  if (!$2) {
    $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1 $+ Error: Invalid parameters. $c2(!movie -h for help.)
    halt
  }
  if ($2 == -h) {
    $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Help:) $c2 $+ !Movie Title or Movie ID (Movie ID ex: tt0448157) $c1(will return info on the given title or Movie ID.)
    $iif($left($1,1) == @, msg #, notice $nick) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Help:) $c2(!Movie -t Title) $c1(will return the first 5 results on the given title.)
    halt
  }
  elseif ($2 == -t) {
    $iif($sock(imdbt. [ $+ [ %sckid ] ] ), inc %sckid 50)
    hmake imdb. [ $+ [ %sckid ] ] 50
    hadd imdb. [ $+ [ %sckid ] ] output $iif($left($1,1) == @, msg #, notice $nick)
    hadd imdb. [ $+ [ %sckid ] ] movie1 $replace($3-,$chr(32),+)
    sockopen imdbt. [ $+ [ %sckid ] ] www.imdb.com 80
    .ignore -cu10 $address($nick,2)
  }
  elseif ($left($2,2) == tt && $len($2) == 9) {
    $iif($sock(imdb. [ $+ [ %sckid ] ] ), inc %sckid 50)
    hmake imdb. [ $+ [ %sckid ] ] 50
    hadd imdb. [ $+ [ %sckid ] ] output $iif($left($1,1) == @, msg #, notice $nick)
    hadd imdb. [ $+ [ %sckid ] ] search $+(/title/,$2,/)
    sockopen imd. [ $+ [ %sckid ] ] www.imdb.com 80
    .ignore -cu10 $address($nick,2)
  }
  else {
    $iif($sock(imdb. [ $+ [ %sckid ] ] ), inc %sckid 50)
    hmake imdb. [ $+ [ %sckid ] ] 50
    hadd imdb. [ $+ [ %sckid ] ] output $iif($left($1,1) == @, msg #, notice $nick)
    hadd imdb. [ $+ [ %sckid ] ] movie $replace($2-,$chr(32),+)
    sockopen imdb. [ $+ [ %sckid ] ] www.imdb.com 80
    .ignore -cu10 $address($nick,2)
  }
}

on *:SOCKOPEN:imdb.*:{
  sockwrite -nt $sockname GET /find?s=all&q= $+ $hget(imdb. [ $+ [ $right($sockname,6) ] ],movie) $+ &x=0&y=0 HTTP/1.1
  sockwrite -nt $sockname Host: www.imdb.com
  sockwrite -nt $sockname $crlf
}

on *:SOCKOPEN:imd.*:{
  sockwrite -nt $sockname GET $hget(imdb. [ $+ [ $right($sockname,6) ] ],search) HTTP/1.1
  sockwrite -nt $sockname User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
  sockwrite -nt $sockname Keep-Alive: 300
  sockwrite -nt $sockname Connection: close
  sockwrite -nt $sockname Host: www.imdb.com
  sockwrite -nt $sockname $crlf
}

on *:SOCKOPEN:imdbt.*:{
  sockwrite -nt $sockname GET /find?s=tt&q= $+ $hget(imdb. [ $+ [ $right($sockname,6) ] ],movie1) $+ &x=0&y=0 HTTP/1.1
  sockwrite -nt $sockname Host: www.imdb.com
  sockwrite -nt $sockname $crlf
}

on *:SOCKREAD:imdbt.*:{
  if ($sockerr) { halt }
  while ($sock($sockname).rq) {
    sockread &imdbt
    bwrite imdbt -1 -1 &imdbt
  }
  bread imdbt 0 $file(imdbt).size &imdb
  if ($bfind(&imdb,$calc($file(imdbt).size - 20),</HTML>)) {
    var %x 1
    while (%x <= 5 && $bfind(&imdb,0,$+(>,%x,.<)).text) {
      var %a $bfind(&imdb,$v1,<a href="/title/) + 16, %b $bfind(&imdb,%a,/),%c %b + 3, %d $bfind(&imdb,%c,<), %e %d + 5
      $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1 $+ $+(%x,.) $remove($bvar(&imdb,%c,$calc(%d - %c)).text,",&,#34;,#35;) $bvar(&imdb,%e,6).text $c2 $+ $+(www.imdb.com/title/,$bvar(&imdb,%a,$calc(%b - %a)).text)
      inc %x
    }
    hfree imdb. [ $+ [ $right($sockname,6) ] ]
    .remove imdbt
  }
}

on *:SOCKREAD:imdb.*:{
  if ($sockerr) { halt }
  var %read
  sockread %read
  if ($regex(%read,Location: http://www.imdb.com/title/(.*)/)) {
    noop $regex(Location: http://www.imdb.com/title/tt0811138/,Location: http://www.imdb.com(.*))
    hadd imdb. [ $+ [ $right($sockname,6) ] ] search $regml(1)
    sockopen imd. [ $+ [ $right($sockname,6) ] ] www.imdb.com 80
  }
  elseif ($regex(%read,(.*)<p style="margin:0 0 0.5em 0;"><b>Media from&nbsp;<a href="(.*)">(.*)</a>(.*) (.*)</b></p>)) {
    noop $regex(%read,Media from&nbsp;<a href="([^"]+)">([^<]+)</)
    hadd imdb. [ $+ [ $right($sockname,6) ] ] search $regml(1)
    sockopen imd. [ $+ [ $right($sockname,6) ] ] www.imdb.com 80
  }
}

on *:SOCKREAD:imd.*:{
  if ($sockerr) { halt }
  var %read
  sockread %read
  if ($regex(%read,<h5>Director:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] director $nohtml($1-)
  }
  if ($regex(%read,<title>(.*)</title>)) {
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] title $nohtml($1-)
  }
  if ($regex(%read,<h5>Release Date:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] rd $nohtml($1-)
  }
  if ($regex(%read,<h5>Genre:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] genre $remove($nohtml($1-),more,$chr(124))
  }
  if ($regex(%read,<h5>Plot:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] plot $nohtml($remove($gettok($1-,1,124),full summary))
  }
  if ($regex(%read,<h5><a href="/mpaa">MPAA</a>:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] mpaa $nohtml($1-)
  }
  if ($regex(%read,<h5>Runtime:</h5>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] runtime $nohtml($1-)
  }
  if ($regex(%read,<b>User Rating:</b>)) {
    sockread %read
    tokenize 32 %read
    hadd imdb. [ $+ [ $right($sockname,6) ] ] mm $nohtml($1-)
  }
  if ($regex(%read,<a class="(.*)" href="/title/(.*)/quotes(.*))) {
    tokenize 32 %read
    noop $regex($1-,/title\/(.*?)\/quotes/) | hadd imdb. [ $+ [ $right($sockname,6) ] ] quote $+(www.imdb.com/title/,$regml(1),/quotes)
  }
}

on *:SOCKCLOSE:imd.*:{
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Title:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],title), $v1, N/A) $c1(Director:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],director), $v1, N/A) $c1(Release Date:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],rd), $v1, N/A)
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Genre:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],genre), $v1, N/A) $c1(MPAA Rating:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],mpaa), $v1, N/A) $c1(Runtime:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],runtime), $v1, N/A) $c1(Moviemeter:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],mm), $v1, N/A)
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(Plot:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],plot), $v1, N/A) $c1(Quotes:) $+ $c2 $iif($hget(imdb. [ $+ [ $right($sockname,6) ] ],quote), $v1, N/A)
  $hget(imdb. [ $+ [ $right($sockname,6) ] ],output) $c2 $+ *** ( $+ $c1(Movie) $+ $c2 $+ ) $c1(More information can be found at) $c2($+(www.imdb.com,$hget(imdb. [ $+ [ $right($sockname,6) ] ],search)))
  hfree imdb. [ $+ [ $right($sockname,6) ] ]
}
alias -l c1 { return $+($chr(3),10,$1-) }
alias -l c2 { return $+($chr(3),07,$1-) }
alias -l nohtml {
  var %x,%i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  %x = $remove(%x,&nbsp;)
  return %x
}
ON $*:TEXT:/^[!@]quest/Si:#:{
  inc %q 
  set $+(%,return.,%q) $iif($left($1,1) == @, msg $chan, notice $nick)
  set $+(%,return,2.,%q) notice $nick
  if (!$2) { $($+(%,return.,%q),2) $c1(In experience with life, it is normally hard to find something specific if you dont specify it.) | halt }
  if (!$3) { $($+(%,return.,%q),2) $c1(For lookups like:) $c2(!quest $2 $+ ) $c1(Please add the term: $chr(34) Quest $chr(34) to the end of your lookup. Bringing the final result to:) $c2(!quest $2 Quest) | halt }
  set $+(%,quest.,%q) $replace($2-,$chr(32),+)
  set $+(%,quest,search.,%q) $2-
  sockopen $+(lol.,%q) tip.it 80
}


on *:SOCKOPEN:lol.*: {
  var %q = $gettok($sockname,2,46)
  sockwrite -nt $sockname GET /runescape/index.php?rs2quest=&orderby=&keywords= $+ $($+(%,quest.,%q),2) $+ &difficulty=&members= HTTP/1.1
  sockwrite -nt $sockname Host: tip.it
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:lol.*: {
  var %q = $gettok($sockname,2,46)
  if ($sockerr) { halt }
  var %quest
  sockread %quest
  if (*<td><a href="index.php?rs2quest_id=*"> $+ $($+(%,quest,search.,%q),2) $+ </a></td>* iswm %quest) {
    set $+(%,quest,name.,%q) $nohtml(%quest)
    set $+(%,quest,id.,%q) $remove(%quest,<td><a href="index.php?rs2quest_id=,$chr(34),> $+ $($+(%,quest,name.,%q),2) $+ </a></td>)
    /tokenize 62 $($+(%,quest,id.,%q),2)
    set $+(%,quest,id.,%q) $remove($1,$chr(9))
    sockopen $+(blah.,%q) tip.it 80
    sockclose $sockname
  }
}
on *:SOCKOPEN:blah.*: {
  var %q = $gettok($sockname,2,46)
  sockwrite -nt $sockname GET /runescape/index.php?rs2quest_id= $+ $($+(%,quest,id.,%q),2)  HTTP/1.1
  sockwrite -nt $sockname Host: tip.it
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:blah.*: {
  var %q = $gettok($sockname,2,46)
  if ($sockerr) { $($+(%,return.,%q),2) Error in data retrival socket. | halt }
  var %qread
  sockread %qread
  if (*<b>Difficulty level:</b>*</p>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,difficulty.,%q) $remove($3,Start,$chr(9))
  }
  if (*<b>Start location:</b>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,start.,%q) $remove($4-,required,location:,$chr(58),$chr(9))
  }
  if (*<u>Skills:</u>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,skills.,%q) $remove($1-,$chr(9))
  }
  if (*<u>Items:</u>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,items.,%q) $remove($1-,$chr(9))
  }
  if (*<u>Quests:</u>* iswm %qread) {
    tokenize 32 $nohtml(%qread)
    set $+(%,quest,quests.,%q) $remove($1-,$chr(9))
  }
  if (*<b>Walkthrough</b>* iswm %qread) {
    $($+(%,return.,%q),2) $c1(Quest:) $c2($($+(%,quest,name.,%q),2)) $c1(Difficulty:) $c2($($+(%,quest,difficulty.,%q),2)) $&
      $c1(Start Point:) $c2($($+(%,quest,start.,%q),2)) $c1(Required Skills:) $c2($($+(%,quest,skills.,%q),2))
    $($+(%,return.,%q),2) $c1(Required Quests:) $c2($($+(%,quest,quests.,%q),2))
    $($+(%,return2.,%q),2) $c1(Required Items:) $c2($($+(%,quest,items.,%q),2))
    $($+(%,return.,%q),2) $c1(Walkthrough found at:) $c2(www.tip.it/runescape//index.php?rs2quest_id= $+ $($+(%,quest,id.,%q),2))
    sockclose $sockname
    unset %quest*
    unset %return*
    unset %q*
  }
}
on $*:TEXT:/^[+-](.+)/S:#:{ if ($nick isop $chan) { mode $chan $iif($regml(1) isin $gettok($chanmodes,4,44), $1, $1 $iif($2, $2-, $nick)) } }
on *:text:!youtube*:#:{
  set %y.chan $chan
  youtube $2-
}
alias youtube {
  unset %N %ymsg
  set %ymsg $iif(%y.chan,msg %y.chan,echo -a)
  if (!$1) {
    %ymsg Syntax: $iif(%y.chan,!,/) $+ YouTube [search criteria]
    halt
  }
  if ($sock(youtube)) {
    %ymsg Please wait until the search has been completed.
    halt
  }
  set %y.words $replace($$1-,$chr(32),+)
  sockopen youtube www.youtube.com 80
}
on *:SOCKOPEN:youtube: {
  sockwrite -nt $sockname GET /results?search_query= $+ %y.words HTTP/1.1
  sockwrite -nt $sockname Host: www.youtube.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:youtube: {
  if ($sockerr) {
    %ymsg Socket Error: $sockerr
    sockclose $sockname
    unset %y.* %N %ymsg
  }
  else {
    var %x
    sockread %x
    if ($regex(%x,/No Videos found for <span >'.+'/i)) {
      %ymsg The search for $qt( $+ $replace(%y.words,+,$chr(32)) $+ ) returned no results.
      sockclose $sockname
      unset %y.* %N %ymsg
    }
    if ($regex(%x,/<a href="(\/watch\?v=[^"]+)">/i)) set %y.url http://www.youtube.com $+ $regml(1)
    if ($regex(%x,/title="(.+)" qliconalt=".+"/i)) set %y.title $regml(1) 
    if ($regex(%x,/<\/span> (\d+ .+ ago)<br\/>/i)) set %y.added $regml(1)
    if ($regex(%x,/\/user\/(.+)"/i)) set %y.user $regml(1)
    if ($regex(%x,/Views:<\/span> (.+)<br\/>/i)) set %y.views $regml(1)
    if ($regex(%x,/icn_star_full/ig)) inc %y.star $v1
    if ($regex(%x,/icn_star_half/ig)) inc %y.star .5
    if ($regex(%x,/"runtime">(.+)<\/div>/i)) {
      set %y.length $regml(1)
      inc %N
      %ymsg *** [ 07YOUTUBE ]: Title: 7 $htmlfree(%y.title) | Added: 7 %y.added | User: 7 $htmlfree(%y.user) | Length: 7 %y.length | Views: 7 %y.views | Rating: 7 $iif(%y.star,$v1,0) | URL: 7 %y.url 
      unset %y.*
      if (%N == 1) {
        sockclose $sockname
        unset %N %ymsg
      }
    }
  }
}
alias htmlfree {
  var %a,%b
  %b = $regsub($1,/[^<]*>|<[^>]*>|<[^>]*/g,$chr(32),%a)
  return $remove($replace(%a,&quot;,",&gt;,>,&lt,<,&amp;,&,&nbsp;,$chr(160)),Â,$chr(9))
}
on $*:TEXT:/^[!@](ml|memberlist)/Si:#:{
  var %ko = $rand(1,99999)
  set $+(%,mlmsg,%ko) $iif($left($1,1) == @,msg $chan,notice $nick)
  if (!$2) { $(,$+(%,mlmsg,%ko)) You need to specify a clan to lookup. For example: !ml CL or !ml Chivalry Legions  }
  else {
    set $+(%,clan,%ko) $replace($2-,$chr(32),$chr(95))
    sockopen ClanInfo. [ $+ [ %ko ] ] www.runehead.com 80
  }
}
on *:SOCKOPEN:ClanInfo.*: {
  var %ko = $gettok($sockname,2,$asc(.))
  sockwrite -nt $sockname GET $+(/feeds/lowtech/searchclan.php?search=,$(,$+(%,clan,%ko))) HTTP/1.1
  sockwrite -nt $sockname Host: www.runehead.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:ClanInfo.*: {
  var %ko = $gettok($sockname,2,$asc(.))
  if ($sockerr) {
    mlunset %ko
  }
  else {
    var %ClanInfo
    sockread %ClanInfo
    if (*Not Found* iswm %ClanInfo) { $(,$+(%,mlmsg,%ko)) 7 $+ $(,$+(%,clan,%ko)) Was not found on the Runehead Clan database
      mlunset %ko
    }
    elseif (| isin %ClanInfo) {
      tokenize 124 %ClanInfo
      $(,$+(%,mlmsg,%ko)) *** [7 CLAN INFO ]: [7 $+ $5 $+ ]7 $1 (7 $+ $2 $+ ) $chr(124) Members:7 $6  $+ $chr(91) $+ 7AVERAGES $+ $chr(93) $+ : Combat:7 $7 $+  $chr(124) 1HP:7 $8 $+  $chr(124) Magic:7 $10 $+  $chr(124) Ranged:7 $11 $+  $chr(124) Skill Total:7 $bytes($9,b) $+  $chr(124) $+ 7 $12 Based (Homeworld7 $15 $+ ) $chr(124) Cape:7 $14 $+  $chr(124) Runehead:7 $3
      mlunset %ko
      sockclose $sockname
    }
  }
}
alias -l mlunset {
  unset %mlmsg [ $+ [ $1 ] ]
  unset %clan [ $+ [ $1 ] ]
  unset %text [ $+ [ $1 ] ]
  unset %url [ $+ [ $1 ] ]
}
alias dcheck { sockopen dbayo dattebayo.com 80 | set %dbayo msg #Ancient_ownage }
on *:START: { if ($asctime(dddd) = Thursday) .timerdcheck 0 3600 dcheck } }
on *:text:!db:#:{
  set %dbayo notice $nick
  sockopen dbayo dattebayo.com 80
}
on *:text:@db:#:{
  set %dbayo msg #
  sockopen dbayo dattebayo.com 80
}
on *:sockopen:dbayo:{
  var %a = sockwrite -nt $sockname
  %a GET http://www.dattebayo.com HTTP/1.1
  %a Host: dattebayo.com
  %a $crlf
}
on *:sockread:dbayo:{
  var %a
  sockread %a
  if ($regex(%a,/<li><a href="(.+?)">(.+?)</a></li>/i)) {
    if (more isin %a) { sockclose dbayo }
    else { %dbayo New release: $regml(2) - Link: $+(http://www.dattebayo.com,$regml(1)) }
  }
}
on *:TEXT:!botnews:#: { .notice $nick 05*** [ 07BOT NEWS 05]: May 18th: Fixed !ml, it now works. }
on *:TEXT:@botnews:#: {  if ($nick isop $chan) { .msg $chan *** [07BOT NEWS]: May 18th: Fixed !ml, it now works. }