I was hoping someone could help me out, I'm fairly new to tcl and don't have a very extensive resouce list yet..
I'm trying to write a script that is basically a badword script, I'd like the badwords to be in a file so more words can be easily added. I guess my main question is if there is a way to use bind pubm and a variable that holds the various words in the badword file?
Bad Words v5.1.9 by MC_8 is pretty close to what I want, but it seems like way way overkill for my needs (plus I'd like to write it myself (for the most part anyway )
set io [open the_datafile.dat r]
while {![eof $io]} {
gets $io line
if {([string trim $line] != "") &&
[string match $line $the_text_said]} {
;# Found match, do stuff here.
break
}
}
close $io
------
There is an example. Opens 'the_datafile.dat', reads each line assuming the line is a glob style string to match against '$the_text_said'.
Last edited by MC_8 on Sun Apr 27, 2003 5:24 am, edited 1 time in total.
# a close bracket missing here
if {([string trim $line != "") &&
# make sure you get it right before testing or your bot will crash
if {([string trim $line] != "") &&