Page 1 of 1

Expression for a Negative Range of Values

Posted: 06 Jun 2018, 12:54
by Galaxis
I have issues with invalid results from NEGATIVE values. I'm creating a Character tracking MAP for a game.

The problem is, If I say:

Var is less than -100.
Var is between -1 and -10

BOTH returns invalid/wrong results.


The Expressions below are invalid as well:
Var < -100
(Var <= -1) && (Var >= -10)


All positive functions in the code below works perfectly. Just the Negative ones are jacked up.
Assistance would be much appreciated.


I'm testing other things. I think I may have solved the problem....

Code: Select all

	POSITIVES
		;---------<VALUE = 6.5 >---------------------------------------------------------->
		
		If a between 16576 and 16600
		{
			var1=6.5
			IniWrite, %var1% , %A_ScriptDir%\DoA.ini, DISTANCE, X1
		}
		
		If b between 16576 and 16600
		{
			var2=6.5
			IniWrite, %var2% , %A_ScriptDir%\DoA.ini, DISTANCE, X2
		}
		
		
		
		
		POSITIVES 
		;---------<VALUE = 7 >---------------------------------------------------------->
		
		If a between 16601 and 16700
		{
			var1=7
			IniWrite, %var1% , %A_ScriptDir%\DoA.ini, DISTANCE, X1
		}
		
		If b between 16576 and 16700
		{
			var2=7
			IniWrite, %var2% , %A_ScriptDir%\DoA.ini, DISTANCE, X2
		}
		
		
		
		
		
	
		
		NEGATIVE VALUES
		
		;---------<VALUE = -1 >---------------------------------------------------------->		
		
		If a < -16000
		{
			var1= -1
			IniWrite, %var1% , %A_ScriptDir%\DoA.ini, DISTANCE, X1
		}
		
		
		
		If b < -16000
		{
			var2= -1
			IniWrite, %var2% , %A_ScriptDir%\DoA.ini, DISTANCE, X2
		}
		

Re: Expression for a Negative Range of Values  Topic is solved

Posted: 06 Jun 2018, 12:59
by TheDewd
Try adding quotes around the value in your IF statement: If a < "-16000"

Code: Select all

a := -14000

If (a < -16000) {
	MsgBox, Test 1 ; Doesn't work
}

If (a < "-16000") {
	MsgBox, Test 2 ; Works
}

Re: Expression for a Negative Range of Values

Posted: 06 Jun 2018, 13:03
by swagfag

Code: Select all

a := -20000
If a <= -16000
	MsgBox % a " is smaller or equal"
else
	MsgBox % a " is bigger"

a := -8000
If a <= -16000
	MsgBox % a " is smaller or equal"
else
	MsgBox % a " is bigger"
seems like right results to me

Re: Expression for a Negative Range of Values

Posted: 06 Jun 2018, 13:04
by Galaxis
Thanks! SwagFag & TheDewd for the help!!!!

TheDewd wrote:Try adding quotes around the value in your IF statement: If a < "-16000"

Code: Select all

a := -14000

If (a < -16000) {
	MsgBox, Test 1 ; Doesn't work
}

If (a < "-16000") {
	MsgBox, Test 2 ; Works
}