All pastes #791536 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-20 23:04 UTC
rendered paste body
; ############################################################
; Stats Lookup
; By: UNKNOWN
; Re-Made by: Lee-[32201]
; Its a rip of the main script, Re-written, and loads of filters added :)
; ############################################################
alias c1 { return $+(12 $1-,) }
alias c2 { return $+(4 $1-,) }

on *:TEXT:!stats*:#: {
  if ($1- == *#*) || ($1- == *@*) { halt }
  if ($chan == #idle) { halt }
  tokenize 32 $strip($1-)
  if ($right($1,-1) == stats) var %style = astats

  inc %ID
  if ($len($2-) > 12) {
    notice $nick $($+(%,stats.display., %ID),2) $c1(The name) $c2($2-) $c1(is too long)
    cleanup %ID
    halt
  }
  elseif ($2) set $+(%,stats.rsn., %ID) $replace($2-,$chr(32),-)
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) set $+(%,stats.rsn., %ID) $ifmatch
  elseif ($readini(DefRSN.ini,RSNs,$nick)) set $+(%,stats.rsn., %ID) $ifmatch
  else set $+(%,stats.rsn., %ID) $nick

  set $+(%,stats.style., %ID) %style
  set $+(%,stats.skill., %ID) %skill
  set $+(%,stats.display., %ID) $iif($left($1,1) == @,msg $chan, /notice $nick)
  sockopen $+(stats., %ID) hiscore.runescape.com 80
}

on *:TEXT:@stats*:#: {
  if ($1- == @stats zezima) { /notice $nick GTFO BITCH | halt } 
  if ($1- == *#*) || ($1- == *@*) { halt }
  if ($chan == #idle) { halt }
  tokenize 32 $strip($1-)
  if ($right($1,-1) == stats) var %style = astats

  inc %ID
  if ($len($2-) > 12) {
    /notice $nick $($+(%,stats.display., %ID),2) $c1(The name) $c2($2-) $c1(is too long)
    cleanup %ID
    halt
  }
  elseif ($2) set $+(%,stats.rsn., %ID) $replace($2-,$chr(32),-)
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) set $+(%,stats.rsn., %ID) $ifmatch
  elseif ($readini(DefRSN.ini,RSNs,$nick)) set $+(%,stats.rsn., %ID) $ifmatch
  else set $+(%,stats.rsn., %ID) $nick

  set $+(%,stats.style., %ID) %style
  set $+(%,stats.skill., %ID) %skill
  set $+(%,stats.display., %ID) $iif($left($1,1) == @,msg $chan, /notice $nick)
  sockopen $+(stats., %ID) hiscore.runescape.com 80
}

on *:TEXT:!defname*:#: {
  if ($2- == $chr(36) $+ ip) || ($2- == $chr(36) $+ readini) || ($3- == $chr(36) $+ ip) || ($4- == $chr(36) $+ ip)  || ($5- == $chr(36) $+ ip)  || ($6- == $chr(36) $+ ip) { notice $nick Invalid Characters! | halt }
  if ($len($2-) > 12) { notice $nick Name too long | halt }

  writeini DefRSN.ini RSNs $mask($fulladdress,3) $2-
  notice $nick Your default RSN for the host $mask($fulladdress,3) has been set to $2-
}

on *:TEXT:!combat*:#: {
  if ($chan == #idle) { halt }
  tokenize 32 $strip($1-)
  var %style = combat

  inc %ID
  if ($len($2-) > 12) {
    /notice $nick $($+(%,stats.display., %ID),2) $c1(The name) $c2($2-) $c1(is too long)
    cleanup %ID
    halt
  }
  elseif ($2) set $+(%,stats.rsn., %ID) $replace($2-,$chr(32),-)
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) set $+(%,stats.rsn., %ID) $ifmatch
  elseif ($readini(DefRSN.ini,RSNs,$nick)) set $+(%,stats.rsn., %ID) $ifmatch
  else set $+(%,stats.rsn., %ID) $nick

  set $+(%,stats.style., %ID) %style
  set $+(%,stats.skill., %ID) %skill
  set $+(%,stats.display., %ID) $iif($left($1,1) == @,msg $chan, /notice $nick)
  sockopen $+(stats., %ID) hiscore.runescape.com 80
}
on *:TEXT:!cmb*:#: {
  if ($chan == #idle) { halt }
  tokenize 32 $strip($1-)
  var %style = combat

  inc %ID
  if ($len($2-) > 12) {
    /notice $nick $($+(%,stats.display., %ID),2) $c1(The name) $c2($2-) $c1(is too long)
    cleanup %ID
    halt
  }
  elseif ($2) set $+(%,stats.rsn., %ID) $replace($2-,$chr(32),-)
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) set $+(%,stats.rsn., %ID) $ifmatch
  elseif ($readini(DefRSN.ini,RSNs,$nick)) set $+(%,stats.rsn., %ID) $ifmatch
  else set $+(%,stats.rsn., %ID) $nick

  set $+(%,stats.style., %ID) %style
  set $+(%,stats.skill., %ID) %skill
  set $+(%,stats.display., %ID) $iif($left($1,1) == @,msg $chan, /notice $nick)
  sockopen $+(stats., %ID) hiscore.runescape.com 80
}

alias common {
  var %style = istat, %skill = %skill2
  inc %ID
  if ($len(%name) > 12) {
    $($+(%,stats.display., %ID),2) $c1(The name) $c2($2-) $c1(is too long)
    cleanup %ID
    halt
  }
  elseif (%name) set $+(%,stats.rsn., %ID) $replace(%name,$chr(32),-)
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) set $+(%,stats.rsn., %ID) $ifmatch
  elseif ($readini(DefRSN.ini,RSNs,$nick)) set $+(%,stats.rsn., %ID) $ifmatch
  else set $+(%,stats.rsn., %ID) $nick

  set $+(%,stats.style., %ID) %style
  set $+(%,stats.skill., %ID) %skill
  set $+(%,stats.display., %ID) $iif($left(%type,1) == @,msg $chan, /notice $nick)
  sockopen $+(stats., %ID) hiscore.runescape.com 80
}

on *:sockopen:stats.*: {
  var %id = $gettok($sockname,2,46)
  sockwrite -n $sockname GET /hiscorepersonal.ws?user1= $+ $($+(%,stats.rsn., %ID),2) HTTP/1.1
  sockwrite -n $sockname Host: hiscore.runescape.com $+ $crlf $+ $crlf
}
on *:sockread:stats.*: {
  sockread &Incoming
  bwrite $sockname -1 -1 &Incoming
  if ($bfind(&Incoming, 1, </html>).text) makehash $sockname
  elseif ($bfind(&Incoming, 1, does not feature in the hiscores.).text) {
    $($+(%,stats.display., %ID),19) 4 $+ $($+(%,stats.rsn.,%ID),19) 12does not feature in the hiscores15.
    cleanup $gettok($sockname,19,46)
  }
}
alias -l makehash {
  var %file = $1
  bread %file 1 $file(%file).size &stats
  var %currentstat, %x = 1
  while (%x) {
    var %x = $bfind(&stats,$calc(%x + 1),<a href="overall.ws?table=)
    var %currentstat = $striptags($bvar(&stats,%x,200).text)
    tokenize 10 %currentstat
    hadd -m %file $1 $2 $3 $4 $xp2next($3,$4)
  }
  process %file
}

alias process {
  var %table = $1, %id = $gettok($1,2,46), %x = 0, $&
    %display = $($+(%,stats.display., %ID),2), $&
    %rsn = $($+(%,stats.rsn., %ID),2), $&
    %skill = $($+(%,stats.skill., %ID),2), $&
    %style = $($+(%,stats.style., %ID),2)
  ;shoot;
  if (%style == astats) {
    while (%x <= 16) {
      tokenize 32 $hget(%table,$setskill(%x))
      if ($2) var %statline = %statline $+ 12 $+ $setskill(%x) $+ 15:4 $2 $+ 15. $chr(32)
      inc %x
    }
    if (%statline == $null) {
      %display 4 $+ $($+(%,stats.rsn.,%ID),2) 12does not feature in the hiscores15.
      halt
    }
    %display 12Stats for4 %rsn $+ 15:
    %display %statline
    %statline =
    while (%x <= 24) {
      tokenize 32 $hget(%table,$setskill(%x))

      if ($2) var %statline = %statline $+ 12 $+ $setskill(%x) $+ 15:4 $2 $+ 15. $chr(32)
      inc %x
    }
    %display %statline
  }      %display 4 $+ %skill 12stats for4 %rsn $+ 15:
      %display 12Rank15:4 $1 $+ 15. 12Level15:4 $bytes($2,b)) $+ 15. 12Exp15:4 $3 $+ 15. $& 
        $iif(%skill != Overall,12Exp to lvl4 $calc($2 + 1)) $+ 15:4 $bytes(%EXPNEXT,b))
      set %CalculateNeeded $bytes($4,b)
      set %CalculateNeeded $remove(%CalculateNeeded, $chr(44), $chr(32))

      if (%skill == Attack) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Cave Horror:4 $bytes($int($calc((%CalculateNeeded)/220)),bd) 15| 12Bandits:4 $bytes($int($calc((%CalculateNeeded)/259)),bd) 15| 12Daganoth:4 $bytes($int($calc((%CalculateNeeded)/395)),bd) 15| 12Experiments:4 $bytes($int($calc((%CalculateNeeded)/399)),bd) 15| 12Dust Devil:4 $bytes($int($calc((%CalculateNeeded)/419)),bd)
      }
      if (%skill == Strength) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Cave Horror:4 $bytes($int($calc((%CalculateNeeded)/220)),bd) 15| 12Bandits:4 $bytes($int($calc((%CalculateNeeded)/259)),bd) 15| 12Daganoth:4 $bytes($int($calc((%CalculateNeeded)/395)),bd) 15| 12Experiments:4 $bytes($int($calc((%CalculateNeeded)/399)),bd) 15| 12Dust Devil:4 $bytes($int($calc((%CalculateNeeded)/419)),bd)
      }
      if (%skill == Defence) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Cave Horror:4 $bytes($int($calc((%CalculateNeeded)/220)),bd) 15| 12Bandits:4 $bytes($int($calc((%CalculateNeeded)/259)),bd) 15| 12Daganoth:4 $bytes($int($calc((%CalculateNeeded)/395)),bd) 15| 12Experiments:4 $bytes($int($calc((%CalculateNeeded)/399)),bd) 15| 12Dust Devil:4 $bytes($int($calc((%CalculateNeeded)/419)),bd)
      }
      if (%skill == Firemaking) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Logs:4 $bytes($int($calc((%CalculateNeeded)/40)),bd) 15| 12Oak Logs:4 $bytes($int($calc((%CalculateNeeded)/60)),bd) 15| 12Willow Logs:4 $bytes($int($calc((%CalculateNeeded)/90)),bd) 15|12 Teak Logs:4 $bytes($int($calc((%CalculateNeeded)/105)),bd) 15| 12Maple Logs:4 $bytes($int($calc((%CalculateNeeded)/135)),bd) 15| 12Mahogany Logs:4 $bytes($int($calc((%CalculateNeeded)/157.5)),bd) 15| 12Yew Logs:4 $bytes($int($calc((%CalculateNeeded)/202.5)),bd) 15| 12Magic Logs:4 $bytes($int($calc((%CalculateNeeded)/303)),bd)
        notice %namecommand 6Pyre: 12Regular Pyre:4 $bytes($int($calc((%CalculateNeeded)/60)),bd) 15| 12Oak Pyre:4 $bytes($int($calc((%CalculateNeeded)/70)),bd) 15| 12Willow Pyre:4 $bytes($int($calc((%CalculateNeeded)/100)),bd) 15| 12Teak Pyre:4 $bytes($int($calc((%CalculateNeeded)/120)),bd) 15| 12Maple Pyre:4 $bytes($int($calc((%CalculateNeeded)/175)),bd) 15| 12Mahogany Pyre:4 $bytes($int($calc((%CalculateNeeded)/210)),bd) 15| 12Yew Pyre:4 $bytes($int($calc((%CalculateNeeded)/255)),bd) 15| 12Magic Pyre:4 $bytes($int($calc((%CalculateNeeded)/404.5)),bd)
      }
      if (%skill == Ranged) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Rock Crab:4 $bytes($int($calc((%CalculateNeeded)/200)),bd) 15| 12Ogres:4 $bytes($int($calc((%CalculateNeeded)/240)),bd) 15| 12Lessers:4 $bytes($int($calc((%CalculateNeeded)/320)),bd) 15| 12Dust Devils:4 $bytes($int($calc((%CalculateNeeded)/420)),bd) 15| 12Blue Dragons:4 $bytes($int($calc((%CalculateNeeded)/436)),bd) 15| 12Fire Giant:4 $bytes($int($calc((%CalculateNeeded)/448)),bd) 15| 12Hellhounds:4 $bytes($int($calc((%CalculateNeeded)/472)),bd)
      }
      if (%skill == Hunter) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Swamp lizard:4 $bytes($int($calc((%CalculateNeeded)/152)),bd) 15| 12Orange salamander:4 $bytes($int($calc((%CalculateNeeded)/224)),bd) 15| 12Red salamander:4 $bytes($int($calc((%CalculateNeeded)/272)),bd) 15| 12Black salamander:4 $bytes($int($calc((%CalculateNeeded)/304)),bd) 15| 12Spotted kebbit:4 $bytes($int($calc((%CalculateNeeded)/104)),bd) 15| 12Dark kebbit:4 $bytes($int($calc((%CalculateNeeded)/132)),bd) 15| 12Dashing kebbit:4 $bytes($int($calc((%CalculateNeeded)/156)),bd) 15| 12Ferret:4 $bytes($int($calc((%CalculateNeeded)/115)),bd) 15| 12Chinchompa:4 $bytes($int($calc((%CalculateNeeded)/198.5)),bd) 15| 12Red Chinchompa:4 $bytes($int($calc((%CalculateNeeded)/265)),bd) 15| 12Imp:4 $bytes($int($calc((%CalculateNeeded)/450)),bd)
      }
      if (%skill == Mining) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Copper:4 $bytes($int($calc((%CalculateNeeded)/17.5)),bd) 15|12 Tin:4 $bytes($int($calc((%CalculateNeeded)/17.5)),bd) 15|12 Essence:4 $bytes($int($calc((%CalculateNeeded)/5)),bd) 15|12 Iron:4 $bytes($int($calc((%CalculateNeeded)/35)),bd) 15|12 Silver:4 $bytes($int($calc((%CalculateNeeded)/40)),bd) 15|12 Coal:4 $bytes($int($calc((%CalculateNeeded)/50)),bd) 15|12 Gold:4 $bytes($int($calc((%CalculateNeeded)/65)),bd) 15|12 Mithril:4 $bytes($int($calc((%CalculateNeeded)/80)),bd) 15|12 Adamantite:4 $bytes($int($calc((%CalculateNeeded)/95)),bd) 15|12 Runite:4 $bytes($int($calc((%CalculateNeeded)/125)),bd)
      }
      if (%skill == Prayer) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Bones:4 $bytes($int($calc((%CalculateNeeded)/4.5)),bd) 15|12 Big Bones:4 $bytes($int($calc((%CalculateNeeded)/15)),bd) 15|12 Zogre Bones:4 $bytes($int($calc((%CalculateNeeded)/22.5)),bd) 15|12 Babydragon Bones:4 $bytes($int($calc((%CalculateNeeded)/30)),bd) 15|12 Dragon Bones:4 $bytes($int($calc((%CalculateNeeded)/72)),bd) 15|12 Ourg Bones:4 $bytes($int($calc((%CalculateNeeded)/140)),bd)
      }
      if (%skill == Runecraft) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Air:4 $bytes($int($calc((%CalculateNeeded)/5)),bd) 15|12 Mind:4 $bytes($int($calc((%CalculateNeeded)/5.5)),bd) 15|12 Water:4 $bytes($int($calc((%CalculateNeeded)/6)),bd) 15|12 Earth:4 $bytes($int($calc((%CalculateNeeded)/6.5)),bd) 15|12 Fire:4 $bytes($int($calc((%CalculateNeeded)/7)),bd) 15|12 Body:4 $bytes($int($calc((%CalculateNeeded)/7.5)),bd) 15|12 Cosmic:4 $bytes($int($calc((%CalculateNeeded)/5)),bd) 15|12 Chaos:4 $bytes($int($calc((%CalculateNeeded)/8.5)),bd) 15|12 Astral:4 $bytes($int($calc((%CalculateNeeded)/8.7)),bd) 15|12 Nature:4 $bytes($int($calc((%CalculateNeeded)/9)),bd) 15|12 Law:4 $bytes($int($calc((%CalculateNeeded)/9.5)),bd) 15|12 Death:4 $bytes($int($calc((%CalculateNeeded)/10)),bd)
      }
      if (%skill == Smithing) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:6(Smelting)12 Bronze:4 $bytes($int($calc((%CalculateNeeded)/6.2)),bd) 15|12 Iron:4 $bytes($int($calc((%CalculateNeeded)/12.5)),bd) 15|12 Silver:4 $bytes($int($calc((%CalculateNeeded)/13.7)),bd) 15|12 Steel:4 $bytes($int($calc((%CalculateNeeded)/17.5)),bd) 15|12 Gold:4 $bytes($int($calc((%CalculateNeeded)/22.5)),bd) $+ 12(Gaunts:4 $bytes($int($calc((%CalculateNeeded)/56.2)),bd) $+ 12) 15|12 Mithril:4 $bytes($int($calc((%CalculateNeeded)/30)),bd) 15|12 Adamantite:4 $bytes($int($calc((%CalculateNeeded)/37.5)),bd) 15|12 Runite:4 $bytes($int($calc((%CalculateNeeded)/50)),bd)
      }
      if (%skill == Thieving) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Master Farmer:4 $bytes($int($calc((%CalculateNeeded)/43)),bd) 15|12 Guard:4 $bytes($int($calc((%CalculateNeeded)/46.5)),bd) 15|12 Fremennik:4 $bytes($int($calc((%CalculateNeeded)/65)),bd) 15|12 Desert Bandit:4 $bytes($int($calc((%CalculateNeeded)/79.4)),bd) 15|12 Knight:4 $bytes($int($calc((%CalculateNeeded)/84.3)),bd) 15|12 Gnome:4 $bytes($int($calc((%CalculateNeeded)/198.5)),bd) 15|12 Hero:4 $bytes($int($calc((%CalculateNeeded)/275)),bd) 15|12 Elf:4 $bytes($int($calc((%CalculateNeeded)/353)),bd)
      }
      if (%skill == Woodcutting) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Logs:4 $bytes($int($calc((%CalculateNeeded)/25)),bd) 15|12 Oak:4 $bytes($int($calc((%CalculateNeeded)/37.5)),bd) 15|12 Willow:4 $bytes($int($calc((%CalculateNeeded)/67.5)),bd) 15|12 Teak:4 $bytes($int($calc((%CalculateNeeded)/85)),bd) 15|12 Maple:4 $bytes($int($calc((%CalculateNeeded)/100)),bd) 15|12 Mahogany:4 $bytes($int($calc((%CalculateNeeded)/125)),bd) 15|12 Yew:4 $bytes($int($calc((%CalculateNeeded)/175)),bd) 15|12 Magic:4 $bytes($int($calc((%CalculateNeeded)/250)),bd)      
      }
      if (%skill == Magic) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Varrock TP:4 $bytes($int($calc((%CalculateNeeded)/35)),bd) 15|12 Lumbridge TP:4 $bytes($int($calc((%CalculateNeeded)/41)),bd) 15|12 Falador TP:4 $bytes($int($calc((%CalculateNeeded)/48)),bd) 15|12 Camelot TP:4 $bytes($int($calc((%CalculateNeeded)/55.5)),bd) 15|12 Ardougne TP:4 $bytes($int($calc((%CalculateNeeded)/61)),bd) 15|12 Watchtower TP:4 $bytes($int($calc((%CalculateNeeded)/68)),bd) 15|12 Trollheim TP:4 $bytes($int($calc((%CalculateNeeded)/68)),bd) 15|12 Ape Atol TP:4 $bytes($int($calc((%CalculateNeeded)/74)),bd) 15|12 High Alch:4 $bytes($int($calc((%CalculateNeeded)/65)),bd)
      }
      if (%skill == Fishing) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Trout:4 $bytes($int($calc((%CalculateNeeded)/50)),bd) 15|12 Salmon:4 $bytes($int($calc((%CalculateNeeded)/70)),bd) 15|12 Tuna:4 $bytes($int($calc((%CalculateNeeded)/80)),bd) 15|12 Lobster:4 $bytes($int($calc((%CalculateNeeded)/90)),bd) 15|12 Bass:4 $bytes($int($calc((%CalculateNeeded)/100)),bd) 15|12 Swordfish:4 $bytes($int($calc((%CalculateNeeded)/100)),bd) 15|12 Monkfish:4 $bytes($int($calc((%CalculateNeeded)/120)),bd) 15|12 Shark:4 $bytes($int($calc((%CalculateNeeded)/110)),bd)
      }
      if (%skill == Cooking) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Tuna:4 $bytes($int($calc((%CalculateNeeded)/100)),bd) 15|12 Lobster:4 $bytes($int($calc((%CalculateNeeded)/120)),bd) 15|12 Bass:4 $bytes($int($calc((%CalculateNeeded)/130)),bd) 15|12 Swordfish:4 $bytes($int($calc((%CalculateNeeded)/140)),bd) 15|12 Monkfish:4 $bytes($int($calc((%CalculateNeeded)/150)),bd) 15|12 Shark:4 $bytes($int($calc((%CalculateNeeded)/210)),bd)
      }
      if (%skill == Fletching) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Willow Short:4 $bytes($int($calc((%CalculateNeeded)/66.6)),bd) 15|12 Willow Long:4 $bytes($int($calc((%CalculateNeeded)/83)),bd) 15|12 Maple Short:4 $bytes($int($calc((%CalculateNeeded)/100)),bd) 15|12 Maple Long:4 $bytes($int($calc((%CalculateNeeded)/116)),bd) 15|12 Yew Short:4 $bytes($int($calc((%CalculateNeeded)/133)),bd) 15|12 Yew Long:4 $bytes($int($calc((%CalculateNeeded)/150)),bd) 15|12 Magic Short:4 $bytes($int($calc((%CalculateNeeded)/166.6)),bd) 15|12 Magic Long:4 $bytes($int($calc((%CalculateNeeded)/183)),bd)
      }
      if (%skill == Herblore) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Restore:4 $bytes($int($calc((%CalculateNeeded)/62.5)),bd) 15|12 Energy:4 $bytes($int($calc((%CalculateNeeded)/67.5)),bd) 15|12 Combat:4 $bytes($int($calc((%CalculateNeeded)/84)),bd) 15|12 Prayer:4 $bytes($int($calc((%CalculateNeeded)/87.5)),bd) 15|12 Super Attack:4 $bytes($int($calc((%CalculateNeeded)/100)),bd) 15|12 Super Strength:4 $bytes($int($calc((%CalculateNeeded)/125)),bd) 15|12 Super Defence:4 $bytes($int($calc((%CalculateNeeded)/150)),bd)
      }
      if (%skill == Crafting) {
        if ($2 >= 99) { halt }
        notice %namecommand 12Needed for4 $calc($2 + 1) $+ 15:12 Green D'Hide:4 $bytes($int($calc((%CalculateNeeded)/62)),bd) 15|12 Blue D'Hide:4 $bytes($int($calc((%CalculateNeeded)/70)),bd) 15|12 Red D'Hide:4 $bytes($int($calc((%CalculateNeeded)/78)),bd) 15|12 Black D'Hide:4 $bytes($int($calc((%CalculateNeeded)/86)),bd) 15|12 Fire Battlestaff:4 $bytes($int($calc((%CalculateNeeded)/125)),bd) 15|12 Air Battlestaff:4 $bytes($int($calc((%CalculateNeeded)/137.5)),bd) 15|12 Flax:4 $bytes($int($calc((%CalculateNeeded)/15)),bd) 15|12 D Stone:4 $bytes($int($calc((%CalculateNeeded)/137.5)),bd)
      }
    }
  }
  elseif (%style == combat) {
    var %a.mult = .32707, %s.mult = .324, %d.mult = .25, %h.mult = .25, %p.mult = .124, %r.mult = .487, %m.mult = .487
    var %a = $iif($gettok($hget(%table,attack),2,32),$v1,-), $&
      %s = $iif($gettok($hget(%table,strength),2,32),$v1,-), $&
      %d = $iif($gettok($hget(%table,defence),2,32),$v1,-), $&
      %h = $iif($gettok($hget(%table,hitpoints),2,32),$v1,-), $&
      %r = $iif($gettok($hget(%table,ranged),2,32),$v1,-), $&
      %m = $iif($gettok($hget(%table,magic),2,32),$v1,-), $&
      %p = $iif($gettok($hget(%table,prayer),2,32),$v1,-)

    var %meleecombat  = $calc(%a * %a.mult + %s * %s.mult + %d * %d.mult + %h * %h.mult + %p * %p.mult), $&
      %RangedCombat = $calc(%r * %r.mult + %p * %p.mult + %d * %d.mult + %h * %h.mult), $&
      %MagicCombat  = $calc(%m * %m.mult + %p * %p.mult + %d * %d.mult + %h * %h.mult)

    if (%MagicCombat > %RangedCombat) && (%MagicCombat > %MeleeCombat) var %cmbstyle = Magic, %Combat = %MagicCombat
    elseif (%RangedCombat > %MeleeCombat) var %cmbstyle = Ranged, %Combat = %RangedCombat
    else var %cmbstyle = Melee, %combat = %MeleeCombat

    var %cmb.temp = $abs($calc($int($calc(%combat +1)) - %combat)), $&
      %a.2lvl = $ceil($calc(%cmb.temp / %a.mult)), %s.2lvl = $ceil($calc(%cmb.temp / %s.mult)), $&
      %d.2lvl = $ceil($calc(%cmb.temp / %d.mult)), %m.2lvl = $ceil($calc(%cmb.temp / %m.mult)), $&
      %r.2lvl = $ceil($calc(%cmb.temp / %r.mult)), %p.2lvl = $ceil($calc(%cmb.temp / %p.mult))

    if (%cmbstyle == magic) var %dynamic.2lvl = $c1(Magic:) $c2(%m.2lvl)
    elseif (%cmbstyle == Ranged) var %dynamic.2lvl = $c1(Ranged:) $c2(%r.2lvl)
    else var %dynamic.2lvl = 12Attack15:4 %a.2lvl $+ 15. 12Strength15:4 %s.2lvl $+ 15.
    var %combat = $round(%combat,2), %next = $ceil(%combat)

    %display 12Name15:4 %rsn $+ 15. 12Combat15:4 %combat $+ 15. 12Combat Style15:4 %cmbstyle $+ 15.
    %display 12Attack15:4 %a $+ 15. 12Defence15:4 %d $+ 15. 12Strength15:4 %s $+ 15. 12Hits15:4 %h $+ 15. $&
      12Mage15:4 %m $+ 15. 12Range15:4 %r $+ 15. 12Pray15:4 %p $+ 15.
    %display 12Levels for15:4 %next $+ 15: %dynamic.2lvl $&
      12Defence15/12Hitpoints15:4 %d.2lvl $+ 15. 12Prayer15:4 %p.2lvl $+ 15.
  }
  cleanup %id
  /unset %stats.display.*
  /unset %stats.skill.*
  /unset %stats.style.*
  /unset %stats.rsn.*
  /unset %name
  /unset %skill2
  /unset %player
  /unset %CurrEXP
  /unset %IniEXP
  /unset %EXPNEXT
  /unset %type
  /unset %namecommand
  /unset %CalculateNeeded
}

alias -l cleanup {
  /unset %stats.display.*
  /unset %stats.skill.*
  /unset %stats.style.*
  /unset %stats.rsn.*
  /unset %name
  /unset %skill2
  /unset %player
  /unset %CurrEXP
  /unset %IniEXP
  /unset %EXPNEXT
  /unset %type
  /unset %namecommand
  /unset %CalculateNeeded
  unset $+(%,stats.*.,$1)
  sockclose $+(Stats.,$1)
  .remove $+(Stats.,$1)
}

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 xp2Next {
  var %xp = $remove($2,$chr(44)), %nextxp = $xp($calc($1 + 1))
  return $calc(%nextxp - %xp)
}

alias -l striptags { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return %x }
alias -l setskill {
  if ($1 == 0) || ($regex($1,/^(total|overall)$/Si)) return Overall
  elseif ($1 == 1) || ($regex($1,/^at(t|k|tack)$/Si)) return Attack
  elseif ($1 == 2) || ($regex($1,/^str(ength)?$/Si)) return Strength
  elseif ($1 == 3) || ($regex($1,/^def(en[cs]e)?$$/Si)) return Defence
  elseif ($1 == 4) || ($regex($1,/^range(r|d|ing)?$/Si)) return Ranged
  elseif ($1 == 5) || ($regex($1,/^Pray(er)?$$/Si)) return Prayer
  elseif ($1 == 6) || ($regex($1,/^mag(e|ic)$$/Si)) return Magic
  elseif ($1 == 7) || ($regex($1,/^(rc|runecraft)(er|ing)?$/Si)) return Runecraft
  elseif ($1 == 8) || ($regex($1,/^(construct)(ion|ing)?$/si)) return Construction
  elseif ($1 == 9) || ($regex($1,/^hp|hit(s|points?)?$/Si)) return Hitpoints
  elseif ($1 == 10) || ($regex($1,/^agil(ity)?$/Si)) return Agility
  elseif ($1 == 11) || ($regex($1,/^herb(law|lore)?$/Si)) return Herblore
  elseif ($1 == 12) || ($regex($1,/^(th(ei|ie)[fv](e|ing)?)$/Si)) return Thieving
  elseif ($1 == 13) || ($regex($1,/^craft(ing)?$/Si)) return Crafting
  elseif ($1 == 14) || ($regex($1,/^fletch(ing)?$/Si)) return Fletching
  elseif ($1 == 15) || ($regex($1,/^slay(er|ing)?$/Si)) return Slayer
  elseif ($1 == 16) || ($regex($1,/^(hunt)(er|ing)?$/si)) return Hunter
  elseif ($1 == 17) || ($regex($1,/^mine(ing)?$/Si)) return Mining
  elseif ($1 == 18) || ($regex($1,/^(smith|smelt)(ing)?$/Si)) return Smithing
  elseif ($1 == 19) || ($regex($1,/^fish(ing)?$/Si)) return Fishing
  elseif ($1 == 20) || ($regex($1,/^cook(ing)?$/Si)) return Cooking
  elseif ($1 == 21) || ($regex($1,/^(fire|fm)(make?(ing)?|ing)?$/Si)) return Firemaking
  elseif ($1 == 22) || ($regex($1,/^wc|wood(cut(ting)?)?$/Si)) return Woodcutting
  elseif ($1 == 23) || ($regex($1,/^farm(er|ing)?$/Si)) return Farming
}