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

Guide to TCL scripting for Eggdrop 1.6

[ Previous ] [ Index ] [ Next ]

7.2 Looking if something is true or false

Sometimes you might want to only check if something is true or false.
In computer programs 0 always stands for false and 1 for true. You can do if {$one == 1} { <body> }, but there also is an other way to do the same thing.
To see if something is true you can also simply do if {$one} { <body> } and instead of if {$one == 0} { <body> } you can do if {!$one} { <body> }. You can replace the string with a command or anything else.
Inputting only one <action> in the if command without a <compare method> makes it check if it is true. By adding the ! in front of the <action> without giving a <compare method> or a second <action> it checks if it is false.
Note that in this case 'true' equals any number above 0, not just 1.

[ Previous ] [ Index ] [ Next ]

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