it will first fetch the skull1 image:
If you find it, you will move on to the next searches that are for the variable:
image_uh_name
which in this case is defined by a number from 5 to 100, just multiples of 5, for example: 5, 10, 15, 20 and so on up to 100.
If I set 75 and it finds images below 75 or equal to 75 it executes the action of pressing the "f9" key, if the value of the images found is above 75 it does not perform any action.
Below I will leave the link to the images, remembering that the percentage images are all in PNG and the link I will leave to them below I put them all together to give an example, but they are all separated one by one in the defined folder, each one with its respective name that are numbers.
link img % : https://imgur.com/WoBD3s6
link img skull: https://imgur.com/fWxNH0K
link img skull1: https://imgur.com/hdg9AzZ
Code: Select all
#NoEnv
#Warn
#SingleInstance Force
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
SetBatchLines, -1
SendMode Input
SetKeyDelay, -1, -1
SetMouseDelay, 1
SetDefaultMouseSpeed, 1
SetWinDelay, -1
SetControlDelay, -1
CoordMode, Pixel, Screen
; Configuration
uh_hotkey := "{f9}" ; Hotkey to use
battle_coordinates := "x217 y50" ; Coordinates to click
imagem_uh_nome := "75.png" ; Name of the image to search
; Image paths
imagem_uh_path := "C:\Users\miche\OneDrive\Área de Trabalho\" . imagem_uh_nome ; Path to imagem uh.png
skull_path := "C:\Users\miche\OneDrive\Área de Trabalho\skull.png" ; Path to skull.png
skull1_path := "C:\Users\miche\OneDrive\Área de Trabalho\skull1.png" ; Path to skull1.png
SetTimer, CheckHealth, 1000 ; Check every 1 second
While true {
CheckHealth:
If WinActive("ahk_class Qt5158QWindowOwnDCIcon")
{
; First Stage [LIFE]
CoordMode, Pixel, Screen
CoordSearchMode := "Fast"
; Search for skull image first
CoordPixelColor, FoundX, FoundY, 200, 51, PixelGetColor(335, 60), %skull_path%, 0, Fast RGB
if ErrorLevel = 0
{
continue ; Skip to the next iteration of the loop
}
; Search for skull1 image
CoordPixelColor, FoundX, FoundY, 200, 51, PixelGetColor(335, 60), %skull1_path%, 0, Fast RGB
if ErrorLevel = 0
{
continue ; Skip to the next iteration of the loop
}
; If skull images not found, then search for the specified image
CoordPixelColor, FoundX, FoundY, 200, 51, PixelGetColor(335, 60), %imagem_uh_path%, 0, Fast RGB
if ErrorLevel = 0
{
ControlSend,, {f9}, Pokemon
Sleep 50
ControlClick, %battle_coordinates%, Pokemon
}
}
}
Can anyone help me fix this code?