02-25-2015, 12:19 AM
(02-24-2015, 07:17 PM)knowjack Wrote: Thanks Snarg! Appreciate your continued effort to help.
I'm using the function posted above just like checkTownHall.au3, except instead of searching for 5 different images, using only 1? All I do is look for successful return value and the x,y positions in the function call, like this:
Code:If CheckSmashedTownhall() = 1 Then ; check to see if TH is smashed.
SetLog("TH Attack successful!", $COLOR_BLUE)
ExitLoop 2
EndIf
The reason I used _CaptureRegion() like checkTownHall() function; is that it appears to get the BS offsets and loads $hHBitmap (showing only the non-background code)
Code:getBSPos()
$hHBitmap = _ScreenCapture_Capture("", $iLeft + $BSpos[0], $iTop + $BSpos[1], $iRight + $BSpos[0], $iBottom + $BSpos[1])
Global $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)
Unless I am reading image search wrong, _ImageSearch calls _ImageSearchArea, and it checks to see if $hHBitmap has an image loaded from _captureRegion(), then executes DLLCALL to search for the image passed to it??
I was really hoping to reuse the existing image capture/search functions as the initially seemed pretty straight forward. But after beating my head against the wall on this off/on for a couple days, I'm just getting more confused.
try writing the hBitmap to an .bmp
_ScreenCapture_SaveImage("C:\COC-Bot-master\images\GdiPlus_Screen.bmp", $hHBitmap)
i have some weird screenshots...Only the captureregion background mode option works for me.