I need a script that my bot will load.
The script will set a topic on each channel at different
timing, 3 pm 6 pm 9 pm. It obtains the topic msg
from a file topic.txt in the same directory of the .tcl file.
topic.txt contains:
# channel:time:topic
#chan1:3pm:Today's topis is how to bake cheesecake!
#chan1:6pm:Time to watch wrestling!
#chan1:9pm:Ready to kick soccer?
#chan2:3pm:topic goes.
#chan2:6pm:so on..
#chan2:9pm:yup
bind time - "00 *" foo
if {![catch {set f [open topic.txt]}]} {
set t [split [read $f] \n:]; close $f
} {set t {}}
proc foo {m h args} {
foreach {c n s} $::t {
if {[string trimleft $h 0]==[string trim $n apm]} {
if {[botisop $c]} {putserv "topic $c :$s"}
}
}
}
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use
as far as I can see, the script will ignore am/pm. I would suggest to get rid of am/pm and use 2 digit 24 hour timecode. that way you can simply use '$h == $n'. else i would suggest to add 12 to $n it was pm, leave it 12 if it was 12pm and make $n 0 if it was 12am.
bind time - "00 *" foo
if {![catch {set f [open topic.txt]}]} {
set t [split [read $f] \n:]; close $f
} {set t {}}
proc foo {m h args} {
foreach {c n s} $::t {
if {[clock scan $h]==[clock scan $n]} {
if {[botisop $c]} {putserv "topic $c :$s"}
}
}
}
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use