package require http bind pub - @stats firstsocket proc firstsocket {nick userhost handle chan text} { regsub -all { } $text "-" text if {$text != ""} { set rsn "$text" } else { set rsn "$nick" } set site "http://ZetaScript.org/Zeta/stats.php?" set url $site[http::formatQuery player $rsn] set read [::http::data [::http::geturl $url -timeout 10000]] foreach line [split $read \n] { if {[string match *Warning* $line] == 1} { putserv "PRIVMSG $chan :\00310Unable to find \00312$rsn \00310in the \00312RuneScape \00310HighScores!";return } if {[lindex [split "$line" ","] "1"] != -1} { if {[info exists type] == 0} { set type "\00310[lindex [split "$line" ","] "0"] \00312[lindex [split "$line" ","] "2"]" } else { set type "$type \00310[lindex [split "$line" ","] "0"] \00312[lindex [split "$line" ","] "2"]" } } } putquick "PRIVMSG $chan :\00310Stats for \00312$rsn\00310:" putquick "PRIVMSG $chan :$type" }