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.

error detection and correction

Old posts that have not been replied to for several years.
Locked
m
meks
Voice
Posts: 16
Joined: Mon Jun 09, 2003 3:16 pm

error detection and correction

Post by meks »

hi!

is it possible to create a proc which is called if an error occurs?
this procedure should also fix the error if possible.

the reason why i'm asking is because i made a script which kicks people if they enter different "bad words" - for example "^^"
all these words are listed in one list called bdkb_badwords
example: set bdkb_badwords "*^^* ^?^" and so on...

this procedure is working quite fine, but it has one big bug.
if someone enter "^^ (please note the ") the following error occurs:
Tcl error [bdkb_check_proc]: unmatched open quote in list

therefore i got the idea of doing some error correction. how could i create such a procedure that either trims the trailing " or puts another " at the end? i got no idea...

tia
p
pollar
Voice
Posts: 18
Joined: Thu Jan 09, 2003 12:20 pm
Location: Lithuania

Post by pollar »

You don't need any correction procedures

As I understood you have a PUBM bind, witch binds a procedure named bdkb_check_proc. Here's an example code:

Code: Select all

proc bdkb_check_proc { nick host hand chan text } {
global bdkb_badwords
  set text [split $text]

  # now you can check a text for "bad words" by using lsearch 
  # or looping this text (using for,while,foreach and lindex [ofcourse :)])

}
I hope this will help you :wink:
Locked