| View previous topic :: View next topic |
| Author |
Message |
monie089 Halfop
Joined: 29 Jul 2006 Posts: 76
|
Posted: Tue Aug 15, 2006 3:08 pm Post subject: stats from the web |
|
|
| 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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Aug 15, 2006 3:24 pm Post subject: |
|
|
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 |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Aug 15, 2006 6:43 pm Post subject: |
|
|
| 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.  _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
|