All pastes #173933 Raw Edit

Jordyboy

public text v1 · immutable
·published 2006-09-17 11:52 UTC
rendered paste body
on $*:text:/^[!@.]stats* /Si:*:{ 
  if ($sock(stats)) {
    sockclose stats
  }
  set %nick $nick
  set %rsn $2
  set %display $iif($left($1,1) == @,msg $chan,.notice $nick)
  sockopen stats slushpuppy.silverinterlocution.org 80
}

on *:SOCKOPEN:stats:{
  sockwrite -nt $sockname GET /rsstats.php?stats= $+ %rsn HTTP/1.1
  sockwrite -nt $sockname Host: slushpuppy.silverinterlocution.org $+ $crlf $+ $crlf
}
on *:SOCKREAD:stats:{
  if ($sockerr) { %display Socket error | unset %display | unset %rsn | sockclose $sockname | halt }
  else {
    var %read 
    sockread -f %read
    if (*does not feature in the hiscores.* iswm %read) { %display $chr(3) $+ 7[ $chr(3) $+ 12- $chr(3) $+ 3 %rsn does not apear in the highscores of runescape. $chr(3) $+ 12- $chr(3) $+ 7] }
    if (*|* iswm %read) {
      /tokenize 32 %read
      %display $htmlfree($c3(stats for)$+   $+ $c4(%rsn) $+  $+ $c3(:) $c1($2) $c2($3) $c1($4) $c2($5) $c1($6) $c2($7) $c1($8) $c2($9) $c2($10) $c1($11) $c2($12) $c1($13) $c2($14) $c1($15) $c2($16) $c1($17) $c2($18))
      if ($20- != $null) %display $htmlfree($c1($20) $c2($21) $c1($22) $c2($23) $c1($24) $c2($25) $c1($26) $c2($27) $c1($28) $c2($29) $c1($30) $c2($31) $c1($32) $c2($33) $c1($34) $c2($35) $c1($36) $c2($37) $c1($38) $c2($39) $c1($40) $c2($41) $c1($42) $c2($43) $c1($44) $c2($45) $c1($46) $c2($47) $c1($48) $c2($49) $c1($50) $c2($51) $c1($52) $c2($53) $c1($54) $c2($55) $c1($56) $c2($57) $c1($58) $c2($59) $c1($60) $c2($61) $c1($62) $c2($63) $c1($64) $c2($65) $c1($66) $c2($67) $c1($68) $c2($69))
    }
  }
}

alias htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) | return %x } 

alias -l c1 { return $+(7 $1-,) }
alias -l c2 { return $+(12 $1-,) }
alias -l c3 { return $+(7 $1-,) }
alias -l c4 { return $+(12 $1-,) }