How are we supposed to correct your code when you don't show it to us?AsoAron wrote:I tried timers, but it wont work
Code: Select all
proc addstats {nick host hand chan arg} {
global file handle channel statchans
set handle $hand
set channel [lindex $arg 0]
if {[validchan $channel]} {
putserv "NOTICE $nick :I already have a record for that channel.."
return 0
}
channel add [string tolower $channel]
utimer 10 [check_op $nick $channel $host]
}
proc check_op {nick channel host} {
global file
if {![isop $nick $channel]} {
channel remove $channel
putserv "NOTICE $nick :You must be an OP in $channel to request me!"
return 0
} else {
set fs [open $file a+]
puts $fs "### Channel added by $nick ($host) ###"
puts $fs "<channel=\"$channel\">"
puts $fs " Logfile=\"/home/aron/jabot/mel/logs/[string trim $channel ?#?].log\""
puts $fs " Format=\"mIRC\""
puts $fs " Network=\"quakenet\""
puts $fs " OutputFile=\"/home/aron/public_html/[string trim $channel #].html\""
puts $fs "</channel>"
puts $fs " "
close $fs
mel_add +chan [string tolower $channel]
lappend statchans "$channel"
}
}
...which will, because of command substitution, be executed right at that moment and the return value from check_op will be executed 10 seconds later. This problem has been discussed before and a quick forum search should give you some working examples.AsoAron wrote:Code: Select all
utimer 10 [check_op $nick $channel $host]
Code: Select all
proc statchans {arg channel} {
global statsfile
if {$arg == "r"} {
set fs [open $statsfile r]
gets $fs x
set statchans $x
close $fs
return $statchans
} elseif {$arg == "a"} {
set fs [open $statsfile r]
gets $fs x
set statchans $x
lappend statchans $channel
close $fs
set fs [open $statsfile w]
puts $fs $statchans
close $fs
}
}