mIRC Home    About    Download    Register    News    Help

Print Thread
If conditions #111617 17/02/05 09:48 AM
Joined: Aug 2003
Posts: 314
S
Sigh Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
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

Re: If conditions #111618 17/02/05 11:43 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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

Re: If conditions #111619 17/02/05 07:57 PM
Joined: Oct 2003
Posts: 214
S
Sephiroth_ Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 214
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


one step closer to world domination
Re: If conditions #111620 17/02/05 08:56 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com