SUNiNET - Your Eggdrop & TCL resources site
[ Home Eggdrop TCL Links About ]

Guide to TCL scripting for Eggdrop 1.6


[ Previous ] [ Index ] [ Next ]


7.3 Matching more than two items

Besides matching only one or two items you can also set multiple conditions.
After the second action you can additionally add either && for 'and' or || for 'or' and put in another check. After that you can do the same thing again and again and so on, but this doesn't mean it will work yet when you are using both &&'s and ||'s.

To prevent the if command from making a mistake when you use ||'s and &&'s in the same if command, you can put the parts you want the && and || to react on between parentheses.
I don't know a better way to say this, so I'll just give an example.
When you have if {$test(start) == $test(stop) && $test(when) != "" || $test(what) != ""} { <body> } and you want the if command to work only when [ $test(start) == $test(stop) ] and [ $test(when) != "" || $test(what) != "" ], this proberbly wouldn't work.

The if command would proberbly see this as [ $test(start) == $test(stop) && $test(when) != "" ] or [ $test(what) != "" ].

This is fixed by putting the last part between parentheses which would make the command look like:
if {$test(start) == $test(stop) && ($test(when) != "" || $test(what) != "")} { <body> }.

Experimenting with this is the best way to figure out how it exactly works.


[ Previous ] [ Index ] [ Next ]


Design & Graphics by Shawn Borton
Copyright © 2000-2005 Marijn van Zon