Skip to content

Instantly share code, notes, and snippets.

@BigMichi1
Last active December 18, 2022 12:05
Show Gist options
  • Save BigMichi1/a0b2da2875d860925180326b815a6e93 to your computer and use it in GitHub Desktop.
Save BigMichi1/a0b2da2875d860925180326b815a6e93 to your computer and use it in GitHub Desktop.
Coloring Game auto painter script for AutoHotkey (https://www.autohotkey.com/). Initial version by ShoxDanger (https://www.youtube.com/watch?v=szig4ake4xA). Auto Find the color on screen and move mouse and click when color not there picks a new one till all colors on screen are gone. When all colors are gone move screen
; |-------------------------------|
; | Script made by ShoxDanger |
; | extended by BigMichi1 |
; | if used give credit please |
; |-------------------------------|
;Description Script
;Auto Find the color on screen and move mouse and click
;when color not there picks a new one till all colors on screen are gone
;when all colors are gone move scree
#NoEnv
#Warn All
#SingleInstance, force
#MaxThreadsPerHotkey 2
SetBatchLines, -1
SetBatchLines, 1000
CoordMode, pixel, Relative
CoordMode, Mouse, Relative
Col:= 0x9C9A9A ;Color active square
Col2:= 0xC6C6C4 ;Color not active square
Toggle:= False
Gui,show, w300 h100, Auto Color
gui, add, text,, Reload app press: CTRL + R
return
^r::
Reload
return
Numpad0:: ;Hotkey Start
Toggle := !Toggle
moveDown := True
moveRight := False
moveUp := False
loop {
if Toggle {
PixelSearch, ax, ay, 128, 50, 1460, 1030, %col%, 0, RGB fast
if (!errorlevel) {
MouseMove, %ax%+1, %ay%, 0,
click
} else {
PixelSearch, ax, ay, 128, 50, 1460, 1030, %col2%, 0, RGB fast
MouseMove, %ax%, %ay%, 0,
send, {click right}
sleep,500
}
if(errorlevel) {
if(moveRight && moveDown) {
MoveRight()
moveRight := False
moveUp := True
moveDown := False
ende := AreWeDone(col, col2)
if(ende) {
break
}
continue
}
if(moveRight && moveUp) {
MoveRight()
moveRight := False
moveUp := False
moveDown := True
ende := AreWeDone(col, col2)
if(ende) {
break
}
continue
}
if(moveDown) {
MoveDown()
noUnpaintedFound := NoUnpaintedSquaresFound(col, col2)
if (noUnpaintedFound) {
moveDown := True
moveRight := True
moveUp := False
continue
}
}
if(moveUp) {
MoveUp()
noUnpaintedFound := NoUnpaintedSquaresFound(col, col2)
if (noUnpaintedFound) {
moveUp := True
moveRight := True
moveDown := False
continue
}
}
}
if not Toggle
break
}
}
return
guiclose:
ExitApp
^Esc::
ExitApp
MoveDown() {
SendInput {LCtrl down}
Sleep 100
SendInput {NumpadDown}
Sleep 100
SendInput {LCtrl up}
Sleep 100
}
MoveUp() {
SendInput {LCtrl down}
Sleep 100
SendInput {NumpadUp}
Sleep 100
SendInput {LCtrl up}
Sleep 100
}
MoveRight() {
SendInput {LCtrl down}
Sleep 100
SendInput {NumpadRight}
Sleep 100
SendInput {LCtrl up}
Sleep 100
}
AreWeDone(col, col2) {
noUnpainted := NoUnpaintedSquaresFound(col, col2)
if (noUnpainted) {
MsgBox, All done we stop know !
return True
}
return False
}
NoUnpaintedSquaresFound(col, col2) {
PixelSearch, dx, dy, 128, 50, 1460, 1030, %col%, 0, RGB fast ; selected
if (errorlevel) {
PixelSearch, dx, dy, 128, 50, 1460, 1030, %col2%, 0, RGB fast ; not painted
if (errorlevel) {
return True
}
}
return False
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment