Need help with checking 2 different pixel colors Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Dysreflexia
Posts: 14
Joined: 15 Apr 2018, 19:11

Need help with checking 2 different pixel colors

15 Apr 2018, 19:45

Hi, total noob here, so I've been running this script that I found in another post to automatically press a key when a certain pixel turns a certain color.

Code: Select all

Loop
{
  PixelGetColor, colorfound, 2502, 542
  if (colorfound = 0x00E900)
  {
    Send, {2 down}
    Sleep 10
    Send, {2 up}
  }
  Sleep, 10
}
return

What I would like to do though is something like this...

if pixel1 = color1
AND
pixel2 DOES NOT EQUAL color2 then
send 2

I have no idea how add that second pixel check in code. Can anyone help?

Thx a bunch
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Need help with checking 2 different pixel colors  Topic is solved

15 Apr 2018, 20:56

Code: Select all


Loop
{
  PixelGetColor, colorfound, 2502, 542
  if (colorfound = 0x00E900)   if this color is found start the next bracket section otherwise skip this section
  {  ;start first section
   PixelGetColor, colorfound, 2502, 542  ;change this for second location
  if (colorfound != 0x00E900)    ; change this for second color     if color NOT EQUAL  start next bracket section otherwise skip
   {  ;start second section if first color was same AND second color was NOT 
    Send, {2 down}
    Sleep 10                        ;do your stuff
    Send, {2 up}
    }                       ;end the second section
  }                          ;end the first section with second section included
  Sleep, 10
}                            ;end the loop.... well...restart it
return


Dysreflexia
Posts: 14
Joined: 15 Apr 2018, 19:11

Re: Need help with checking 2 different pixel colors

15 Apr 2018, 21:03

Ah, thanks so much neverlevel!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 95 guests