All pastes #402467 Raw Edit

Something

public text v1 · immutable
·published 2007-03-19 22:34 UTC
rendered paste body
on *:TEXT:!rsbotoff*:#:{ if ($nick == Mike) {
    msg $chan 4Pest Off
set %pestscript OFF } } 

on *:TEXT:!rsboton*:#:{ if ($nick == Mike) {
    msg $chan 4Pest On
set %pestscript ON } }

on *:TEXT:!change*:#Pestunit:{ if (%pestscript == OFF) { HALT }
  if (%pestscript == ON) && ($2 isnum 1-138) && ($nick isop #aspc) || ($nick ishop #aspc) {
    msg #pestunit 12New PCW1 - !pcw to view 
    set %settime $ctime
    set %pcworld $2
set %pcsetter $nick } }

on *:TEXT:!change*:#Peststaff:{ if (%pestscript == OFF) { HALT }
  if (%pestscript == ON) && ($2 isnum 1-138) && ($nick isop #pestunit) || ($nick ishop #pestunit) {
    msg #pestunit 4New PCW1 - !pcw to view 
    set %settime $ctime
    set %pcworld $2
set %pcsetter $nick } }

on *:TEXT:!world*:#pestunit:{ if (%pestscript == OFF) { HALT }
  elseif (%pestscript == ON) {
notice $nick 7World:2 %pcworld 7 World for:2 $duration($calc($ctime - %settime)) 14World set by:2 %pcsetter 4scripted by Mike } }

on *:TEXT:!pcw*:#Pestunit:{ if (%pestscript == OFF) { HALT }
  elseif (%pestscript == ON) {
notice $nick 7World:2 %pcworld 7 World for:2 $duration($calc($ctime - %settime)) 14World set by:2 %pcsetter  } }

on *:TEXT:!suggest*:#pestunit:{ if ($2 !isnum 2-138) { halt }
  elseif (%suggestedw) { notice $nick There is already a suggested world }
  elseif ($2 isnum 2-138) && (!%suggestedw) {
    msg #Peststaff 4 $nick has suggested world: $2  Type !checking !accept <worldhere> or !decline <worldhere> 
    notice Mike $nick suggested world: $2 
    set %suggestedw $2
    set %suggester $nick
  }
}
on *:TEXT:!decline*:#Peststaff:{ if ($2 !isnum 2-138) { halt }
  elseif (!$2) { 
  msg #Peststaff Use !decline <worldhere> }  
  elseif ($2 isnum 2-138) && ($nick isop #pestunit) || ($nick ishop #pestunit) {
    msg #pestunit 4World %suggestedw was DECLINED..   
    unset %suggestedw
    unset %suggester
    unset %checker
  }
}
on *:TEXT:!accept*:#Peststaff:{ if ($2 !isnum 2-138) { halt }
  if (!$2) {
  msg #Peststaff Use accept <worldhere> }
  if ($2 isnum 2-138) && ($nick isop #pestunit) || ($nick ishop #pestunit) {
    msg #pestunit World %suggestedw was suggested by %suggester . It has been accepted 
    msg #pestunit 4New PCW1 - !pcw to view 
    unset %suggestedw
    unset %suggester
    unset %checker
    set %settime $ctime
    set %pcworld $2
    set %pcsetter $nick
    msg #peststaff 4World changed to %pcworld
  }
}
on *:TEXT:!checking*:#peststaff:{ if ($nick isop #pestunit) || ($nick ishop #pestunit) && (%checker) { 
  msg $chan already being checked by %checker }
  if ($nick isop #aspc) || ($nick ishop #pestunit) && (!%checker) 
  msg #pestunit 4Suggested1 world is being checked by $nick
  msg #peststaff This command must be followed by !accept or !decline
  set %checker
}

on *:TEXT:!setpcw*:#Peststaff:{ if (%pestscript == OFF) { HALT }
  elseif (%pestscript == ON) && ($nick isop #pestunit) || ($nick ishop #pestunit) { 
  notice $nick use !change please }
}
on *:TEXT:!new*:#Peststaff:{ if ($nick isop #pestunit) || ($nick ishop #pestunit) {
    msg #pestunit 1Fed up with the 4world?1 Suggest a new world by typing !suggest <worldhere>
  }
}
on *:TEXT:!reset*:#Peststaff:{ if ($nick isop #pestunit) || ($nick ishop #pestunit) {
    msg #pestunit Suggestion script reset
    unset %suggestedw
    unset %suggester
    unset %checker
  }
}




alias c1 { return $+($chr(3),12,$1-) } 
alias c2 { return $+($chr(3),03,$1-) } 
alias c3 { return $+($chr(3),04,$1-) }
alias c4 { return $+($chr(3),07,$1-) } 

on $*:text:/^[!@]compare/Si:#: { 
  if (!$skill($2) || !$4 || $5) { 
    notice $nick Syntax !compare <skill> <user1> <user2> 
    { halt }
  }
  if ($sock(rs.compare)) .sockclose rs.compare
  set %rs.compare.way $iif($left($1,1) == @,msg $chan,notice $nick)

  set %rs.compare.skill $skill($2)
  set %rs.compare.user1 $3
  set %rs.compare.user2 $4
  sockopen rs.compare www.o-ss.net 80
}

on *:SOCKOPEN:rs.compare: {
  sockwrite -nt $sockname GET /parsers/compare.php?user1= $+ %rs.compare.user1 $+ &user2= $+ %rs.compare.user2 $+ &skill= $+ %rs.compare.skill HTTP/1.1
  sockwrite -nt $sockname Host: www.o-ss.net
  sockwrite -nt $sockname $crlf
}

on *:SOCKREAD:rs.compare: {
  if ($sockerr) { halt }
  else {
    var %rs.compare.reader
    sockread %rs.compare.reader
    tokenize 32 %rs.compare.reader
    if (is not in the hi-scores for isin %rs.compare.reader) {
      %rs.compare.way $c2($1) $c1(is not in the RuneScape hi-scores for) $c3(%rs.compare.skill $+ .)
      unset %rs.compare
      sockclose rs.compare
      { halt }
    }
    if (are not in the hi-scores for isin %rs.compare.reader) {
      %rs.compare.way $c2($1) $c1(and) $c2($3) $c1(are not in the RuneScape hi-scores for) $c3(%rs.compare.skill $+ .)
      unset %rs.compare.*
      sockclose rs.compare
      { halt }
    }
    if (*END* iswm %rs.compare.reader) {
      set %rs.compare.user1.lvl $gettok(%rs.compare.reader,1,32)
      set %rs.compare.user2.lvl $gettok(%rs.compare.reader,2,32)
      set %rs.compare.lvldiff $gettok(%rs.compare.reader,4,32)
      set %rs.compare.xpdiff $gettok(%rs.compare.reader,5,32)
      if (%rs.compare.user1.lvl > %rs.compare.user2.lvl) {
        %rs.compare.way $c2(%rs.compare.user1) $c1(is level) $c4(%rs.compare.user1.lvl) $c3(%rs.compare.skill) $c1(and) $c2(%rs.compare.user2) $c1(is level) $c4(%rs.compare.user2.lvl) $c3(%rs.compare.skill $+ .)
        %rs.compare.way $c2(%rs.compare.user1) $c1(has) $c4(%rs.compare.lvldiff) $c1(more level(s) than) $c2(%rs.compare.user2) $c1(and the XP difference is:) $c4(%rs.compare.xpdiff)
        unset %rs.compare.*
        sockclose rs.compare
        halt
      }
      if (%rs.compare.user1.lvl < %rs.compare.user2.lvl) {
        %rs.compare.way $c2(%rs.compare.user1) $c1(is level) $c4(%rs.compare.user1.lvl) $c3(%rs.compare.skill) $c1(and) $c2(%rs.compare.user2) $c1(is level) $c4(%rs.compare.user2.lvl) $c3(%rs.compare.skill $+ .)
        %rs.compare.way $c2(%rs.compare.user2) $c1(has) $c4(%rs.compare.lvldiff) $c1(more level(s) than) $c2(%rs.compare.user1) $c1(and the XP difference is:) $c4(%rs.compare.xpdiff)
        unset %rs.compare.*
        sockclose rs.compare
        halt
      }
      if (%rs.compare.user1.lvl == %rs.compare.user2.lvl) {
        %rs.compare.way $c2(%rs.compare.user1) $c1(and) $c2(%rs.compare.user2) $c1(are the same level in) $c3(%rs.compare.skill) $c1(with a level of) $c4(%rs.compare.user1.lvl)
        unset %rs.compare.*
        sockclose rs.compare
        halt
      }
    }
  }
}
alias -l skill { 
  if ($regex($1,/^c(o)?mb(at)?$/Si)) return Combat 
  elseif ($regex($1,/^((skill)?total|overall)$/Si)) return Overall 
  elseif ($regex($1,/^at(t|k|tack)$/Si)) return Attack 
  elseif ($regex($1,/^def(en[cs]e)?$/Si)) return Defence 
  elseif ($regex($1,/^str(ength)?$/Si)) return Strength 
  elseif ($regex($1,/^(hp|hit(s|points)?)$/Si)) return Hitpoints 
  elseif ($regex($1,/^rang(e|er|ed|ing)$/Si)) return Ranged 
  elseif ($regex($1,/^Pray(er)?$/Si)) return Prayer 
  elseif ($regex($1,/^mag(e|ic)$/Si)) return Magic 
  elseif ($regex($1,/^cook(ing)?$/Si)) return Cooking 
  elseif ($regex($1,/^(wc(ing)?|woodcut(ting)?)$/Si)) return Woodcutting 
  elseif ($regex($1,/^fletch(ing)?$/Si)) return Fletching 
  elseif ($regex($1,/^fish(ing)?$/Si)) return Fishing 
  elseif ($regex($1,/^(fire|fm)(make?(ing)?|ing)?$/Si)) return Firemaking 
  elseif ($regex($1,/^craft(ing)?$/Si)) return Crafting 
  elseif ($regex($1,/^(smith|smelt)(ing)?$/Si)) return Smithing 
  elseif ($regex($1,/^min(e|e?ing)$/Si)) return Mining 
  elseif ($regex($1,/^herb(law|lore)?$/Si)) return Herblore 
  elseif ($regex($1,/^agil(ity)?$/Si)) return Agility 
  elseif ($regex($1,/^(th(ei|ie)[fv](e|ing)?)$/Si)) return Thieving 
  elseif ($regex($1,/^slay(er|ing)?$/Si)) return Slayer 
  elseif ($regex($1,/^farm(er|ing)?$/Si)) return Farming 
  elseif ($regex($1,/^(rc|runecraft)(er|ing)?$/Si)) return Runecraft 
  elseif ($regex($1,/^hunt(er|ing)?$/Si)) return Hunter
  elseif ($regex($1,/^con(struct)?(ion|ing)?$/si)) return Construction  
}




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

on *:TEXT:*:#: {
  if ($1 == shit) || ($regex($1,/(=|[^<]*>|<[^>]*>|<[^>]|[0-9])/Si)) || ($3) { halt }
  inc %ID 

  ;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) $+ 12:
        $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 == 8) || ($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 == 18) || ($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
}