My AutoHotkey script for automatically clicking Twitch reward boxes fails to work - need help debugging

I created an AutoHotkey script that should automatically click on Twitch channel point reward boxes when they show up. The idea is pretty simple - check for a specific pixel color and click when it matches. But when I test it nothing happens at all.

q:: ; emergency exit key
{
    ExitApp
}

r::
Loop
{
    PixelGetColor, pixelColor, 1720, 1080 ; check pixel color at reward box location
    if (pixelColor = 0x90FFD5) ; compare with the reward box highlight color
    {
        Click, 1740, 1080 ; click the reward box position
    }
}

I tested this when a reward box was visible and made sure my cursor was hovering over it to get the highlight effect. Still no clicks happened. I know there are browser extensions that do this but I wanted to try making my own version as a learning project.

Your loop’s running non-stop without any breaks, which hammers your CPU and makes pixel detection flaky. AutoHotkey needs breathing room between checks. Throw Sleep, 50 in your loop - that’ll fix it. Also, ditch PixelGetColor and use PixelSearch instead. It’s way more forgiving when colors shift slightly from anti-aliasing or rendering quirks. Those coordinates you’re using look pretty specific to one resolution, so double-check they’re right for your setup. Fire up Window Spy (comes with AutoHotkey) to verify.