This stats snippet gets RuneScape statistics from a parser that I made located at http://parsers.o-ss.net/oneline/stats.php
The syntax to use the snippet is easy to use:
!(rs)stats
@(rs)stats
.(rs)stats
This is a remote script, and goes into your remotes section (alt+r)
on $*:TEXT:/^[!@.](rs)?stats */Si:#: {
if (!$2) { .notice $nick Enter an RSN to look up! | halt }
if ($len($2) > 12) { .notice $nick RSN too long! | halt }
var %x = 1
while ($sock(rsstats. $+ %x)) inc %x
.set %target. $+ %x $iif($left($1,1) == @,.msg $chan,.notice $nick)
.set %rsn. $+ %x $replace($2-,$chr(32),+)
sockopen rsstats. $+ %x parsers.o-ss.net 80
}
on *:sockopen:rsstats.*: {
var %x = $right($sockname,1)
if ($sockerr > 0) { %target. [ $+ [ %x ] ] Socket Error: $sockerr | cleanup $sockname | halt }
sockwrite -nt $sockname GET /oneline/stats.php?user= $+ %rsn. [ $+ [ %x ] ] $+ &showcmb=1&showcollons=1 HTTP/1.1
sockwrite -nt $sockname Host: parsers.o-ss.net
sockwrite -nt $sockname $crlf
}
on *:sockread:rsstats.*: {
var %x = $right($sockname,1)
if ($sockerr > 0) { %target. [ $+ [ %x ] ] Socket Error: $sockerr | cleanup $sockname | halt }
var %read | sockread %read
if (: 0 isin %read) { %target. [ $+ [ %x ] ] %rsn. [ $+ [ %x ] ] is not in the Hi-Scores. You have to be in the top million of any skill with a skill level of at least 30. | cleanup $sockname }
if (combat isin %read) { %target. [ $+ [ %x ] ] $remove(%read,END) }
if (overall isin %read) { %target. [ $+ [ %x ] ] $remove(%read,END,|) | cleanup $sockname }
}
alias cleanup {
unset %target. $+ $right($1,1)
unset %rsn. $+ $right($1,1)
sockclose $1
}
heres an example of how its build up. http://hiscore.runescape.com/index_lite.ws?player=Zezima
You can strip that by using something like this
on *:SOCKREAD:Stats*: {
if (!$sockerr) {
var %statsg
sockread %statsg
tokenize 32 %statsg
if (404 isin $1-) { endsc $sockname $gettok($hget(Stats,$remove($sockname,stats)),2,124) $big($gettok($hget(Stats,$remove($sockname,stats)),1,124)) is either not ranked at all or doesnt exsist. 5Maby your defname is not correct. Check how to change it by typing 6!helpdef }
if ($gettok(%statsg,2,44) isnum) {
set %stats %stats $gettok( $logo(stats) 14of $big($gettok($hget(Stats,$remove($sockname,stats)),1,124)) $c2(---) 14Overall:6|14- 14Attack:6|14- 14Defence:6|14- 14Strength:6|14- 14Constitution:6|14- 14Ranged:6|14- 14Prayer:6|14- 14Magic:6|14- 14Cooking:6|14- 14Woodcutting:6|14- 14Fletching:6|14- 14Fishing:6|14- 14Firemaking:6|14- 14Crafting:6|14- 14Smithing:6|14- 14Mining:6|14- 14Herblore:6|14- 14Agility:6|14- 14Thieving:6|14- 14Slayer:6|14- 14Farming:6|14- 14Runecrafting:6|14- 14Hunter:6|14- 14Construction:6|14- 14Summoning:6|14- 14Dungeoneering:6|14- 14Duel Tournament:6,%skill,124) $gettok(%statsg,2,44)
if (!$gettok(Overall|Attack|Defence|Strength|Constitution|Ranged|Prayer|Magic|Cooking|Woodcutting|Fletching|Fishing|Firemaking|Crafting|Smithing|Mining|Herblore|Agility|Thieving|Slayer|Farming|Runecrafting|Hunter|Construction|Summoning|Dungeoneering,%skill,124)) endsc $sockname $gettok($hget(Stats,$remove($sockname,stats)),2,124) %stats
inc %skill
}
}
}
on $:TEXT:/^!@.?stats /Si:#: {
if (!$2) { .notice $nick Enter an RSN to look up! | halt }
if ($len($2) > 12) { .notice $nick RSN too long! | halt }
var %x = 1
while ($sock(rsstats. $+ %x)) inc %x
.set %target. $+ %x $iif($left($1,1) == @,.msg $chan,.notice $nick)
.set %rsn. $+ %x $replace($2-,$chr(32),+)
sockopen rsstats. $+ %x hiscore.runescape.com 80
}
on :sockopen:rsstats.: {
var %x = $right($sockname,1)
if ($sockerr > 0) { %target. [ $+ [ %x ] ] Socket Error: $sockerr | cleanup $sockname | halt }
sockwrite -nt $sockname GET /lookup.php?type=stats&user= $+ $3 ] HTTP/1.1
sockwrite -nt $sockname Host: hiscore.runescape.com 80
sockwrite -nt $sockname $crlf
}
on :sockread:rsstats.: {
var %x = $right($sockname,1)
if ($sockerr > 0) { %target. [ $+ [ %x ] ] Socket Error: $sockerr | cleanup $sockname | halt }
var %read | sockread %read
if (: 0 isin %read) { %target. [ $+ [ %x ] ] %rsn. [ $+ [ %x ] ] is not in the Hi-Scores. You have to be in the top million of any skill with a skill level of at least 30. | cleanup $sockname }
if (combat isin %read) { %target. [ $+ [ %x ] ] $remove(%read,END) }
if (overall isin %read) { %target. [ $+ [ %x ] ] $remove(%read,END,|) | cleanup $sockname }
}
alias cleanup {
unset %target. $+ $right($1,1)
unset %rsn. $+ $right($1,1)
sockclose $1
}