This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Old posts that have not been replied to for several years.
I
Iridium
Post
by Iridium » Wed Aug 28, 2002 7:56 am
Code: Select all
package require http
bind pub n !wstat getwolfstat
proc getwolfstat {nick host hand chan args} {
set token [::http::geturl "http://www.dropscape.com/stats/dropscape/wolfstat.html" -command getwolfcallback]
putserv "PRIVMSG $chan :Retrieving data.. please allow up to 30 seconds.."
}
proc getwolfcallback {token} {
set mydata [::http::data $token]
::http::cleanup $token
processwolfdata $mydata
}
proc processwolfdata {mydata} {
set position [string first "CLASS=\"PLAYERS_FIELDS_NAME_HL\"" $mydata]
set maxlen 0
for {set i 0} {$i <= 10} {incr i} {
set position [string first "<a href" $mydata $position]
set endpos [string first "</a>" $mydata $position]
set name [lindex [split [string range $mydata $position $endpos] <>] 2]
set position [string first "CLASS=\"PLAYERS_FIELDS_HL\"" $mydata $position]
set endpos [string first "</td>" $mydata $position]
set score [lindex [split [string range $mydata $position $endpos] <>] 1]
lappend names [list $name $score]
if {$maxlen < [string length $name]} {set maxlen [string length $name]}
set position [string first "CLASS=\"PLAYERS_FIELDS_NAME_HL\"" $mydata $position]
}
putlog "blah - $maxlen"
set text "Name"
set score "Score"
set maxlens 7
putserv "PRIVMSG #b0ts :| [string repeat "-" $maxlen] | [string repeat "-" $maxlens] |"
putserv "PRIVMSG #b0ts :| ${text}[string repeat " " [expr $maxlen - [string length $text] ]] | ${score}[string repeat " " [expr $maxlens - [string length $score] ]] |"
putserv "PRIVMSG #b0ts :| [string repeat "-" $maxlen] | [string repeat "-" $maxlens] |"
foreach z $names {
putserv "PRIVMSG #b0ts :| [lindex $z 0][string repeat " " [expr $maxlen - [string length [lindex $z 0]] ]] | [lindex $z 1][string repeat " " [expr $maxlens - [string length [lindex $z 1]] ]] |"
#putlog "-[expr [string length [lindex $z 0]] - $maxlen]"
}
}
I
Iridium
Post
by Iridium » Wed Aug 28, 2002 7:59 am
Code: Select all
[12:58:17] <@[rSu]iridium> !wstat
[12:58:18] <@DeepBlue> Retrieving data.. please allow up to 30 seconds..
[12:58:34] <@DeepBlue> | ---------------- | ------- |
[12:58:35] <@DeepBlue> | Name | Score |
[12:58:36] <@DeepBlue> | ---------------- | ------- |
[12:58:38] <@DeepBlue> | xil-MentholMoose | 459 |
[12:58:40] <@DeepBlue> | [u]Korollary | 414 |
[12:58:42] <@DeepBlue> | [DS-P]StarCat | 339 |
[12:58:44] <@DeepBlue> | f!Spetsnaz | 287 |
[12:58:46] <@DeepBlue> | [BvR]BeaveRmanA | 264 |
[12:58:48] <@DeepBlue> | Decap Latte | 243 |
[12:58:50] <@DeepBlue> | T^0wi^0t | 230 |
[12:58:52] <@DeepBlue> | -xTc][Slowpa!n- | 228 |
[12:58:54] <@DeepBlue> | Slowpa1n | 211 |
[12:58:56] <@DeepBlue> | [u]GrmReap0r | 208 |
[12:58:58] <@DeepBlue> | RobinHood | 205 |
You need the http package for this to work. Only the owners can use the !wstat command.
I
Iridium
Post
by Iridium » Wed Aug 28, 2002 8:22 am
Oh, and I also used a special 'space' character on the second | ---------------- | ------- | to prevent the eggdrop deleting it, thinking it is a duplicate message
S
StarCat
Post
by StarCat » Wed Aug 28, 2002 6:05 pm
I have HTTP.tcl ver. 2.4 If I load it with the bot the script you wrote crashes if i dont load the http script and run your script it says retrieving data... please allow up to 30 seconds...
but it never shows anything. If i do a !wstat again the bot crashes.
I'm running windrop also. In dcc chat with the bot I get blah -16 when i run this script. I looked for a updated bversion of http.tcl but only found this one.
=[
I
Iridium
Post
by Iridium » Wed Aug 28, 2002 6:10 pm
You have the latest version of http.tcl (the same version I used)
Maybe if we meet on IRC I will be able to help you out.. the "blah - 16" is a side effect, it can easily be removed, I was using it for debugging.
Your bot crashes? That must be a problem with windrop. I can try and find a way around it, maybe, but It'll be a lot easier if we do this on IRC
S
StarCat
Post
by StarCat » Wed Aug 28, 2002 6:14 pm
Sure I'm here ETG #toplum