Public feed
#888843
alias startrsplayers {
timer 0 10 updateplayers
echo $color(info) -ta Graph data is now collecting.
}
alias updateplayers {
if (!$sock(rsp)) {
sockopen rsp www.runescape.com 80
}
}
on *:sockopen:rsp: {
sockwrite -nt rsp GET /title.ws HTTP/1.1
sockwrite -nt rsp Host: Runescape.com
sockwrite -nt rsp $crlf
}
on *:sockread:rsp: {
if (!$sockerr) {
var %a
sockread %a
if (currently isin %a) {
if ($numtok(%play.log,32) = 100) {
tokenize 32 %play.log
set %play.log $2- $gettok(%a,4,32)
}
else { set %play.log %play.log $gettok(%a,4,32) }
drawgraph
sockclose $sockname
}
}
}
alias drawgraph {
if (!$window(@rsp)) { window -p @rsp }
else { clear -c @rsp }
drawrect -nf @rsp 1 1 0 0 2000 2000
drawline -n @rsp 0 1 50 600 800 600
drawline -n @rsp 0 1 50 600 50 100
;drawdot -n @rsp 0 1 $calc(50 + (%x * 7.5)) 610
;drawdot -n @rsp 0 1 45 $calc(600 - (%x * 5))
var %x 0
while %x <= 10 {
drawtext -n @rsp 0 Tahoma 12 5 $calc(592-((%x * 25000) * 0.002)) $calc(%x * 25000)
drawline -n @rsp 0 1 50 $calc(600-((%x * 25000) * 0.002)) 800 $calc(600-((%x * 25000) * 0.002))
inc %x
}
%x = 0
while %x <= 10 {
drawtext -n @rsp 0 Tahoma 12 $calc(46 + (%x * 75)) 608 $calc(%x * 10)
drawline -n @rsp 0 1 $calc(50 + (%x * 75)) 600 $calc(50 + (%x * 75)) 100
inc %x
}
%x = 1
while %x <= $numtok(%play.log,32) {
;drawdot -n @rsp 2 1 $calc(50+(%x *7.5)) $calc(600-($gettok(%play.log,%x,32) *0.002))
$iif(%x != $numtok(%play.log,32),drawline -n @rsp 2 1 $calc(50+(%x *7.5)) $calc(600-($gettok(%play.log,%x,32) *0.002)) $calc(50+($calc(%x + 1) *7.5)) $calc(600-($gettok(%play.log,$calc(%x + 1),32) *0.002)))
inc %x
}
drawdot @rsp
}