pixel searched near cursor

Ask gaming related questions
kentpachi
Posts: 152
Joined: 15 May 2016, 01:23

pixel searched near cursor

Post by kentpachi » 09 Jul 2023, 08:59

Good day AHKers,

how to make a script like this

If i hold the Z key, it will search and click the desired pixel for example red only near the cursor

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

Re: pixel searched near cursor

Post by mikeyww » 10 Jul 2023, 14:22

Adjust as needed.

Code: Select all

#Requires AutoHotkey v2.0
red := 0xFF0000
rgb := 0xFFFFFF
rgb := red

z:: {
 Static tolerance := 50
 CoordMode 'Pixel'
 CoordMode 'Mouse'
 MouseGetPos &x1, &y1
 If PixelSearch(&x2, &y2, x1 - tolerance, y1 - tolerance, x1 + tolerance, y1 + tolerance, rgb)
  MouseClick , x2, y2
}

Post Reply

Return to “Gaming”