This is my first attempt at writing my own script... thanks for the help.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance Force
;GUI Layout
;-----------------------------------------------------------
Gui,show, w400 h325, Valhalla's clicker
Gui, font, cwhite
Gui, Color, Black
Gui, add, button, x65 y25 w100 h50 gcheck, 2 items
Gui, add, button, x235 y25 w100 h50, 3 items
Gui, add, button, x150 y100 w100 h35 grl1, First
Gui, add, button, x150 y145 w100 h35 grl2, Second
Gui, add, button, x150 y190 w100 h35 grl3, Third(opt)
Gui, add, button, x150 y235 w100 h35 gdrop, Last(opt)
return
;Labels
;-----------------------------------------------------------
rl1:
ToolTip, click first
KeyWait, LButton, D
MouseGetPos, X1, Y1
PixelGetColor R1, %MouseX1%, %MouseY1%
KeyWait, LButton, U
ToolTip
return
rl2:
ToolTip, click second
KeyWait, LButton, D
MouseGetPos, X2, Y2
PixelGetColor R2, %MouseX2%, %MouseY2%
KeyWait, LButton, U
ToolTip
return
rl3:
ToolTip, click third
KeyWait, LButton, D
MouseGetPos, X3, Y3
PixelGetColor R3, %MouseX3%, %MouseY3%
KeyWait, LButton, U
ToolTip
return
Check:
MsgBox, X1: %X1% Y1: %Y1% X2: %X2% Y2: %Y2% X3: %X3% Y3: %Y3%
return
Drop:
ToolTip, Click Last
KeyWait, LButton, D
MouseGetPos, X4, Y4
PixelGetColor DropColor, %MouseX4%, %MouseY4%
KeyWait, LButton, U
ToolTip
return
;Functions
;------------------------------------------------------------
click_InsideCircle(x,y,r) {
Random, radius, 0, r
Random, angle, 0, 6.283185307179586476925286766559 ; 2*Pi = 360°
x += Cos(angle)*radius
y += Sin(angle)*radius
Click %x%, %y%
}
;Hotkeys
;------------------------------------------------------------
^x::ExitApp
t::
MsgBox, RUNNING!
loop { ;MASTER LOOP
loop{ ;CHECK1
PixelGetColor, R1C, %MouseX1%, %MouseY1%
Sleep, 50
}until, %R1%=%R1C%
Random, rand, 200, 1200
Sleep, %rand%
click_insidecircle(x1,y1,10)
Loop{ ; CHECK2
PixelGetColor, R1C, %MouseX1%, %MouseY1%
Sleep, 50
}until %R1%!=%R1C%
loop{ ;CHECK3
PixelGetColor, R2C, %MouseX2%, %MouseY2%
Sleep, 50
}until, %R2%=%R2C%
Random, rand, 200, 1200
sleep %rand%
click_insidecircle(x2,y2,10)
Loop{ ; CHECK4
PixelGetColor, R2C, %MouseX2%, %MouseY2%
Sleep, 50
}until %R2%!=%R2C%
PixelGetColor, DropColor2, %MouseX4%, %MouseY4%
} until DropColor != DropColor2