need help with a color finder

Ask gaming related questions (AHK v1.1 and older)
yeoldecoot
Posts: 1
Joined: 13 Apr 2018, 02:37

need help with a color finder

13 Apr 2018, 02:44

Hi i was working on some code that needed a Pixel Search command and i'm having issues with it. The code always states that it found a match immediately at the defined start. Any help would be much appreciated, thank you.

Code: Select all

PixelSearch, endX, endY, %topleftX%, %topleftY%, %bottomrightX%, %bottomrightY%, Ox65DFF1, 0, BGR, Slow
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: need help with a color finder

13 Apr 2018, 06:59

There are a lot of reasons for pixelsearch not giving the result , on win10 i cannot use "slow" it stalls the code.
Make sure the color is correct , try the code from the documentation for pixelgetcolor to verify the color ( if it is a game maybe it will never work)
Be aware that the coordinates are referenced by default to the active window ,you can change using "coordmode" like in the testcode.

Code: Select all

^!z::  ; Control+Alt+Z hotkey.
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
MsgBox The color at the current cursor position is %color%.
return
This is a working test for a pixelsearch :

Code: Select all


coordmode ,pixel
coordmode, mouse

topleftX:=0
toplefty:=0
bottomrightX:=a_screenwidth
bottomrighty:=a_screenheight

Gui,  +alwaysontop
gui, font ,s30 cF1DF65  ; color is et in RGB
Gui, add,text,w200 ,.
gui,show,
return

f3::
tooltip
PixelSearch, endX, endY, %topleftX% , %topleftY% , %bottomrightX% , %bottomrightY% , 0x65DFF1,0 , Fast
if errorlevel
msgbox %errorlevel%
else
mousemove ,% endX ,% endy
ToolTip,  % endX  "   " endy
return

guiclose:
exitapp

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 51 guests