Search code examples
searchpixelautoit

AutoIt PixelSearch does not work on Game


I am trying to create a bot that finds the portal in a game. The way I plan to do this is to find the colour of the portal and then click on it

Func FindPortal
  $pix = PixelSearch(506,157,1298,723,0xA99C99,5)
  if not(@error) Then
     MouseClick("left", $pix[0], $pix[1],1,1)
  EndIf
EndFunc

However, when this function is called. The click seems to be out of place everytime. I cannot get it to click on the portal (which is white) Also when I use Finder Tool, it seems to be out of sync.

e.g. I use the magnify option and I hover over the white area however its showing black.

What am I doing wrong? is there an alternative method? I know this might be confusing but please be patient with me. My first question after all. Thanks


Solution

  • If i understand you correctly pixelsearch always say that the Pixel is Black. In this case you should check that you script is Run as Admin to avoid to less privileges and check that your game is not in FullScreen.

    If you want to say that the Pixelposition is not sync you have to check the Pixelpositionsettings.

    Opt("MouseCoordMode", )
    Opt("PixelCoordMode", )