mIRC Home    About    Download    Register    News    Help

Print Thread
ISNUM and negitive values #134289 30/10/05 04:24 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Just found out you cant check a number against a negitive start value, looks like the pharser sees -N as being N or less, it can be worked around easy enough, just thought id mention it.

example

//if (-4 isnum -3-9) echo BLAH

Re: ISNUM and negitive values #134290 30/10/05 05:03 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
strange indeed
//if (3 isnum -) echo BLAH
//if (-1 isnum -asd) echo BLAH1

smirk


$maybe
Re: ISNUM and negitive values #134291 31/10/05 03:28 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I did your test example, and it worked for me, however, when I tried //if (-4 isnum 3--9) echo blah it returned nothing

I thought it would return blah, since -4 is in the range 3 to -9, but it doesn't.

Looks to me, like the range has to be specified with the lowest number first //if (-4 isnum -9-3) echo blah, does return blah

Last edited by RusselB; 31/10/05 03:29 AM.
Re: ISNUM and negitive values #134292 31/10/05 05:06 AM
Joined: Feb 2005
Posts: 342
R
Rand Offline
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
I think his point was that it *does* echo, and it shouldn't.

//if (-10 isnum -8-5) { echo -s $v1 }

Should see if $v1 matches -8 through positive 5. But it still is a "$true" statement, when it should be a $false.

Re: ISNUM and negitive values #134293 31/10/05 07:55 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
OK, I have to agree, but using the original example, it comes back true & it is true.

Re: ISNUM and negitive values #134294 31/10/05 04:49 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
-3-9 in the original example was -3 to +9, so it came back true when it should have been false. smile

It does seem that negatives aren't treated correctly with isnum. It may have to do with the fact that - isn't really negative and in this case, it is treated as a range character, so messes it up the same way a comma can mess things up.

I can't seem to find a way to make it work properly.


Invision Support
#Invision on irc.irchighway.net
Re: ISNUM and negitive values #134295 31/10/05 11:40 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
hey dude, i suggest you actually try using the original example <snicker snicker>

Re: ISNUM and negitive values #134296 01/11/05 01:09 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
This is totally weird, because I did test the original example before I posted, and it worked correctly, yet just now when I tried it again, it didn't. *sigh*