i got 2 games running in 1 bot but the score of both game cannot be saved together. anyone please help me combine it... i want the first script modify to second script.
here the first script
proc tmcquiz_rank_save {handle idx arg} {
global rankfile userlist
global lastsolver lastsolvercount timerankreset
global qnum_thisgame
global quizconf
variable fd
## save ranks
if {[llength [array names userlist]] > 0} {
set fd [open $rankfile w]
puts $fd "# rankings from $quizconf(quizchannel) at [ctime [unixtime]]."
puts $fd "winscore: $quizconf(winscore)"
puts $fd "rankreset: $timerankreset"
puts $fd "ranksave: [unixtime]"
puts $fd "qnumber: $qnum_thisgame"
if {$lastsolver != ""} {
puts $fd "lastsolver: $lastsolver = $lastsolvercount"
}
foreach u [lsort -command mx_sortrank [array names userlist]] {
array set aa $userlist($u)
puts $fd [format "%d %d : %s at %s" $aa(started) $aa(score) $u $aa(mask)]
}
close $fd
mx_log "--- Ranks saved to \"$rankfile\"."
mxirc_dcc $idx "Ranks saved to \"$rankfile\"."
} else {
mxirc_dcc $idx "Ranks are empty, nothing saved."
}
return 1
}
and here the second one
proc write_KAOSScore {} {
global KAOSScore KAOSScoreFile
set f [open $KAOSScoreFile w]
foreach s [lsort -decreasing -command sort_KAOSScore [array names KAOSScore]] {
puts $f "$s $KAOSScore($s)"
}
close $f
}
is it possible to combine it? please help me... thank you before
hikaro wrote:is it possible to combine it? please help me... thank you before
probably - but not with the amount of information given...
you want both saved files to be compatible? or just save the entries following the same pattern? or what?
i want both saved files to be compatible, so only need 1 score file there and 1 score (!Score command). if you can help and need tcl i can send you to ur mail the tcl because its big enough.
well, you need to change at least both load and save procs.
if you want to store your scores like in the second one, you need to convert your variables into arrays as well.
you should post the load and save procs and for easier understanding maybe some excerpts from your saved score files.
i think it's unnecessary to know the whole script.