Old script..new site layout. - 30/12/02 03:25 AM
Below is a script someone from the old boards made for me. And, as he said, if the site ever changed its layout, the script would most likely fail. So, I was wondering if anyone would help me fix it. Here's the code:
Usage: /high.score [username]
It connects to www.runescape.com and looks up the player's highscores if they exist. You dont have to specifiy a username. If not, it just displays the top 10. Anyway, I dont really know much abour $regex, $regusb, or sockets (used this way) to fix it by myself, so, could someone help me here? Thanks.
Code:
alias high.score { sockclose rune sockopen rune www.runescape.com 80 if ($1) { .sockmark rune /hiscoreuser.cgi?username= $+ $replace($1-,$chr(32),_) } else { .sockmark rune /hiscore.html } } on *:sockopen:rune:{ if ($sockerr) { echo $color(info) -s *** Socket Error (on open) \ $sockname - $sock($sockname).ip return } sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1 sockwrite -n $sockname Accept: */* sockwrite -n $sockname Host: www.runescape.com sockwrite -n $sockname $crlf } on *:sockread:rune:{ if ($sockerr) { echo $color(info) -s *** Socket Error (on read) \ $sockname - $sock($sockname).ip return } var %tmp,%ex = ^(<table>|</td>),%un = $gettok($sock($sockname).mark,-1,61) sockread %tmp if (<font size=3> isin %tmp) { tokenize 62 %tmp echo -s $remove($3,</b) echo -s Rank Name Level XP } if (<b>Name</b> isin %tmp) { set %rank 0 } if (<b>Level</b> isin %tmp) { set %rank 0 } if (<b>XP</b> isin %tmp) { set %rank 0 } if (<b>Rank</b> isin %tmp) { set %rank 0 } if (You do not appear in the top isin %tmp) { echo -s $remove(%tmp,<br>) echo -s - } if (This user does not appear isin %tmp) { echo -s %tmp } if ((%rank isnum 0-11) && ($regex(%tmp,<br>$)) && (!$regex(%tmp,%ex))) { inc %rank set $+(%,rune.,%rank) $($+(%,rune.,%rank),2) $remove(%tmp,<br>) } if (</td></tr></table> isin %tmp) { if ($var(%rune.*,0)) { var %n = 1 while (%n <= 11) { if ($($+(%,rune.,%n),2)) { echo -s $iif(%un == $gettok($($+(%,rune.,%n),2),2,32),) $+ $($+(%,rune.,%n),2) } inc %n } echo -s - } unset %rune.* } if (</html> isin %tmp) { unset %rune.* %rank } }
Usage: /high.score [username]
It connects to www.runescape.com and looks up the player's highscores if they exist. You dont have to specifiy a username. If not, it just displays the top 10. Anyway, I dont really know much abour $regex, $regusb, or sockets (used this way) to fix it by myself, so, could someone help me here? Thanks.