All pastes #545869 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-06 22:03 UTC
rendered paste body
on $*:TEXT:/^[!@.](clan|lookup)/si:#: {
  .sockclose clan
  set %clan.return notice $nick
  if (@ isin $1) set %clan.return msg $chan
  set %clan.search $replace($2-,$chr(32),$chr(95))
  if (!$2) set %clan.search $nick
  if (!$2) && (%rsn [ $+ [ $nick ] ]) set %clan.search %rsn [ $+ [ $nick ] ]
  sockopen clan www.runehead.com 80
}
on *:SOCKOPEN:clan: {
  sockwrite -nt $sockname GET /clans/search.php?search= $+ %clan.search HTTP/1.1
  sockwrite -nt $sockname Host: www.runehead.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:clan: {
  if ($sockerr) { 
    %clan.return Socket Error: $sockname $chr(124) Error Code: $sockerr
  }
  else {
    var %clan.read
    sockread %clan.read
    if (*<p>No results were found for the* iswm %clan.read) { 
      %clan.return %1 $+ No clan found for the Name $+ %2 %clan.search $+ %1 $+ . Check Your Spelling and Try Again.
    }
    if (*<td class='tableborder'><b>* iswm %clan.read) { set %clan.name $htmlfree(%clan.read) 
      var %clan.read
      sockread %clan.read
      if (*<td class='tableborder'><a href='ml.php?clan=* iswm %clan.read) { set %clan.nam $htmlfree(%clan.read)
        set %clan.url $remove(%clan.read,<td class='tableborder'><a href='ml.php?clan=,'></a>,</td>, $+ %clan.name $+ )
        if (%clan.name == zdzira) set %clan.url zdzira
        set %clan.url $remove(%clan.url,$chr(32))
        set %clan.na $htmlfree(%clan.url)
        set %clan.url $remove(%clan.url,' title='View %clan.na Memberlist'>,</a>,' title='View Memberlist'>,%clan.na)
        if (%clan.na == zdzira) set %clan.url Zdzira
        if (%clan.na == Aether) set %clan.url Aether
        if (%clan.na == PuresOwnage) set %clan.url PuresOwnage
        if (%clan.na == raht) set %clan.url raht
        var %clan.read
        sockread %clan.read
        if (*<td class='tableborder'>* iswm %clan.read) { set %clan.rank $htmlfree(%clan.read)
          %clan.return 14 $+ Name: $+ 12 %clan.name 14 $+ $chr(124) Clan: $+ 12 %clan.nam 14 $+  $chr(124) Rank: $+ 12 %clan.rank
          %clan.return 14 $+ WebSite: $+ 12 Http://www.runehead.com/clans/ml.php?clan= $+ $remove(%clan.url,'title='ViewMemberlist'>)
          sockclose $sockname 
          unset %clan.*
        }
      }
    }
  }
}
alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&amp;) | return %x }
on $*:TEXT:/^[!@.](rs|players|online)/si:#: {
  sockclose players
  set %play.return notice $nick
  if (@ isin $1) set %play.return msg $chan
  sockopen players www.runescape.com 80
}
on *:SOCKOPEN:players: {
  sockwrite -nt $sockname GET /title.ws HTTP/1.1
  sockwrite -nt $sockname Host: www.runescape.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:players: {
  if ($sockerr) { 
    %play.return Socket Error: $sockname $chr(124) Error Code: $sockerr
  }
  else {
    var %play.read
    sockread %play.read
    if (*There are currently* iswm %play.read) { 
      set %play.ers $remove(%play.read,There are currently,people playing!)
      %play.return 14 $+ there are currently 12 %play.ers $+ 14 People playing RuneScape!
      unset %play.*
      sockclose $sockname
    }
  }
}
on $*:TEXT:/^[!@.](best|world)/si:#: {
  if ($sock(world)) .notice $nick 12Please Wait, Bot in use.
  set %w.return notice $nick
  if (@ isin $1) set %w.return msg $chan
  sockopen world www.runescape.com 80
}
on *:SOCKOPEN:world: {
  sockwrite -nt $sockname GET /sln.ws?lores.x=447&lores.y=215&plugin=0 HTTP/1.1
  sockwrite -nt $sockname Host: www.runescape.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:world: {
  if ($sockerr) {  
    %w.return Socket Error: $sockname $chr(124) Error Code: $sockerr
  }
  else {
    var %w.read
    sockread %w.read
    if (*Choose best free world for me</a>* iswm %w.read) set %w.freeworld $htmlfree(%w.read)
    if (*Choose best members only world for me</a>* iswm %w.read) { set %w.memworld $htmlfree(%w.read)
      set %w.freeworld $remove(%w.freeworld,Choose best free world for me,$chr(40),$chr(41),World,$chr(32))
      set %w.memworld $remove(%w.memworld,Choose best members only world for me,$chr(40),$chr(41),World,$chr(32))
      %w.return 14 $+ Best Free-To-Play World: 12 %w.freeworld 
      %w.return 14 $+ Best Pay-To-Play World: 12 %w.memworld 
      unset %w.*
      sockclose $sockname
    }
  }
}
alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&amp;) | return %x }

on $*:TEXT:/^[!@.]price/si:#: {
  if (!$2) {
    /notice $nick 12Please state an item.
  }
  else {
    .sockclose price
    set %price.return notice $nick
    set %price.item $replace($2-,$chr(32),$chr(43))
    sockopen price www.zybez.net 80
  }
}
on *:SOCKOPEN:price: {
  sockwrite -nt $sockname GET /priceguide.php?search_terms= $+ %price.item $+ &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: {
  if ($sockerr) { 
    %price.return Socket Error: $sockname $chr(124) Error Code: $sockerr
  }
  else {
    var %price.read
    sockread %price.read
    if (*<!--name-->* iswm %price.read) {
      set %price.1 $remove(%price.read,<!--name--><td class='tablebottom'>,</td>)
    }
    if (*<!--price-->* iswm %price.read) {
      set %price.2 $remove(%price.read,<!--price--><td class="tablebottom">,</td>)
    }
    if (*<td class="tablebottom"><a href="/priceguide.php?category=* iswm %price.read) {
      set %price.3 $htmlfree(%price.read)
      %price.return 14Item:12 %price.1 14 $+ $chr(124) Price:12 %price.2 14 $+ $chr(124) Category:12 %price.3
      sockclose $sockname
      unset %price.*
    }
  }
}
alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&amp;) | return %x }

on $*:TEXT:/^[!@.]Stats/Si:#: {
  set %stats.return Notice $nick
  set %stats.person $nick
  if ($2) set %stats.person $replace($2-,$chr(32),$chr(95))
  sockopen Stats www.slushpuppy.silverinterlocution.org 80
}
on *:SOCKOPEN:Stats: {
  sockwrite -nt $sockname GET /rsstats.php?stats= $+ %stats.person HTTP/1.1
  sockwrite -nt $sockname Host: www.slushpuppy.silverinterlocution.org
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:Stats: {
  if ($sockerr) { 
    %stats.return Socket Error: $sockname $chr(124) Error Code: $sockerr
  }
  else {
    var %stats.read
    sockread %stats.read
    if (*does not feature in the hiscores.<br>* iswm %stats.read) { 
      %stats.return 14The Name12 %stats.person 14Does not appear to be in the RuneScape HighScores.
      sockclose $sockname 
      unset %stats.*
      halt
    }
    if (*The Combat level for* iswm %stats.read) { 
      var %stats.read
      sockread %stats.read
    }
    if (*<br>* iswm %stats.read) { 
      set %stats.stats $remove(%stats.read,<br>)
      set %stats.stats $replace(%stats.stats,Overall:,14 $+ $chr(124) Overall:12)
      set %stats.stats $replace(%stats.stats,Attack:,14 $+ $chr(124) Attack:12)
      set %stats.stats $replace(%stats.stats,Defence:,14 $+ $chr(124) Defence:12)
      set %stats.stats $replace(%stats.stats,Strength:,14 $+ $chr(124) Strength:12)
      set %stats.stats $replace(%stats.stats,Hitpoints:,14 $+ $chr(124) Hitpoints:12)
      set %stats.stats $replace(%stats.stats,Ranged:,14 $+ $chr(124) Ranged:12)
      set %stats.stats $replace(%stats.stats,Prayer:,14 $+ $chr(124) Prayer:12)
      set %stats.stats $replace(%stats.stats,Magic:,14 $+ $chr(124) Magic:12)
      set %stats.stats $replace(%stats.stats,Cooking:,14 $+ $chr(124) Cooking:12)
      set %stats.stats $replace(%stats.stats,Woodcutting:,14 $+ $chr(124) Woodcutting:12)
      set %stats.stats $replace(%stats.stats,Fletching:,14 $+ $chr(124) Fletching:12)
      set %stats.stats $replace(%stats.stats,Fishing:,14 $+ $chr(124) Fishing:12)
      set %stats.stats $replace(%stats.stats,Firemaking:,14 $+ $chr(124) Firemaking:12)
      set %stats.stats $replace(%stats.stats,Crafting:,14 $+ $chr(124) Crafting:12)
      set %stats.stats $replace(%stats.stats,Smithing:,14 $+ $chr(124) Smithing:12)
      set %stats.stats $replace(%stats.stats,Mining:,14 $+ $chr(124) Mining:12)
      set %stats.stats $replace(%stats.stats,Herblore:,14 $+ $chr(124) Herblore:12)
      set %stats.stats $replace(%stats.stats,Agility:,14 $+ $chr(124) Agility:12)
      set %stats.stats $replace(%stats.stats,Thieving:,14 $+ $chr(124) Thieving:12)
      set %stats.stats $replace(%stats.stats,Slayer:,14 $+ $chr(124) Slayer:12)
      set %stats.stats $replace(%stats.stats,Farming:,14 $+ $chr(124) Farming:12)
      set %stats.stats $replace(%stats.stats,Runecraft:,14 $+ $chr(124) RuneCraft:12)
      set %stats.stats $replace(%stats.stats,Hunter:,14 $+ $chr(124) Hunter:12)
      set %stats.stats $replace(%stats.stats,Construction:,14 $+ $chr(124) Construction:12)
      %stats.return 14Stats for12 %stats.person $+ 14:
      %stats.return %stats.stats
      unset %stats.*
      sockclose $sockname
    }
  }
}
;change the colors; 

alias -l c1 { return $+($chr(3),14,$1-) } 
alias -l c2 { return $+($chr(3),04,$1-) } 

on *:TEXT:*:#: { 
inc %ID 1 

;if !defname (you cant use $findfile w/ this); 

if ($right($1,-1) == defname) && ($2) && ($len($2-) <= 12) { 
writeini DefRSN.ini RSNs $mask($fulladdress,3) $replace($2-,$chr(32),-) 
notice $nick $c1(your nickname for the adress) $c2($mask($fulladdress,3)) $c1(has been set to) $c2($2-) 
halt 
} 
if ($setskill($right($1,-1))) && (!$3) { 

;if its a !skill command; 

/hadd -m table. $+ %ID Style. $+ %ID stat 
/hadd -m table. $+ %ID Search. $+ %ID $setskill($remove($1,@,!,.)) 
/hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
/hadd -m table. $+ %ID display. $+ %ID $iif($left($1,1) == @,msg $chan,notice $nick) 
if ($len($2-) > 12) { $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname) $c2($2-) $c1(is too long) | halt } 
if ($2) /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
elseif ($readini(DefRSN.ini,RSNs,$nick)) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
else /hadd -m table. $+ %ID target. $+ %ID $nick 
sockopen $+(rs.,%ID) hiscore.runescape.com 80 
} 
elseif ($right($1,-1) == stats) { 

;if its !stats; 

/hadd -m table. $+ %ID Style. $+ %ID allstats 
/hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
/hadd -m table. $+ %ID display. $+ %ID $iif($left($1,1) == @,msg $chan,notice $nick) 
if ($len($2-) > 12) { $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname) $c2($2-) $c1(is too long) | halt } 
if ($2) /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
elseif ($readini(DefRSN.ini,RSNs,$nick)) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
else /hadd -m table. $+ %ID target. $+ %ID $nick 
sockopen $+(rs.,%ID) hiscore.runescape.com 80 
halt 
} 
elseif ($regex($1,/co?mb(at)?/Si)) { 

;if its !cmb; 

/hadd -m table. $+ %ID Style. $+ %ID combat 
/hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
/hadd -m table. $+ %ID display. $+ %ID $iif($left($1,1) == @,msg $chan,notice $nick) 
if ($len($2-) > 12) { $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname) $c2($2-) $c1(is too long) | halt } 
if ($2) /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
elseif ($readini(DefRSN.ini,RSNs,$nick)) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
else /hadd -m table. $+ %ID target. $+ %ID $nick 
sockopen $+(rs.,%ID) hiscore.runescape.com 80 
halt 
} 
else { halt } 
} 
on *:SOCKOPEN:rs.*:{ 
var %ID = $gettok($sockname,2,46) 
sockwrite -nt $sockname GET /lang/en/aff/runescape/hiscorepersonal.ws?user1= $+ $hget(table. $+ %ID,target. $+ %ID) HTTP/1.1 
sockwrite -nt $sockname Host: hiscore.runescape.com $+ $crlf $+ $crlf 
} 
on *:SOCKREAD:rs.*:{ 
var %ID = $gettok($sockname,2,46), $& 
%file = $hget(table. $+ %ID,search. $+ %ID), $& 
%style = $hget(table. $+ %ID,style. $+ %ID) 
if ($sockerr) { 
echo -a Error. 
halt 
} 
else { 
var %read 
sockread %read 
if (*feature* iswm %read) { 

;if none of the skills for $nick is in highscores; 

$hget(table. $+ %ID,display. $+ %ID) $c1(The nickname:) $c2($hget(table. $+ %ID,target. $+ %ID)) $c1(did not feature in runescape highscores for any skill!) 
sockclose $sockname 
halt 
} 
elseif (%style == stat) { 
if (%file iswm %read) { 

;get the rank/level/exp for certain skill; 

/hadd -m table. $+ %ID rank. $+ %ID $htmlfree($GetRank(%read)) 
/hadd -m table. $+ %ID Level. $+ %ID $htmlfree($ReadNextLine(%read)) 
/hadd -m table. $+ %ID exp. $+ %ID $htmlfree($ReadNextLine(%read)) 
if (!$hget(table. $+ %ID,level. $+ %ID)) { 

;if skill isnt ranked; 

$hget(table. $+ %ID,display. $+ %ID) $c1(The nickname:) $c2($hget(table. $+ %ID,target. $+ %ID)) $c1(did not feature in runescape highscores for) $c2($hget(table. $+ %ID,search. $+ %ID)) 
sockclose $sockname 
halt 
} 

;display the informations witch you got above; 

$hget(table. $+ %ID,display. $+ %ID) $c2(%file) $c1(stats for) $c2($hget(table. $+ %ID,target. $+ %ID)) $+ $c1( 
if (%file == overall) { 
$hget(table. $+ %ID,display. $+ %ID) $c1(Level:) $c2($hget(table. $+ %ID,level. $+ %ID)) $c1(Rank:) $c2($hget(table. $+ %id,rank. $+ %ID)) $c1(Exp:) $c2($hget(table. $+ %ID,Exp. $+ %ID)) 
sockclose $sockname 
halt 
} 
$hget(table. $+ %ID,display. $+ %ID) $c1(Level:) $c2($hget(table. $+ %ID,level. $+ %ID)) $c1(Rank:) $c2($hget(table. $+ %id,rank. $+ %ID)) 
$hget(table. $+ %ID,display. $+ %ID) $c1(Exp:) $c2($hget(table. $+ %ID,Exp. $+ %ID)) $c1(Exp for) $c2($calc($hget(table. $+ %ID,level. $+ %ID) + 1)) $c1(%file) $+ $c1( $c2($comma($xp2next($hget(table. $+ %ID,level. $+ %ID),$hget(table. $+ %ID,exp. $+ %ID)))) 
sockclose $sockname 
halt 
} 
} 
elseif (%style == allstats) { 

;get information about every single stat,; 

if (Overall iswm %read) /hadd -m table. $+ %ID Hoverall. $+ %ID $c1(Overall:) $c2($htmlfree($GetLevel(%read))) 
if (Attack iswm %read) /hadd -m table. $+ %ID Hattack. $+ %ID $c1(Attack:) $c2($htmlfree($GetLevel(%read))) 
if (Defence iswm %read) /hadd -m table. $+ %ID Hdefence. $+ %ID $c1(Defence:) $c2($htmlfree($GetLevel(%read))) 
if (Strength iswm %read) /hadd -m table. $+ %ID Hstrength. $+ %ID $c1(Strength:) $c2($htmlfree($GetLevel(%read))) 
if (Hitpoints iswm %read) /hadd -m table. $+ %ID Hhitpoints. $+ %ID $c1(Hitpoints:) $c2($htmlfree($GetLevel(%read))) 
if (Ranged iswm %read) /hadd -m table. $+ %ID Hrange. $+ %ID $c1(Ranged:) $c2($htmlfree($GetLevel(%read))) 
if (Prayer iswm %read) /hadd -m table. $+ %ID Hprayer. $+ %ID $c1(Prayer:) $c2($htmlfree($GetLevel(%read))) 
if (Magic iswm %read) /hadd -m table. $+ %ID Hmagic. $+ %ID $c1(Magic:) $c2($htmlfree($GetLevel(%read))) 
if (cooking iswm %read) /hadd -m table. $+ %ID Hcook. $+ %ID $c1(Cooking:) $c2($htmlfree($GetLevel(%read))) 
if (woodcutting iswm %read) /hadd -m table. $+ %ID Hwc. $+ %ID $c1(Woodcutting:) $c2($htmlfree($GetLevel(%read))) 
if (fletching iswm %read) /hadd -m table. $+ %ID Hfletch. $+ %ID $c1(Fletching:) $c2($htmlfree($GetLevel(%read))) 
if (fishing iswm %read) /hadd -m table. $+ %ID Hfish. $+ %ID $c1(Fishing:) $c2($htmlfree($GetLevel(%read))) 
if (Firemaking iswm %read) /hadd -m table. $+ %ID Hfm. $+ %ID $c1(Firemaking:) $c2($htmlfree($GetLevel(%read))) 
if (Crafting iswm %read) /hadd -m table. $+ %ID Hcraft. $+ %ID $c1(Crafting:) $c2($htmlfree($GetLevel(%read))) 
if (Smithing iswm %read) /hadd -m table. $+ %ID Hsmith. $+ %ID $c1(Smithing:) $c2($htmlfree($GetLevel(%read))) 
if (Mining iswm %read) /hadd -m table. $+ %ID Hmining. $+ %ID $c1(Mining:) $c2($htmlfree($GetLevel(%read))) 
if (Herblore iswm %read) /hadd -m table. $+ %ID Hherb. $+ %ID $c1(Herblore:) $c2($htmlfree($GetLevel(%read))) 
if (Agility iswm %read) /hadd -m table. $+ %ID Hagility. $+ %ID $c1(Agility:) $c2($htmlfree($GetLevel(%read))) 
if (Thieving iswm %read) /hadd -m table. $+ %ID Hthieving. $+ %ID $c1(Thieving:) $c2($htmlfree($GetLevel(%read))) 
if (Slayer iswm %read) /hadd -m table. $+ %ID Hslayer. $+ %ID $c1(Slayer:) $c2($htmlfree($GetLevel(%read))) 
if (Farming iswm %read) /hadd -m table. $+ %ID Hfarming. $+ %ID $c1(Farming:) $c2($htmlfree($GetLevel(%read)))} 
if (Runecraft iswm %read) /hadd -m table. $+ %ID Hrunecraft. $+ %ID $c1(Runecraft:) $c2($htmlfree($GetLevel(%read))) 
if (Hunter iswm %read) /hadd -m table. $+ %ID Hhunter. $+ %ID $c1(Hunter:) $c2($htmlfree($GetLevel(%read)))) 
if (Construction iswm %read) /hadd -m table. $+ %ID Hcon. $+ %ID $c1(Construction:) $c2($htmlfree($GetLevel(%read))) 
} 
if (*class="mainscroll-bottom"* iswm %read) { 

;display the information; 

$hget(table. $+ %ID,display. $+ %ID) $c1(stats for) $c2($hget(table. $+ %ID,target. $+ %ID)) $+ $c1( 
$hget(table. $+ %ID,display. $+ %ID) $hget(table. $+ %ID,hoverall. $+ %ID) 
$hget(table. $+ %ID,display. $+ %ID) $hget(table. $+ %ID,Hattack. $+ %ID) $hget(table. $+ %ID,Hstrength. $+ %ID) $hget(table. $+ %ID,Hdefence. $+ %ID) $hget(table. $+ %ID,Hhitpoints. $+ %ID) $hget(table. $+ %ID,HRange. $+ %ID) $hget(table. $+ %ID,Hprayer. $+ %ID) $hget(table. $+ %ID,Hmagic. $+ %ID) $hget(table. $+ %ID,Hcook. $+ %ID) $hget(table. $+ %ID,Hwc. $+ %ID) $hget(table. $+ %ID,Hfletch. $+ %ID) $hget(table. $+ %ID,Hfish. $+ %ID) $& 
$hget(table. $+ %ID,Hfm. $+ %ID) $hget(table. $+ %ID,Hsmith. $+ %ID) $hget(table. $+ %ID,Hmining. $+ %ID) $hget(table. $+ %ID,Hcraft. $+ %ID) $hget(table. $+ %ID,HAgility. $+ %ID) $hget(table. $+ %ID,HThieving. $+ %ID) $hget(table. $+ %ID,HSlayer. $+ %ID) $hget(table. $+ %ID,Hfarming. $+ %ID) $hget(table. $+ %ID,Hrunecarft. $+ %ID) $hget(table. $+ %ID,HHunter. $+ %ID) $hget(table. $+ %ID,Hcon. $+ %ID) 
sockclose $sockname 
halt 
} 
elseif (%style == combat) { 

;Get the Combat skills information; 

if (Attack iswm %read) /hadd -m table. $+ %ID Hattack. $+ %ID $htmlfree($GetLevel(%read)) 
if (Defence iswm %read) /hadd -m table. $+ %ID Hdefence. $+ %ID $htmlfree($GetLevel(%read)) 
if (Strength iswm %read) /hadd -m table. $+ %ID Hstrength. $+ %ID $htmlfree($GetLevel(%read)) 
if (Hitpoints iswm %read) /hadd -m table. $+ %ID Hhitpoints. $+ %ID $htmlfree($GetLevel(%read)) 
if (Ranged iswm %read) /hadd -m table. $+ %ID Hrange. $+ %ID $htmlfree($GetLevel(%read)) 
if (Prayer iswm %read) /hadd -m table. $+ %ID Hprayer. $+ %ID $htmlfree($GetLevel(%read)) 
if (Magic iswm %read) /hadd -m table. $+ %ID Hmagic. $+ %ID $htmlfree($GetLevel(%read)) 

;Calculate the combat level using the Skills, many thanks to steiner for showing me calculate syntax; 

var %a = $calc($hget(table. $+ %ID,Hdefence. $+ %ID) * 100), $& 
%b = $calc($hget(table. $+ %ID,Hhitpoints. $+ %ID) * 100), $& 
%c = $calc($hget(table. $+ %ID,Hprayer. $+ %ID) * 50), $& 
%base = $calc($calc(%a + %b + %c) / 400), $& 
%d = $calc($hget(table. $+ %ID,Hattack. $+ %ID) * 130), $& 
%e = $calc($hget(table. $+ %ID,Hstrength. $+ %ID) * 130) 
if ($and($hget(table. $+ %ID,Hrange. $+ %ID),1) == 0) var %f = $calc($calc($calc($hget(table. $+ %ID,Hrange. $+ %ID) - 1) + $calc($hget(table. $+ %ID,Hrange. $+ %ID) * 2)) * 65) 
elseif ($and($hget(table. $+ %ID,Hrange. $+ %ID),1) == 1) var %f = $calc($hget(table. $+ %ID,Hrange. $+ %ID) * 195) 
if ($and($hget(table. $+ %ID,Hmagic. $+ %ID),1) == 0) var %g = $calc($calc($calc($hget(table. $+ %ID,Hmagic. $+ %ID) - 1) + $calc($hget(table. $+ %ID,Hmagic. $+ %ID) * 2)) * 65) 
elseif ($and($hget(table. $+ %ID,Hmagic. $+ %ID),1) == 1) var %g = $calc($hget(table. $+ %ID,Hmagic. $+ %ID) * 195) 
var %mcombat = $calc($calc(%d + %e) / 400), $& 
%rcombat = $calc(%f / 400), $& 
%macombat = $calc(%g / 400) 
if (%mcombat > %rcombat) && (%mcombat > %macombat) { 
/hadd -m table. $+ %ID HCombat. $+ %id $calc(%mcombat + %base) 
/hadd -m table. $+ %ID HClass. $+ %id Melee Based 
} 
elseif (%rcombat > %mcombat) && (%rcombat > %macombat) { 
/hadd -m table. $+ %ID HCombat. $+ %id $calc(%rcombat + %base) 
/hadd -m table. $+ %ID HClass. $+ %id Ranged Based 
} 
elseif (%macombat > %mcombat) && (%macombat > %rcombat) { 
/hadd -m table. $+ %ID HCombat. $+ %id $calc(%macombat + %base) 
/hadd -m table. $+ %ID HClass. $+ %id Magic Based 
} 
var %temp = $abs($calc($int($calc($hget(table. $+ %ID,Hcombat. $+ %ID) +1)) - $hget(table. $+ %ID,Hcombat. $+ %ID))), $& 
%a.lvl = $ceil($calc(%temp / .32707)), %s.lvl = $ceil($calc(%temp / .324)), $& 
%d.lvl = $ceil($calc(%temp / .25)), $& 
%m.lvl = $ceil($calc(%temp / .487)), $& 
%r.lvl = $ceil($calc(%temp / .487)), $& 
%p.lvl = $ceil($calc(%temp / .124)) 
if ($hget(table. $+ %ID,Hclass. $+ %ID) == Magic Based) var %lvl.base = Magic: %m.lvl 
elseif ($hget(table. $+ %ID,Hclass. $+ %ID) == Ranged Based) var %lvl.base = Ranged: %r.lvl 
else var %lvl.base = $c1(Att:) $c2(%a.lvl) $c1(Str:) $c2(%s.lvl) 

;Calculation end; 

if (Cooking iswm %read) { 

;Message out combat information; 

$hget(table. $+ %ID,display. $+ %ID) $c1(Combat stats for) $hget(table. $+ %ID,target. $+ %ID) $+ : 
$hget(table. $+ %ID,display. $+ %ID) $c1(Level) $c2($hget(table. $+ %ID,Hcombat. $+ %ID) ( $+ $hget(table. $+ %ID,Hclass. $+ %ID) $+ )) 
$hget(table. $+ %ID,display. $+ %ID) $c1(Attack) $c2($hget(table. $+ %ID,Hattack. $+ %ID)) $c1(Strength) $c2($hget(table. $+ %ID,Hstrength. $+ %ID)) $c1(Defence) $c2($hget(table. $+ %ID,Hdefence. $+ %ID)) $c1(Hitpoints) $c2($hget(table. $+ %ID,Hhitpoints. $+ %ID)) $c1(Ranged) $c2($hget(table. $+ %ID,HRange. $+ %ID)) $c1(Prayer) $c2($hget(table. $+ %ID,Hprayer. $+ %ID)) $c1(Magic) $c2($hget(table. $+ %ID,Hmagic. $+ %ID)) 
$hget(table. $+ %ID,display. $+ %ID) $c1(Levels for) $c2($int($calc($hget(table. $+ %ID,Hcombat. $+ %ID) + 1)) combat) $+ $c1( %lvl.base $c1(def/hp:) $c2(%d.lvl) $c1(Prayer:) $c2(%p.lvl) 
sockclose $sockname 
halt 
} 
} 
} 
} 

;my custom aliases; 

alias -l comma { Var %a, %b = $regsub($ticks,$$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a) | Return %a } 
alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&amp;) | return %x } 
alias -l ReadNextLine { var %x = $1 | sockread %x | return %x } 
alias -l GetRank { var %x = $1 | sockread %x | var %y | sockread %y | return %y } 
alias -l GetLevel { var %x = $1 | sockread %x | var %z | sockread %z | var %y | sockread %y | return %y } 
alias -l xp2Next { var %xp = $remove($2,$chr(44)), %nextxp = $xp($calc($1 + 1)) | return $calc(%nextxp - %xp) } 
alias -l xp { var %x = 1, %level = $calc($1 - 1), %xp = 0 | while (%x <= %level) { var %TempXp = $calc((%x + 300 * 2^(%x / 7)) /4) | inc %xp %TempXp | inc %x } | return $int(%xp) } 
alias -l setskill { 
if ($regex($1,/^(st|(skill)?total|overall)$/Si)) return Overall 
elseif ($1 == 1) || ($regex($1,/^at(t|k|tack)$/Si)) return Attack 
elseif ($1 == 2) || ($regex($1,/^def(en[cs]e)?$$/Si)) return Defence 
elseif ($1 == 3) || ($regex($1,/^str(ength)?$/Si)) return Strength 
elseif ($1 == 4) || ($regex($1,/^hp|hit(s|points?)?$/Si)) return Hitpoints 
elseif ($1 == 5) || ($regex($1,/^range(r|d|ing)?$/Si)) return Ranged 
elseif ($1 == 6) || ($regex($1,/^Pray(er)?$$/Si)) return Prayer 
elseif ($1 == 7) || ($regex($1,/^mag(e|ic)$$/Si)) return Magic 
elseif ($1 ==  || ($regex($1,/^cook(ing)?$/Si)) return Cooking 
elseif ($1 == 9) || ($regex($1,/^wc|wood(cut(ting)?)?$/Si)) return Woodcutting 
elseif ($1 == 10) || ($regex($1,/^fletch(ing)?$/Si)) return Fletching 
elseif ($1 == 11) || ($regex($1,/^fish(ing)?$/Si)) return Fishing 
elseif ($1 == 12) || ($regex($1,/^(fire|fm)(make?(ing)?|ing)?$/Si)) return Firemaking 
elseif ($1 == 13) || ($regex($1,/^craft(ing)?$/Si)) return Crafting 
elseif ($1 == 14) || ($regex($1,/^(smith|smelt)(ing)?$/Si)) return Smithing 
elseif ($1 == 15) || ($regex($1,/^mine(ing)?$/Si)) return Mining 
elseif ($1 == 16) || ($regex($1,/^herb(law|lore)?$/Si)) return Herblore 
elseif ($1 == 17) || ($regex($1,/^agil(ity)?$/Si)) return Agility 
elseif ($1 == 1 || ($regex($1,/^(th(ei|ie)[fv](e|ing)?)$/Si)) return Thieving 
elseif ($1 == 19) || ($regex($1,/^slay(er|ing)?$/Si)) return Slayer 
elseif ($1 == 20) || ($regex($1,/^farm(er|ing)?$/Si)) return Farming 
elseif ($1 == 21) || ($regex($1,/^(rc|runecraft)(er|ing)?$/Si)) return Runecraft 
elseif ($1 == 22) || ($regex($1,/^(hunt)(er|ing)?$/si)) return Hunter 
elseif ($1 == 23) || ($regex($1,/^(con)(struc?tion)?$/si)) return Construction 
}