Pressing a series of button after detecting the correct pixel color(s)
Basically a title i saw this old post https://www.reddit.com/r/AutoHotkey/comments/m5rp3p/pressing_a_button_upon_the_detection_of_an_image/
that aims to do what i want and heres my script right now that doesnt work besides ending when i press ESC and running.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetBatchLines 1
SetKeyDelay
CoordMode, Pixel, Relative
IF NOT A_IsAdmin
{
ExitApp
}
#SingleInstance Force
Esc::ExitApp
Z::
loop{
PixelSearch, OutputVarX, OutputVarY, 2199, 317, 2199, 317, 0x12DC2D, 10, Fast
If !ErrorLevel {
SendEvent Q
}
PixelSearch, OutputVarX, OutputVarY, 2199, 317, 2199, 317, 0xE24048, 10, Fast
If !ErrorLevel {
SendEvent E
}
PixelSearch, OutputVarX, OutputVarY, 2201, 335, 2201, 335, 0x4A3036, 10, Fast
If !ErrorLevel {
SendEvent D
}
PixelSearch, OutputVarX, OutputVarY, 2253, 408, 2253, 408, 0x120E59, 10, Fast
If !ErrorLevel {
SendEvent A
}
PixelSearch, OutputVarX, OutputVarY, 2386, 531, 2386, 531, 0x8449DD, 10, Fast
If !ErrorLevel {
SendEvent S
}
}
return
My goal is basically a checklist, if it sees color 1 and 2 it will press Q and E but if only 1, 4, 5 are found then Q A S and vice versa.
I tried to single it out to a single pixel coordinate because i hoped it would make the pixel search function faster.
And basically some context its supposed to run while a game is running thats in fullscreen, not sure if thats any limitation to the pixel search function.
I tried to run this on V2 but it asked for V1 so im guessing its on V1? Added v1 flair anyway. would appreciate any insight