All pastes #814112 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-13 00:21 UTC
rendered paste body
alias -l htmlfree {
  var %y, %x = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%y), %y = $remove(%y,&nbsp;)
  return %y
}
alias stats {
  if ($sock(highscore)) {
    sockclose highscore 
  }
  else {
    set %user $iif($1,$replace($1-,$chr(32),-),$me)
    sockopen highscore hiscore.runescape.com 80
    sockmark highscore echo @stats
    $iif(!$window(@stats),window -e @stats)
  } 
}
on *:sockopen:highscore: { 
  sockwrite -nt $sockname GET /lang/en/aff/runescape/hiscorepersonal.ws?user1= $+ %user HTTP/1.1 
  sockwrite -nt $sockname Host: hiscore.runescape.com $+ $crlf 
  sockwrite -nt $sockname $crlf
} 
on *:sockread:highscore: {
  if (!$sockerr) {
    var %stats
    sockread %stats
    if ($skill(%stats)) {
      $sock($sockname).mark $htmlfree(%stats)
    }
  }
}
on *:sockclose:highscore: {
  sockclose $sockname
}
alias -l skill {
  if ($regex($1,/^(attack)/Si)) return %stats
}