PixelSearch, by default, searches from top left to top right and then goes down one line until the color is successfully found.
Is it possible to start the search from the center and search outwards in a circle
PixelSearch
PixelSearch
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Re: PixelSearch
Actually, unlike ImageSearch, the direction of search depends on whether X1 is greater than X2 and whether Y1 is greater than Y2.
First, I would think you mean in an outwardly increasing rectangles, not an actual circle. It would be very difficult to make a search follow a circular pattern. And no, not unless you construct multiple searches to search in consecutive 4-segment frames that are each outside of the one prior.
Re: PixelSearch
But it is very slow, how could I improve it?
Code: Select all
-------------------------------------------------------------------------------------------------
radius:=90
radiusdurch3:=% Round(radius/3)
radiusdurch2:=% Round(radius/2)
radiusdurch1:=radius
PixelSearch, Px, Py,X-radiusdurch3, Y-radiusdurch3, X+radiusdurch3, Y+radiusdurch3, suche, 6, FAST RGB
If ErrorLevel
{
PixelSearch, Px, Py,X-radiusdurch3, Y-radiusdurch2, X+radiusdurch2, Y+radiusdurch2, suche, 6, FAST RGB
If ErrorLevel
{
PixelSearch, Px, Py,X-radiusdurch3, Y-radiusdurch1, X+radiusdurch1, Y+radiusdurch1, suche, 6, FAST RGB
If ErrorLevel
{
}
}
}
;-------------------------------------------------------------------------------------------------
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Re: PixelSearch
You could write a function in C which would be compiled into mcode (machine code) and called by your AHK script. The function would search the memory of a bitmap that is a copy of the screen area. It would be very fast. Here is an example of an mcode function acting on a bitmap.
Re: PixelSearch
looks great !boiler wrote: ↑08 May 2024, 02:52You could write a function in C which would be compiled into mcode (machine code) and called by your AHK script. The function would search the memory of a bitmap that is a copy of the screen area. It would be very fast. Here is an example of an mcode function acting on a bitmap.
But I have no IDEA how I could use this so that a color is searched for from the middle of the screen 50px in all directions
verwende AutoHotkey104805 ------------------------UPDATE auf ..1.1.33.02 erfolgreich , jetzt kommen neue Probleme
Re: PixelSearch
I didn't say you would use that. I said it was an example of how you incorporate an mcode function into your hotkey script. You actually have to write the function to do what you want it to do instead.