This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

bind pubm questions.

Old posts that have not been replied to for several years.
Locked
S
Singe

bind pubm questions.

Post by Singe »

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 ;) )

thanks!
M
MC_8
Voice
Posts: 36
Joined: Sat Apr 26, 2003 5:04 pm
Location: Dallas, Texas
Contact:

Post by MC_8 »

Code: Select all

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.
Carl M. Gregory - MC_8
http://mc.purehype.net/whois/
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

# 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] != "") &&
Elen sila lúmenn' omentielvo
Locked