Now then.. I'm trying to write a script that every 60 seconds reads 2 text files, and if the contents of those files are equal, do nothing. BUT, if they're different, incorporate the line from the first file into the channel topic.
Here's what I've got so far:
Code: Select all
proc checktopic {} {
set cdjf [open "/usr/local/autodj/tmp/lastdj" r]
while {[eof $cdjf] !=1} {
set cdj [gets $cdjf]
}
close $cdjf
set tdjf [open "/usr/local/autodj/tmp/topicdj" r]
while {[eof $tdjf] !=1} {
set tdj [gets $tdjf]
}
close $tdjf
if {$cdj == $tdj} {
putlog "Same DJ, no change - $cdj"
break
} else {
putserv "TOPIC #KJSR :KJSR.net - The Voice of Jello Shooters - $cdj"
set tdjf [open "/usr/local/autodj/tmp/topicdj" w]
puts $tdjf $cdj
close $tdjf
utimer 60 [list checktopic]
}
}
utimer 60 [list checktopic]
Code: Select all
<JohnnyFever> [22:49] Same DJ, no change -
<JohnnyFever> [22:49] Tcl error in script for 'timer1494':
<JohnnyFever> [22:49] invoked "break" outside of a loop
And what's worse, is the contents of the two files are different, so it SHOULD be changing the topic.
Can anyone tell me where I screwed up? Thanks in advance.