Code: Select all
CoordMode, Pixel, RGB
Loop
{
; Wait for the Y key to be pressed
$y::
SetTimer, AutoClicker, % (Toggle := !Toggle) ? "100" : "Off"
if (!Toggle)
{
SendInput {W up}
Clicking := false
}
return
AutoClicker:
; Set the X and Y coordinates of the click location
ClickX := 1731
ClickY := 845
; Set the X and Y coordinates of the pixel color location to be detected
PixelX := 1379
PixelY := 781
; Check the pixel color at the specified location
PixelGetColor, Color, %PixelX%, %PixelY%
; Define the target color (replace with your desired color)
TargetColor := 0xE9DDD4 ; Color #e9ddd4
; Check if the detected color matches the target color
if (Color = TargetColor)
{
MsgBox, Target color detected! Script will now exit.
if (Clicking)
{
Clicking := false
Click %ClickX%, %ClickY%, up ; Release the mouse button
}
SendInput {Space up} ; Release the SPACE BAR
ExitApp ; Exit the script
}
; Perform clicking actions if Clicking flag is true
if (Clicking)
{
Click %ClickX%, %ClickY%
Sleep 10
}
; Click on the specified location when Toggle is true
if (Toggle)
{
Clicking := true
Click %ClickX%, %ClickY%
}
; Hold down the W key
SendInput {W down}
; Press the spacebar
Send {Space}
; Wait for a short duration (adjust as needed)
Sleep 10
; Release the W key if Toggle is false
if (!Toggle)
SendInput {W up}
; Wait for a longer duration (adjust as needed)
Sleep 10
return
}
Code: Select all
CoordMode, Pixel, Screen
; Set the X and Y coordinates of the pixel color location to be detected
PixelX := 1379
PixelY := 781
; Define the target color (replace with your desired color)
TargetColor := 0xE9DDD4 ; Color #e9ddd4
Loop
{
; Check the pixel color at the specified location
PixelGetColor, Color, %PixelX%, %PixelY%, RGB
; Compare the detected color with the target color
if (Color = TargetColor)
{
MsgBox, Target color detected! The color is being detected correctly.
Break ; Exit the loop
}
Sleep 1000 ; Adjust the sleep duration as needed
}