All pastes #282343 Raw Edit

Anonymous

public text v1 · immutable
#282343 ·published 2006-12-17 14:28 UTC
rendered paste body
 ,---------------------------------.
; | RSSTATS - version 4 - by spling |
; |---------------------------------|
; | Contact me:                     |
; |         Email: spling@gmail.com |
; |         AIM: spling44           |
; |---------------------------------*-----------------------------.
; | Usage: /rs [username..]                                       |
; | You don't need to replace spaces, that is done automatically. |
; | If you don't  specify a name off the bat, the script will pop |
; | up an input dialog and ask you  for  a  username  to  search. |
; | the colors are fully customizable, simply change the numbers; |
; | do not include the color character.                           |
; '---------------------------------------------------------------`

alias -l setvariables {
  ;############################################
  ;# CHANGE THE FOLLOWING TO CUSTOMIZE COLORS #
  ;############################################
  ; To change the colors, simply change the number after "set %color.* ".
  ; Red = 4, Orange = 7, Black = 1, White = 0 and so forth.

  ;  Skill name color:
  set %color.skillname

  ;  Rank color:
  set %color.rank 9

  ;  Level color:
  set %color.level 15

  ;  Experience color:
  set %color.exp 4

  ;  Name color:
  set %color.name 9

  ;  Default color:
  set %color.default $color(notice)

  ;#####################
  ;# DO NOT EDIT BELOW #
  ;#####################
  set %doline 1
  set %color.skillname $remove(%color.skillname,) | set %color.rank $remove(%color.rank,) | set %color.level $remove(%color.level,) | set %color.exp $remove(%color.exp,) | set %color.name $remove(%color.name,) | set %color.default $remove(%color.default,)
}
alias -l striptags { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return %x }
on *:TEXT:!stats *:#:{
  if (!$) { set %searchname $$?="User to search?" }
  else { set %searchname $2- }
set %user $nick
  set %searchname $replace(%searchname,$chr(32),$chr(43))
  inc %rsstatssockval 1
  sockopen $+(rsstats,%rsstatssockval) hiscore.runescape.com 80
}
on *:sockopen:rsstats* {
  .timertimeout $+ $sockname 1 10 timeout $sockname
  unset %line
  sockwrite -n $sockname GET /aff/runescape/hiscorepersonal.cgi?username= $+ %searchname HTTP/1.0
  sockwrite -n $sockname Host: hiscore.runescape.com $+ $crlf $+ $crlf
  setvariables
  notice %user %color.default -a Looking up high score statistics for $+ %color.name $replace($upper(%searchname),$chr(43),$chr(32)) $+ ...
}
on *:sockread:rsstats* {
  if ($sockerr) { notice %user %color.default -a Error. $sockerr | halt }
  else {
    var %temptext | sockread %temptext
    if (does not currently appear isin %temptext) {
      notice %user %color.default -a  $+ %color.name $replace(%searchname,$chr(43),$chr(32)) is not in the high scores!
      .timertimeout $+ $sockname off
      sockclose $sockname
      halt
    }
    if (RuneScape isin %temptext) { halt }
    if (*class=c>* iswm %temptext) {
      if (%doline) {
        unset %doline
        notice %user %color.default -a      SKILL    |   RANK  | LEVEL | EXPERIENCE 
        notice %user %color.default -a --------------+---------+-------+------------
      }
      set %skillline %skillline $+(,%color.skillname, ,$str( ,$calc(12 - $len($striptags(%temptext)))),$striptags(%temptext), ,,$chr(124),,%color.rank))
    }
    if (<td align="right">*</td><td align="right"> iswm %temptext) { set %skillline %skillline $+($str( ,$calc(7 - $len($striptags(%temptext)))),$striptags(%temptext), ,,$chr(124),,%color.level) | set %line 1 | halt }
    if (%line == 1) && ($striptags(%temptext)) { unset %line | set %skillline %skillline $+($str( ,$calc(5 - $len($striptags(%temptext)))),$striptags(%temptext), ,,$chr(124),,%color.exp) }
    if (%temptext == </td><td align="right">) { set %line 2 }
    if (%line == 2) && ($striptags(%temptext)) { set %skillline %skillline $+($striptags(%temptext), ,) | unset %line | finishline }
  }
}
on *:sockclose:rsstats* { .timertimeout $+ $sockname off }
ALIAS -l finishline { notice %user %color.default -a %skillline | unset %line | unset %skillline }
alias -l timeout { notice %user %color.default -a The socket timed out. Please try again. | sockclose $1 }