All pastes #147263 Raw Edit

scripty thingy

public text v1 · immutable
#147263 ·published 2006-08-24 08:07 UTC
rendered paste body
on *:text:*:#:{ 
  if ($1 == !stats) || ($1 == @stats) { 
    set %stats.chan $chan | set %stats.nick $nick | set %stats.trigger $1 | set %stats.rsn $replace($2-,$chr(32),+) | set %stats.msg $iif($left($1,1) == @,msg $chan,notice $nick) 
    if ($sock(stats).status != $null) { notice $nick Stats Script is in use. Try again.... now! | unset %stats.* | halt } 
    if ($len(%stats.name) > 12) { notice $nick Error: name too long. | unset %stats.* | halt } 
    sockopen stats vulcan.runeweb.net 80 
    ;msg color 1; 
    set %stats.color1 $chr(3) $+ 14 
    ;msg color 2; 
    set %stats.color2 $chr(3) $+ 04 
  } 
} 
on *:sockopen:stats:{ 
  sockwrite -nt $sockname GET /v3/publicstats.genie?rsname= $+ %stats.rsn HTTP/1.0 
  sockwrite -nt $sockname User-Agent: Armadyl and Genie FTW 
  sockwrite -nt $sockname Host: vulcan.runeweb.net $+ $crlf $+ $crlf 
} 
on *:sockread:stats:{ 
  if ($sockerr > 0) { .notice %stats.nick Error: Try again later. | unset %stats.* | halt } 
  :nextread 
  var %stats.read | sockread %stats.read 
  if (<b>Personal isin %stats.read) { set %stats.name $remove(%stats.read,Personal $+ $chr(32),Scores $+ $chr(32),For $+ $chr(32),<b>,</b>) | set %stats.text $remove(%stats.read,<b>,</b>) | set %stats.text $left(%stats.text,- $+ $len(%stats.name)) } 
  if ($sockbr == 0) { return } 
  if (%stats.read == &nbsp;) { set %stats.counter 5 } 
  if (%stats.read == $null) { goto nextread } 
  else if (%stats.counter != $null) { 
    if (%stats.counter == 4) { set %currentskill %stats.read } 
    else if (%stats.counter == 3) { set %stats. $+ %currentskill $+ . $+ rank %stats.read } 
    else if (%stats.counter == 2) { set %stats. $+ %currentskill $+ . $+ level %stats.read } 
    else if (%stats.counter == 1) { set %stats. $+ %currentskill $+ . $+ exp %stats.read } 
    dec %stats.counter 1 
  } 
  goto nextread 
} 
on *:sockclose:stats:{ show_stats | %stats.msg %stats.color1 $+ %stats.text $+ %stats.color2 %stats.name 
  if (%stats.printline1 != $null) { %stats.msg %stats.printline1 } 
  unset %stats.* 
} 
alias -l show_stats { 
  set %stats.count 0 
  while %stats.count < $var(%stats.*.level,0) { 
    inc %stats.count 1 
    %stats.printline1 = %stats.printline1 %stats.color1 $+ $left($right($var(%stats.*.level,%stats.count),-7),-6) $+ : $+ %stats.color2 $bytes($eval($var(%stats.*.level,%stats.count),2),b) 
  } 
  if (%stats.printline1 == $null) { set %stats.text This Person does not appear on hiscores. } 
}