i need your help for pixel search

Ask gaming related questions (AHK v1.1 and older)
User avatar
mikeyww
Posts: 27085
Joined: 09 Sep 2014, 18:38

Re: i need your help for pixel search

Post by mikeyww » 03 May 2021, 14:43

I do not know what the final action is, but below is an idea that you can adjust.

Code: Select all

search := [[954, 557, 17, 15, 0xC3897C], [957, 559, 6, 5, 0x8D898C]] ; x, y, w, h, color for searches
ZeroX := A_ScreenWidth // 2, ZeroY := A_ScreenHeight // 2

*~LButton::
KeyWait, LButton, T.4
If !ErrorLevel
 Return
CoordMode, Pixel
CoordMode, Mouse
While GetKeyState("LButton", "P") {
 Loop {
  Sleep, 100
  PixelSearch, x1, y1, search.1.1, search.1.2, search.1.1 + search.1.3 - 1, search.1.2 + search.1.4 - 1
             , search.1.5, 10, Fast RGB
  If ErrorLevel
   Continue
  MouseMove, x1, y1
  PixelSearch, x2, y2, search.2.1, search.2.2, search.2.1 + search.2.3 - 1, search.2.2 + search.2.4 - 1
             , search.2.5, 10, Fast RGB
 } Until !ErrorLevel
 AimX       := x2 - ZeroX
 AimY       := y2 - ZeroY
 DirX       := 2 * (AimX > 0) - 1
 DirY       := 2 * (AimY > 0) - 1
 AimOffsetX := AimX * DirX
 AimOffsetY := AimY * DirY
 MoveX      := Floor(AimOffsetX ** 0.5) * DirX
 MoveY      := Floor(AimOffsetY ** 0.5) * DirY
 DllCall("mouse_event", uint, 1, int, MoveX * 1.9, int, MoveY, uint, 0, int, 0)
}
Return
Last edited by mikeyww on 03 May 2021, 14:50, edited 4 times in total.

sungurreis
Posts: 22
Joined: 02 May 2021, 15:20

Re: i need your help for pixel search

Post by sungurreis » 03 May 2021, 14:44

@mikeyww
help me :)

Post Reply

Return to “Gaming Help (v1)”