Absolute newbie asks for help with PixelSearch/PixelGetColor

Ask gaming related questions (AHK v1.1 and older)
LazyVovchik
Posts: 1
Joined: 15 May 2024, 10:15

Absolute newbie asks for help with PixelSearch/PixelGetColor

Post by LazyVovchik » 15 May 2024, 11:06

How to make script that would detect if an area contains a pixel of a specific color and press key based on the color,
To be more precise, I need button A to be pressed when there is a red note in front of the line, and button D when there is a blue note.

You can make an example or a full-fledged script using this data:
Blue X, Y: 1140, 576
Blue color hex: #BDD6E7

Red X, Y: 1140, 496
Red color hex: #DEBBBA
Screenshot_1700.png
Screenshot_1700.png (196.59 KiB) Viewed 294 times

User avatar
CoffeeChaton
Posts: 35
Joined: 11 May 2024, 10:50

Re: Absolute newbie asks for help with PixelSearch/PixelGetColor

Post by CoffeeChaton » 15 May 2024, 13:01

Code: Select all

#Requires AutoHotkey v1.1.33.11

~Space:: Script1(10)
Script1(sec) {
    ms := sec *1000
    i := ms / 10
    loop % i {
        PixelSearch, OutputVarX, OutputVarY, 1140, 576, 1141, 577, 0xBDD6E7, , Fast RGB
        if (ErrorLevel = 0) {
            Send, D
        }

        ; Red X, Y: 1140, 496
        ; Red color hex: #DEBBBA
        PixelSearch, OutputVarX, OutputVarY, 1140, 576, 1141, 577, 0xDEBBBA, , Fast RGB
        if (ErrorLevel = 0) {
            Send, A
        }
        Sleep, 10
    }
}

good luck

Post Reply

Return to “Gaming Help (v1)”