Page 1 of 1

need help with a color finder

Posted: 13 Apr 2018, 02:44
by yeoldecoot
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

Re: need help with a color finder

Posted: 13 Apr 2018, 06:59
by noname
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