Now we are getting somwhere.
Lets take a look at what you are now trying to do.
1: You are trying to prevent it sending a message on the second command. Fine and dandy.
Remember though, Tcl processes through the code in order.
Notice you are checking the value of the check digit at the end, after the message was been sent.
2: Knowing whe to, and not to use brackets.
Using the [] brackets, runs/calls a command, and replaces the point in the code with the return value.
As such, here, you are telling the timer, you want to run the return value of the unset command, in adition to unsetting the variable on the spot.
You need to send the text unset, rather than call the command directly.
Code: Select all
utimer 20 [list unset nserv(check)]
Seeing as the correct way to use timers, is to list enclose things, use the list command, to keep things running smothly.
3: Use of $::channel
This is good use, to call global variables, and will work well. However, I strongly sugest suign a different name.
The name $channel, in a IRC bot is very common, and will likely conflict at some point. Try using nserv(channel) instead, where it will likely be more unique.
4: You can't check a non-existant variable.
In your timer, you use "unset". Again, good idea, just the use is wrong.
When the variable is unset, this like will error, as $nserv(check) no longer exists.
You can use somthing like
This will check to see if the variable exists, regardless of the value.
5: Add some brackets to your IF statments.
If blocks can get very hard to read, when using more than one check in the same block. You can group them together with brackets, so you know exactly which part is belongs to which operator.
Code: Select all
if {[string match -nocase $from $cserv(services)] != 1 && [string match -nocase $text $nserv(warning)] != 1}
TO
if {([string match -nocase $from $cserv(services)] != 1) && ([string match -nocase $text $nserv(warning)] != 1)}
The script is coming along, though I am not too sure about the second "string match". It sounds liek ti calls it is checking for the wrong value, but I can't be sure.