Koo wrote:However, this script still has a flaw. It can't detect the special characters nick. I've tested it with "!seen [nick]" and the output I got was like "I don't remember seeing [nick] on <channel>" (something like that, I don't quite remember). I've tested it with the nick change too and the output I got was like "<nick> was last seen changing nick to {[nick]}" (is this a special character choke problem?)
This is from not listening to others, nor following the golden rules of tcl. Take for example the code snippet below, which is merely an example. There are other procedures which make this same mistake:
Code: Select all
proc record:kick {nick host hand chan args} {
... snipped irrelevant parts....
set kicked [lindex [split $args] 0]
This appears fine to the novice eggdrop user. To the more educated user they can immediately spot the issue. He has made the mistake of using the special argument "args" within his procedure header expecting it to behave normally. Args is "special" because it will swallow all arguments in it's place and all those that follow and hold them as a tcl-list.
To simplify this even more:
Code: Select all
proc record:kick {nick host hand chan args} {
Args will be a tcl-list composed of 1 element, that being the text the user has entered. Using literally ANYTHING else here: arg, text, input, etc; this situation couldv'e been avoided.
Code: Select all
set kicked [lindex [split $args] 0]
Here he takes that tcl-list which using args produces and splits it. Effectively taking a list, and splitting it into another list?!?! This produces the visible bracings you are experiencing and the inability to match nicknames. Using a variable other than "args", this code would've been correct. With "args" used the set line needs to be changed like below:
Code: Select all
set kicked [lindex [split [lindex $args 0]] 0]
You can see how convoluted this gets when you don't understand the function of "args".

Where "args" is in the original line must be replace with "[lindex $args 0]". This of course adds extra processing time, and is considered very bad form and quite sloppy style. Always remember the "rule of using args in tcl". That rule is: Never use "args" in procedure headers invoked from binds if you expect to do something with the parameters passed to "args".
These problems happen often when the script author doesn't quite grasp the language fully. Modifying examples from others without really knowing what those examples do. Perhaps reading
this would refresh them of their rookie mistakes. Especially the part near the end titled, "A point worthy of note about args".