mIRC Home    About    Download    Register    News    Help

Topic Options
#234478 - 27/10/11 01:57 PM %var bug
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
if (%var) { do stuff }
this should trigger if the %var exist. And it do so with value 1, but if the value is set to 0 then it will not trigger, since it exist with the value 0 it should trigger.

mirc version
7.19 and 7.22
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#234479 - 27/10/11 01:59 PM Re: %var bug [Re: sparta]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
This isn't a bug, if (condition) is true if 'condition' is different than 0, $false and $null
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#234487 - 27/10/11 05:02 PM Re: %var bug [Re: sparta]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: NC, USA
As Wims explained, an IF looks to see if something is true or not. Not true includes the three things mentioned (0, $null, $false). If you need it to treat a 0 as true, then you need to be more specific in your IF....

For example:
Code:
if (%var != $null) { }


*Note that the above example would also be true for $false, so depending on what %var could be, you may also need to include an OR to check if it's != $false as well.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#234489 - 27/10/11 09:01 PM Re: %var bug [Re: Riamus2]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
i noticed that, so made a alias that check the %var. Ty
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top