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.

stats from the web

Help for those learning Tcl or writing their own scripts.
Post Reply
m
monie089
Halfop
Posts: 76
Joined: Sat Jul 29, 2006 11:13 pm

stats from the web

Post by monie089 »

Code: Select all

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

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
Post Reply