egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

stats from the web

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Tue Aug 15, 2006 3:08 pm    Post subject: stats from the web Reply with quote

Code:

set webport 80
set webserv "www.nintendowifi.com"
set webpath "/gaminghub/MetroidHuntersLicenseFrame.jsp?gspid="
set localfilename "wifi/gspid.txt"
set update_feq 120
set update_in_progress 0
set outfile ""
bind pub - &stats pub:stats

proc func:read_stats_data {text} {
if {[file exists $localfilename r]
set mph_stats ""
while {!{eof $localfile]} {
gets $localfile mph_stats_temp
append mph_stats "-$mph_stats_temp"
set overall rank_temp [join [list [split $mph_stats_temp :]]]
set Alt_kills [lindex $kills_temp 1]
if {$Alt_kills < 6} P
set mph_top_five($alt_kills) "Driver: [lindex $rank_temp 0] Rank: [lindex

$Rank_temp 1]
Game wons: [lindex $rank_temp 2]"
}
}
putlog "Mphstats.tcl -$localfilename."
close $localfile
}
}
proc pub:stats {nick host handle chan text} {
global stats
global mph_top_five
set query_name [string trim $text]
if {]string match "" $text] } {
set mph_top_five_i 1
putserv "PRIVMSG $chan :MPH top 5 players..."
while {$mph_top_fivw_i < 6} {
putserv "PRIVMSG $chan :$mph_top_five($mph_top_five_i)"
incr mph_top_five_i
}
} else {
foreach mph_stat [join [list [split $mph_stats "-" ]]] {
               set driver_data [join [list [split [string trim

$mph_stat] : ]]]
               if { [string match -nocase "*$query_name*"

[lindex $driver_data 0]] } {
                  putserv "PRIVMSG $chan :Driver: [lindex

$mph_data 0]   Rank: [lindex $mphr_data 1]   Points: [lindex $mph_data

2]"
               }
            }         }
      }

why doesnt it display the info
_________________
New server irc.NintendoXG.com come and visit
Back to top
View user's profile Send private message Send e-mail
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Aug 15, 2006 3:24 pm    Post subject: Reply with quote

I'd suggest you start by getting your brackets and braces in order...

edit:
I'd also suggest you read up on your tcl-manual, to get atleast a basic understanding on how to use [], {}, basic commands such as "set", how to use lists and strings (ie. not using list commands on strings), knowing that variable names are case sensitive

Also, seems like pieces of code is actually missing there.. you use gets on a file that you hav'nt opened..

Probably a few more flaws/faults that I failed to notice while skimming thru that code...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Tue Aug 15, 2006 6:43 pm    Post subject: Reply with quote

nml375 wrote:
Also, seems like pieces of code is actually missing there.. you use gets on a file that you hav'nt opened..

That would be because we're cannibalising other's code and then asking in the forums to sort it out. Smile
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber