if (color=0xffffff) not works

Ask gaming related questions (AHK v1.1 and older)
ninjachuoi
Posts: 4
Joined: 13 Jun 2021, 09:59

if (color=0xffffff) not works

Post by ninjachuoi » 13 Jun 2021, 10:50

I wrote a small code like this:

Code: Select all

PixelGetColor, color, 100, 120
if (color = 0xffffff){
    do something
}
But when I ran the code, it wont do anything in the if statement even the color i got from PixelGetColor is white(0xffffff).
I wanna do a small auto for the game i playing. I tried ImageSearch, it worked. I tried PixelGetColor, it worked too. But i cant use the color i picked. Ahhhh :evil: I really want to know why this happened.

Thanks in advance.

User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: if (color=0xffffff) not works

Post by Smile_ » 13 Jun 2021, 11:00

Are you sure it is white?, because your script seems to be working with me.

ninjachuoi
Posts: 4
Joined: 13 Jun 2021, 09:59

Re: if (color=0xffffff) not works

Post by ninjachuoi » 13 Jun 2021, 11:03

Yes, it is white. I checked it with MsgBox %color% command.

User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: if (color=0xffffff) not works

Post by mikeyww » 13 Jun 2021, 11:15

I think it will help if you show your code. Below is an example of a "debugger".

Code: Select all

F3::
PixelGetColor, color, 300, 320
MouseMove, 300, 320
MsgBox, 64, Color, %color%
If (color = 0xFFFFFF)
 MsgBox, White
Else MsgBox, Not white
Return

Post Reply

Return to “Gaming Help (v1)”