Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetControlDelay -1
- #InstallKeybdHook
- CoordMode Pixel, Screen
- ; fish area needs to be visible (that is to say not minimized or covered by another window) but not necessarily selected or active (it can be)
- ; be very careful that the Fish_File_Name matches and that it's in the same folder as the script
- ; make sure that when you take the screenshot you're in low quality mode
- Fish_File_Name := "UniqueSnippetOfTheFishInLowQualityMode.png"
- f9:: ; press f9 with your game selected for the script to know where to look
- WinGet, actWin, ID, A
- loop {
- WinGetPos X_Offset, Y_Offset, Width, Height, ahk_id %actWin%
- ImageSearch X, Y, X_Offset, Y_Offset, Width + X_Offset, Height + Y_Offset, *30 %Fish_File_Name%
- if ErrorLevel = 0
- ControlClick % "x" X - X_Offset " y" Y - Y_Offset, ahk_id %actWin%,,,, NA
- sleep 10000
- }
- f10:: reload ; f10 to stop
- ; for troubleshooting purposes:
- f8:: ; press f8 with your game selected to test if it can find the fish without clicking on it
- WinGet, actWin, ID, A
- WinGetPos X_Offset, Y_Offset, Width, Height, ahk_id %actWin%
- ImageSearch X, Y, X_Offset, Y_Offset, Width + X_Offset, Height + Y_Offset, *30 %Fish_File_Name%
- if ErrorLevel = 0
- {
- MouseMove X - X_Offset, Y - Y_Offset, 0
- MsgBox Fish Found
- }
- else
- MsgBox X:%X% Y:%Y% ErrorLevel:%ErrorLevel% actWin:%actWin% X_Offset:%X_Offset% Y_Offset:%Y_Offset%
- return
- ; if ErrorLevel is 1 when there's a fish on screen it means it was too different from the screenshot
- ; if ErrorLevel is 2 it means it couldn't find the screenshot file
- ; if ErrorLevel is 0 and it's moused over something other then the fish it means the allowed variation (*30 by default) is too high and/or the dimensions of the screenshot are too small
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement