Code: Select all
#SingleInstance
#MaxThreadsPerHotkey 2
#NoEnv
SendMode Event
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CoordMode, mouse, Screen
isFishing := False
F6::
isFishing := true
MouseMove ButtonX, ButtonY
startFishing()
return
F7::
isFishing := false
return
^!z::
MouseGetPos, LureX, LureY
PixelGetColor, color, %LureX%, %LureY%, RGB
CaX1 := (LureX - 1)
CaY1 := (LureY - 1)
CaX2 := (LureX + 1)
CaY2 := (LureY + 1)
return
^!x::
MouseGetPos, ButtonX, ButtonY
return
startFishing() {
global
While isFishing {
MouseMove ButtonX, ButtonY
clickHook()
sleep 5000
}
}
clickHook() {
global
local pX = 0
local pY = 0
While isFishing {
PixelSearch, pX, pY, CaX1, CaY1, CaX2, CaY2, color, 2, Fast RGB
if !ErrorLevel {
sleep 50
} else {
MouseMove ButtonX, ButtonY
Send, {LButton down}
Sleep 150
Send, {LButton up}
break
}
}
}
F1::Suspend ;A precaution to break from loops during testing or some other reason.