mIRC Homepage
Posted By: Sigh If conditions - 17/02/05 09:48 AM
Sorry if this has been reported before

if (0) fails as expected, however if (00) and if (!00) are both satisfied conditions. Try the following:

Code:
//tokenize 32 00 | if ($1) echo -a 1 | if (!$1) echo -a 2


The same holds for any amount of 0s as well as when the characters -.+ prefix a string of 0s i.e. both conditions are satisfied with +00 .00 and -00

Where $1 = 00, looks like if ($1) is satisfied because it isn't interpreted numerically, on the other hand with if (!$1) it treats 00 as a number
Posted By: DaveC Re: If conditions - 17/02/05 11:43 AM
Man, that is a bit wierd, I would call it a bug. Dont know if it can be fixed as its more like its a bug in the logic rather than code. Who knows.
I can see whats happening, but you just wouldnt have expected it to not work.
As you said $1being 00 is seen as true and !$1 becomes 1 which is also true.

* a fix, But hey whoes gonna ever remeber to put this in, and it screws up the $v1 values *
IF !$(!$1) echo -a $1 is true | IF !$1 echo-a Not $1 is true
Posted By: Sephiroth_ Re: If conditions - 17/02/05 07:57 PM
that is no bug, check for if ($1 != $null) because if you use //tokenize 32 $false | if ($1) { echo -a YEAH! } won't work :tongue:

$false $cancel $no 0 00 0... and so on, will be triggered as false if you use if (<string>) :P
Posted By: qwerty Re: If conditions - 17/02/05 08:56 PM
I guess you didn't notice that Sigh's command echoes 1 and 2. Ie both ($1) and (!$1) are true, which is definitely wrong.
© mIRC Discussion Forums