hi - I have this script to read a line in a file - it finds the line I want, but it reads the whole file to the channel - I only want it to read the first line with /04 in it...
proc pub:readmkw { nick uhost handle channel arg } {
set mkwf [open /home/citinews/Bots/Undernet/news/mkw2.txt r]
set data [read $mkwf]
foreach line [split $data \n] {
if {[string match */04* $line]} {
set mkw [string range $line 20 end]
if {[string match *\]* $mkw]} {
putserv "PRIVMSG #Newsroom2 :4,4 1,15 [gettime -18]ET $mkw "
} else {
putserv "PRIVMSG #Newsroom2 :4,4 4,15 [gettime -18]ET * $mkw "
}
}
}
}
NewzBoy wrote:Tcl error [pub:readmkw]: syntax error in expression "$mkw.last != $mkw": extra tokens at end of expression
That's due to the "." in your variable name. If you want to use special characters in your variable names you have to enclose the name in braces so tcl knows where the name ends. Eg: ${mkw.last}
Check this page for details.