Hello... first timer here. I have been searching for a while now for something that can detect the color change of a pixel and make the mouse cursor move to that location. So far I've found examples of scripts where the cursor is either sent to what ever instance of color there is, or just when one specific pixel changes to that color. If anyone can help me out with a script that can monitor 4 pixels where the same color would be detected and move the mouse to each one as the color hits it consecutively that would be awesome! Time is of the essence though. It's for an event that won't last long in an MMO.
Best way I can describe the logic is;
if (specific key is pressed) then begin loop
if pixel 950, 506 = (hex code for white) then move mouse cursor to 950, 506
if pixel 950, 565 = (hex code for white) then move mouse cursor to 950, 565... (and so on.)
if (specific button is pressed) then end loop
mouse to pixle loop Topic is solved
Re: mouse to pixle loop
I realize this is a slight bump, but the time I submitted this may have been a bit on the late side.
Re: mouse to pixle loop
If it's not too late, I would like to ask a few questions: How close are the pixels to eachother? Are the pixels 100% white and not a shade of white?
It seems possible to make the script do what you are asking for, the only possible issue is that the mouse will click the top left corner of whatever is showing up, due to the way pixelsearch works. Because of that the click may not register on the objects hitbox.
It seems possible to make the script do what you are asking for, the only possible issue is that the mouse will click the top left corner of whatever is showing up, due to the way pixelsearch works. Because of that the click may not register on the objects hitbox.
Re: mouse to pixle loop Topic is solved
He does not need pixelsearch, he knows the coords.
Something like this should work
Something like this should work
Code: Select all
pixel_coords := [{x: 950, y: 506}, {x: 950, y: 565}] ; Configure your coordinates here
search_col := 0xFFFFFF
macro_on := 0
F1::
macro_on := !macro_on
if (macro_on)
GoSub, DoLoop
return
DoLoop:
Loop {
if (!macro_on)
break
for i, coords in pixel_coords {
PixelGetColor, col, % coords.x, % coords.y, RGB
if (col == search_col){
MouseClick,, % coords.x, % coords.y
}
}
Sleep 10 ; Try not to overload CPU
}
return
Re: mouse to pixle loop
PixelSearch is faster(when searching a 1x1 area) and it can search for a certain variation of the color, which is very useful in games.evilC wrote:He does not need pixelsearch, he knows the coords.
Something like this should work
Code: Select all
pixel_coords := [{x: 950, y: 506}, {x: 950, y: 565}] ; Configure your coordinates here search_col := 0xFFFFFF macro_on := 0 F1:: macro_on := !macro_on if (macro_on) GoSub, DoLoop return DoLoop: Loop { if (!macro_on) break for i, coords in pixel_coords { PixelGetColor, col, % coords.x, % coords.y, RGB if (col == search_col){ MouseClick,, % coords.x, % coords.y } } Sleep 10 ; Try not to overload CPU } return
Re: mouse to pixle loop
Code: Select all
loops := 100
a1 := 0
Loop % loops {
QPX( True )
PixelSearch, x, y, 0, 0, 0, 0, 0xFFFFFF
a1 += QPX(false)
}
a1 /= loops
a2 := 0
Loop % loops {
QPX( True )
PixelGetColor, out, 1, 1, RGB
a2 += QPX(false)
}
a2 /= loops
msgbox % "PixelSearch: " a1 "`nPixelGetColor: " a2
QPX( N=0 ) { ; Wrapper for QueryPerformanceCounter()by SKAN | CD: 06/Dec/2009
Static F,A,Q,P,X ; www.autohotkey.com/forum/viewtopic.php?t=52083 | LM: 10/Dec/2009
If ( N && !P )
Return DllCall("QueryPerformanceFrequency",Int64P,F) + (X:=A:=0) + DllCall("QueryPerformanceCounter",Int64P,P)
DllCall("QueryPerformanceCounter",Int64P,Q), A:=A+Q-P, P:=Q, X:=X+1
Return ( N && X=N ) ? (X:=X-1)<<64 : ( N=0 && (R:=A/X/F) ) ? ( R + (A:=P:=X:=0) ) : 1
}
With 100 loops, they seem about the same.
Neither are likely as fast as GDIP
Re: mouse to pixle loop
I hate to resurrect an old post, but I think a belated "Thank you" is in order. Life came up, along with someone I knew, who was working on the same thing unbeknownst to me at the time, provided a solution before any answers came from here. But, now that that is no longer available to me, this script, with a little tweaking, compiled into an EXE in combination with the use of GlovePie works just as effectively.evilC wrote: ↑08 Feb 2017, 13:02He does not need pixelsearch, he knows the coords.
Something like this should work
Code: Select all
pixel_coords := [{x: 950, y: 506}, {x: 950, y: 565}] ; Configure your coordinates here search_col := 0xFFFFFF macro_on := 0 F1:: macro_on := !macro_on if (macro_on) GoSub, DoLoop return DoLoop: Loop { if (!macro_on) break for i, coords in pixel_coords { PixelGetColor, col, % coords.x, % coords.y, RGB if (col == search_col){ MouseClick,, % coords.x, % coords.y } } Sleep 10 ; Try not to overload CPU } return
Who is online
Users browsing this forum: No registered users and 69 guests