Imagesearch failure (new and confused!)

Ask gaming related questions (AHK v1.1 and older)
crotchxpheasantx
Posts: 1
Joined: 10 Feb 2017, 17:19

Imagesearch failure (new and confused!)

10 Feb 2017, 17:30

Hi everyone!
I am trying to make a gaming script that looks for a specific 'buff' icon in a given space, and if the icon is not found, activates the hotkey associated with the buff. In theory, This script would be auto-renewing buffs as they wore off.

I captured a screenshot with all of the buffs active, and cut out each icon and saved it as a 24 bit .bmp via MSpaint. I used a small script that found mouse coords and saved them to the clipboard in order to secure the dimensions of the searchable box, and I was reasonable generous for a margin of error.

As it stands, the script does nothing. It neither throws the "b" command that I had hoped would act as a crude negative indicator, nor does it cast the buff when it cannot detect the image in the given rectangle. Earlier I tried to include a part in which if errorlevel = 1 the script would fire off the hotkeys, but that didn't work either. I am very new and totally confused, any help would be appreciated!

#NoEnv
#warn
SendMode Input

#NoEnv
#warn
SendMode Input

setkeydelay 90

#NUMPAD1::
Pause
Suspend
return

LOOP
{
ImageSearch, , , 532 , 903, 988, 948, C:\Users\EXAMPLE\Desktop\PixelMacro\buff1.bmp
{
If (ErrorLevel = 0)
send B
return
}
{
If not (ErrorLevel = 0)
Send, {numpad9}{4}
return
}
}
User avatar
Grendahl
Posts: 170
Joined: 30 Sep 2013, 08:21

Re: Imagesearch failure (new and confused!)

16 Feb 2017, 09:16

ImageSearch, x, y, 532 , 903, 988, 948, C:\Users\EXAMPLE\Desktop\PixelMacro\buff1.bmp

the output variables are required.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 27 guests