All pastes #476258 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-07 23:23 UTC
rendered paste body
alias cmb {
  if ($1 == -s) {
    if ($regex($2,/-(e|r|l)/Si)) {
      if ($len($3) <= 12) {
        set %cmbn $replace($3-,$chr(32),$chr(95))
        set %cmbw msg $active
        set %cmbstyle $2
        sockopen cmb o-ss.net 80
      }
      else echo -a Error: Names must be less than or equal to 12 Characters. $+($chr(40),7,$3, Is7 $len($3),/,$chr(3),07,$chr(49),$chr(50) Characters,$chr(41))
    }
    else echo -a Error: -e (Exp) -r (Rank) -l (Level)
  }
  else {
    if ($regex($1,/-(e|r|l)/Si)) {
      if ($len($2-) <= 12) {
        set %cmbw echo -a
        set %cmbn $replace($2-,$chr(32),$chr(95))
        set %cmbstyle $1
        sockopen cmb o-ss.net 80
      }
      else echo -a Error: Names must be less than or equal to 12 Characters. $+($chr(40),7,$replace($2-,$chr(32),_), Is7 $len($2-),/,$chr(3),07,$chr(49),$chr(50) Characters,$chr(41))
    }
    else echo -a Error: -e (Exp) -r (Rank) -l (Level)
  }
}
on *:sockopen:cmb:{
  sockwrite -nt $sockname GET /parsers/stats.php?user= $+ %cmbn HTTP/1.1
  sockwrite -nt $sockname Host: o-ss.net
  sockwrite -nt $sockname $crlf
}
on *:sockread:cmb:{
  if ($sockerr) {
    %cmbw Error: $sockerr
  }
  else {
    var %ee
    sockread %ee
    if (*Attack* iswm %ee) {
      tokenize 32 %ee
      set %cmbvar Attack:7 $iif(%cmbstyle == -l && $2 != not,$ccd($3)) $iif(%cmbstyle == -e && $2 != not,$ccd($4)) $iif(%cmbstyle == -r && $2 != not,$ccd($2)) $iif($2 == not,1)
      set %cmbcalc $iif($2 != not,$3,1)
    }
    if (*Defence* iswm %ee) {
      tokenize 32 %ee
      set %cmbvar %cmbvar $chr(124) Defence:7 $iif(%cmbstyle == -l && $2 != not,$ccd($3)) $iif(%cmbstyle == -e && $2 != not,$ccd($4)) $iif(%cmbstyle == -r && $2 != not,$ccd($2)) $iif(%cmbstyle == -r && $2 == not,Not Ranked) $iif(%cmbstyle == -e && $2 == not,Not Ranked)
      set %cmbcalc %cmbcalc $iif($2 != not,$3,1)
    }
    if (*Strength* iswm %ee) {
      tokenize 32 %ee
      set %cmbvar %cmbvar $chr(124) Strength:7 $iif(%cmbstyle == -l && $2 != not,$ccd($3)) $iif(%cmbstyle == -e && $2 != not,$ccd($4)) $iif(%cmbstyle == -r && $2 != not,$ccd($2)) $iif($2 == not,1)
      set %cmbcalc %cmbcalc $iif($2 != not,$3,1)
    }
    if (*Hitpoints* iswm %ee) {
      tokenize 32 %ee
      set %cmbvar %cmbvar $chr(124) HitPoints:7 $iif(%cmbstyle == -l && $2 != not,$ccd($3)) $iif(%cmbstyle == -e && $2 != not,$ccd($4)) $iif(%cmbstyle == -r && $2 != not,$ccd($2)) $iif($2 == not,1) 
      set %cmbcalc %cmbcalc $iif($2 != not,$3,1)
    }
    if (*Ranged* iswm %ee) {
      tokenize 32 %ee
      set %cmbvar %cmbvar $chr(124) Range:7 $iif(%cmbstyle == -l && $2 != not,$ccd($3)) $iif(%cmbstyle == -e && $2 != not,$ccd($4)) $iif(%cmbstyle == -r && $2 != not,$ccd($2)) $iif($2 == not,1)
      set %cmbcalc %cmbcalc $iif($2 != not,$3,1) 
    }
    if (*Prayer* iswm %ee) {
      tokenize 32 %ee
      set %cmbvar %cmbvar $chr(124) Prayer:7 $iif(%cmbstyle == -l && $2 != not,$ccd($3)) $iif(%cmbstyle == -e && $2 != not,$ccd($4)) $iif(%cmbstyle == -r && $2 != not,$ccd($2)) $iif($2 == not,1) 
      set %cmbcalc %cmbcalc $iif($2 != not,$3,1)
    }
    if (*Magic* iswm %ee) {
      tokenize 32 %ee
      set %cmbvar %cmbvar $chr(124) Magic:7 $iif(%cmbstyle == -l && $2 != not,$ccd($3)) $iif(%cmbstyle == -e && $2 != not,$ccd($4)) $iif(%cmbstyle == -r && $2 != not,$ccd($2)) $iif($2 == not,1)
      set %cmbcalc %cmbcalc $iif($2 != not,$3,1)
      sockclose $sockname
      %cmbw $+([,7CMB,][,Style:7 $iif(%cmbstyle == -l,Level) $iif(%cmbstyle == -e,Exp) $iif(%cmbstyle == -r,Rank),,][Nick:7 %cmbn,,][,Level:7 $cmbcalc(%cmbcalc),,:) %cmbvar
      unset %cmbn
      unset %cmbw
      unset %cmbvar
      unset %cmbstyle
    }
    elseif (*Overall * does not feature* iswm %ee) {
      %cmbw $+([7CMB][7,%cmbn,,]) Does not appear in highscores for Combats
      sockclose $sockname
      unset %cmbn
      unset %cmbw
      unset %cmbvar
      unset %cmbstyle
    }
  }
}
alias ccd { return $+($1-,$chr(3)) }
alias cmbcalc { 
  tokenize 32 $1- 
  var %rsc1 = $calc((($1 * 130) + ($3 * 130)) / 400) 
  var %rsc2 = $calc($iif($and($5,1) == 0,$calc($5 * 195),$calc((($5 - 1) + ($5 * 2)) * 65)) / 400) 
  var %rsc3 = $calc($iif($and($7,1) == 0,$calc($7 * 195),$calc((($7 - 1) + ($7 * 2)) * 65)) / 400) 
  if ((%rsc1 >= %rsc2) && (%rsc1 >= %rsc3)) return $calc(%rsc1 + ((($2 * 100) + ($4 * 100) + ($iif($and($6,1) == 0,$6,$calc($6 - 1)) * 50)) / 400)) $+ ][7Melee]
  elseif ((%rsc2 >= %rsc3) && (%rsc2 >= %rsc1)) return $calc(%rsc2 + ((($2 * 100) + ($4 * 100) + $iif($and($6,1) == 0,$6,$calc($6 - 1)) * 50) / 400)) $+ ][7Ranged]
  elseif ((%rsc3 >= %rsc1) && (%rsc3 >= %rsc2)) return $calc(%rsc3 + ((($2 * 100) + ($4 * 100) + $iif($and($6,1) == 0,$6,$calc($6 - 1)) * 50) / 400)) $+ ][7Magic]
}