on *:SOCKOPEN:Stats: { if ($sockerr) { var %Stats_error = $input(An error occured when connecting to the hiscore list.,wo,Stats Lookup Error) return } .unset %RSSsskill .sockwrite -n Stats GET /lang/en/aff/runescape/hiscorepersonal.ws?user1= $+ %RSstatsnick HTTP/1.1 .sockwrite -n Stats Host: hiscore.runescape.com $+ $crlf $+ $crlf } on *:SOCKREAD:Stats: { if ($sockerr) { var %Stats_error = $input(An error occured when reading from the hiscore list.,wo,Stats Lookup Error) return } .sockread %RSStats if ($+(*,%RSStatsnick,*,not,*) iswm %RSStats) { if (%RSStats_global_busy == yes) { notice %RSStats_global_rec The user %RSStatsnick doesn't appear in the hiscores. | .set %RSStats_global_busy no } else { .RSSnouser } .sockclose Stats } if (%RSSslvl && !%RSSsexp) { .set %RSSsexp $htmlpars(%RSStats) } if (%RSSsrank && !%RSSslvl) { .set %RSSslvl $htmlpars(%RSStats) } if (%RSSsskill && !%RSSsrank) { .set %RSSsrank $htmlpars(%RSStats) } if ($+(*,a href,*,%RSStatsnick,*) iswm %RSStats) { .set %RSSsskill $htmlpars(%RSStats) } if ( == %RSStats && %RSSsskill) { if (%RSStats_global_busy == no) { if (!$dialog(stats)) { halt } .did -a stats 1 %RSSsskill $chr(9) %RSSslvl $chr(9) %RSSsrank $chr(9) %RSSsexp $chr(9) $iif(%RSSsskill == Overall || %RSSslvl == 99,0,$bytes($calc($exp($calc(%RSSslvl +1)) - $remove(%RSSsexp,$chr(44))),b)) .unset %RSSs* } else { .set %RSStats_show %RSStats_show %RSSsskill ( $+ %RSSslvl $+ ) .unset %RSSs* } } } on *:SOCKCLOSE:Stats: { if ($dialog(stats) && (%RSStats_global_busy == no)) { .did -e stats 3,4 .did -ra stats 2 Stats for %RSstatsnick } /var %me modati if ($me == %me) { if (%RSStats_global_busy == yes) { notice %RSStats_global_rec Stats for %RSStatsnick $+ : %RSStats_show | .unset %RSStats_show | .set %RSStats_global_busy no } } } alias htmlpars { var %x var %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) var %x = $replace(%x,<,<,>,>,&,&,",", ,,æ,æ,ç,ç,©,©,®,®) var %t = $regex(hfreg,%x,/&#(..|...);/g) while ( %t > 0 ) { var %x = $replace(%x,$+(&,$chr(35),$regml(hfreg,%t),;),$iif($chr($regml(hfreg,%t)),$chr($regml(hfreg,%t)),?)) dec %t } return %x } on *:LOAD: { .set %RSStats_global_busy no .set %RSStats_global no .set %RSStats_trigger !statsue .set %RSStats_output User: ?user? ± Skill: ?skill? ± Level: ?lvl? ± Rank: ?rank? ± EXP: ?exp? ± EXP To Level: ?expl? echo -a RuneScape Stats Lookup Script by funman Loaded } ON *:UNLOAD: { .unset %RSStats* } menu * { RuneScape Stats Lookup:/dialog -md Stats Stats } alias exp { var %x = 1, %level = $calc($1 - 1), %xp = 0 while (%x <= %level) { var %TempXp = $calc($floor($calc(%x + 300 * 2 ^ (%x / 7))) / 4) inc %xp %TempXp inc %x } return $int(%xp) } alias RSSnouser { var %unsetAfterOk = $input(The user %RSStatsnick doesn't appear in the hiscores.,wo,Stats Lookup) } on *:DIALOG:Stats:DCLICK:1: { if ($did(Stats,1).seltext == $null) { halt } .clipboard $replace(%RSStats_output,?user?,$did(Stats,3),?skill?,$gettok($gettok($did(Stats,1).seltext,6-,32),1,9),?lvl?,$gettok($gettok($gettok($did(Stats,1).seltext,6-,32),2,9),5,32),?rank?,$gettok($gettok($gettok($did(Stats,1).seltext,6-,32),3,9),5,32),?exp?,$gettok($gettok($gettok($did(Stats,1).seltext,6-,32),4,9),5,32),?expl?,$gettok($gettok($gettok($did(Stats,1).seltext,6-,32),5,9),5,32)) } on *:TEXT:*:*: { if ($1 == %RSStats_trigger) && (%RSStats_global == yes) && (%RSStats_global_busy != yes) { if (!$2) { halt } .set %RSStats_global_busy yes .set %RSstats_global_rec $nick .set %RSstatsnick $replace($2-,$chr(32),$chr(95)) .sockopen Stats hiscore.runescape.com 80 } }