mikeyww wrote: ↑30 Jun 2022, 17:13
Welcome to this AutoHotkey forum!
Code: Select all
#MaxThreadsPerHotkey 2
x = 300
y = 300
z = 400
^a::
on := !on
Loop {
Sleep, 200
SoundBeep, 1900
PixelGetColor, bgr, x, y
If !bgr {
Send {Down 3}z
SoundBeep, 1500
MouseMove, x, y ; Coordinates relative to active window
} Else {
PixelGetColor, bgr, y, z
If bgr
Continue
Send x{Left down}
Sleep, 5000
Send {Left up}
SoundBeep, 1000
MouseMove, y, z
}
} Until !bgr || !on
on := False
Return
ok, so I think I understood it, and tried using on something else:
Code: Select all
#MaxThreadsPerHotkey 2
x = 619
y = 715
z = 997
w = 394
^a::
on := !on
Loop {
Sleep, 200
SoundBeep, 1900
PixelGetColor, bgr, x, y
If !bgr {
Send {Down 3}
sleep 100
Send {Down 3}
sleep 100
Send {Down 3}
sleep 100
send z
SoundBeep, 1500
MouseMove, x, y ; Coordinates relative to active window
bgr := 111111
} Else {
PixelGetColor, bgr, z, w
continue
If (bgr := 935046z) {
Send x{Left down}
Sleep, 1000
Send {Left up}
SoundBeep, 1000
MouseMove, z, w
bgr := 111111
}
}
} Until !on
on := False
Return
this is what I got, out of yours. I didn't want it to stop once it executed once, so I got rid of the "until !bgr", the send down was too fast to be registered properly, so I improvised with many commands and sleeps. lastly, I wanted scenario 2 to play only when an specific color appeared at an specific spot, but I either can't trigger anything below the else, or they get activated all the time that scenario 1 is not running. can't get it to work.
in short, it loops checking if point A is black and if point B is red, constantly, until I tell it to stop. if A is true, down 3 z (working), if B is true press and hold left for a short while. if none of those are true, just keep looping until they are, or until I tell it to stop.
anyways, thanks for the answer and sorry for the delay.
@mikeyww