Code: Select all
ImageSearch, X, Y, 746, 148, 1802, 1205, *20 Healthbar.bmp
if !ErrorLevel {
xa := x+80
ya := y+180
MouseMove, %xa%, %ya%
}
Code: Select all
ImageSearch, X, Y, 746, 148, 1802, 1205, *20 Healthbar.bmp
if !ErrorLevel {
xa := x+80
ya := y+180
MouseMove, %xa%, %ya%
}
Code: Select all
image = %A_ScriptDir%\Healthbar.bmp
Global found := []
If !FileExist(image) {
MsgBox, 48, Error, File not found. Aborting.`n`n%image%
Return
} Else CoordMode, Pixel
CoordMode, Mouse
For each, place in imgFindAll(image, 0, 0, A_ScreenWidth, A_ScreenHeight, imgSize(image)) {
MouseMove, place.x, place.y
SoundBeep, 1500, 20
Sleep, 400
}
ExitApp
imgFindAll(image, x1, y1, x2, y2, size) {
ImageSearch, x, y, x1, y1, x2, y2, %image%
If ErrorLevel
Return
found.Push({x: x, y: y})
imgFindAll(image, x + size.w, y , x2, y + size.h, size)
imgFindAll(image, 0 , y + size.h, x2, y2 , size)
Return found
}
imgSize(img) { ; Returns an array indicating the image's width (w) and height (h),
; obtained from the file's properties
; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=81665
SplitPath, img, fn, dir
objShell := ComObjCreate("Shell.Application")
objFolder := objShell.NameSpace(dir)
objFolderItem := objFolder.ParseName(fn)
scale := StrSplit(RegExReplace(objFolder.GetDetailsOf(objFolderItem, 31), ".(.+).", "$1"), " x ")
Return {w: scale.1, h: scale.2}
}
Code: Select all
~Space::
While, GetKeyState("Space","P") {
ImageSearch, X, Y, 1050, 325, 1525, 645, *20 Healthbar.bmp
If (ErrorLevel == 0) {
xa := x+80
ya := y+180
MouseMove, %xa%, %ya%
sleep, 20
send, w
sleep, 20
send, e
sleep, 20
send, q
}
else if (ErrorLevel ==1) {
ImageSearch, X, Y, 895, 180, 1630, 765, *20 Healthbar.bmp
If (ErrorLevel == 0) {
xa := x+80
ya := y+180
MouseMove, %xa%, %ya%
sleep, 20
send, w
sleep, 20
send, e
sleep, 20
send, q
}
else if (ErrorLevel ==1) {
ImageSearch, X, Y, 550, 40, 1980, 1145, *20 Healthbar.bmp
If (ErrorLevel == 0) {
xa := x+80
ya := y+180
MouseMove, %xa%, %ya%
sleep,, 20
send, w
sleep, 20
send, e
sleep, 20
send, q
}
}
}
}
Code: Select all
ImageSearch, x, y, x1, y1, x2, y2, *20 %image%
Users browsing this forum: No registered users and 98 guests