Trying to use the image search function in AHK and feeding it a sample image of the prioritize button, so it will scan the screen looking for that image. Luckily the prioritize button is pretty much the same for most buildings, doesn’t work on some buildings, as they are slightly different in size and pixels. But works for houses, which is what I intended it for. Only works when you placed the building and want to prioritize building it or rebuilding it.
v::
SetWorkingDir, C:\Users\Valued Customer\Desktop\AHK
CoordMode Mouse ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *TransBlack Prioritize2.png
MouseGetPos, xpos, ypos
MouseClick, left, FoundX, FoundY
MouseMove, xpos, ypos
if (ErrorLevel = 2)
MsgBox Could not conduct the search.
else (ErrorLevel = 1)
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *TransBlack PrioritizeLookout.png
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *TransBlack ForagerPrioritize.png
MouseGetPos, xpos, ypos
MouseClick, left, FoundX, FoundY
MouseMove, xpos, ypos
I tried doing the same thing for building relocating, but it’s proving a bit more difficult as the hud image for relocating the building is ever-so-slightly different. I can get it to work for one building, but it breaks when I try it on others. Tried to look for a specific pixel in a region of the screen where it would appear, but it keeps selecting the wrong thing on some buildings, so still working on it.
Obviously the above won’t work without proper setup and image files, still working on it and if I get something good I’ll let ya know