rendered paste bodyalias world {
if ($1 !isnum 1-132) {
echo Invalid world.
}
else {
set %world $1
sockopen worlds www.runescape.com 80
}
}
on *:sockopen:Worlds:{
sockwrite -nt $sockname GET /lang/en/aff/runescape/serverlist.ws
sockwrite -nt $sockname Host: www.runescape.com $+ $crlf $+ $crlf
}
on *:sockread:Worlds:{
if ($sockerr) {
echo Socket error.
unset %world
}
else {
var %read
while (1) {
sockread %read
if (!$sockbr) {
break
}
else {
write rsworlds.txt $nohtml(%read)
}
}
}
if ($read(rsworlds.txt, w, World %world)) {
echo -a $parse(%world)
remove rsworlds.txt
unset %world
}
}
alias nohtml {
var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x)
return $remove(%x, )
}
alias -l parse {
var %info = World: $1 $chr(124)
var %info = %info Players: $remove($read(rsworlds.txt,$eval($calc($readn + 1),2)),players) $chr(124)
var %info = %info Location: $read(rsworlds.txt,$eval($calc($readn + 1),2)) $chr(124)
var %info = %info Type: $read(rsworlds.txt,$eval($calc($readn + 1),2))
return %info
}