0
votes

Hello I am fairly new to coding and I’m making a programme for a game I play on AHK, I’m trying to code a script so that when a pixel changes colour on my screen the script will completely stop whilst remaining part of the loop. The main code works but I've tried to add a system where the script will stop running if a pixel changes colour. Thanks for the help in advance.

Esc::ExitApp
+r::
sleep, 1000
Send, {e down}
Send, {e up}
sleep, 10750
loop {
PixelGetColor, color1, 949, 269
if(color1 = “0xA6A6A6”)
sleep, 500                  
SendInput {Esc} 
    IfWinActive ahk_exe FiveM_GTAProcess.exe
    sleep, 5550
    Send, {e down}
    Send, {e up}
    sleep, 500
    MouseClick Left, 649, 390
    sleep, 500
    MouseClick Left, 964, 484
    sleep, 500
    MouseClick Left, 1311, 415
    sleep, 500
        loop, 4
        {
        MouseClick Left, 964, 484
        sleep, 500
        }
    sleep, 500
    MouseClick Left, 720, 415
    sleep, 500
}
2

2 Answers

0
votes

Add Break after your if:

if(color1 = “0xA6A6A6”)
    Break
0
votes
if(color1 = “0xA6A6A6”)
{
sleep, 500                  
SendInput {Esc}
}