I just learned the AHK today reading posts and tutorials, And I made an Macro to catch some fishes. I want it to look for an Image inside a image, while the light might be changing. Idea is:
There are two differrent actions - splashes on the water. 1. is tug, not important, 2. is pull very important. After a pull i wish it to click once to catch fish. Then wait few seconds - I wish it to variable. And then pull the line with the fish for about 10-15 seconds(variable). I want it to be quite variable in the meaning of sleep times - it would be not found by the server as a macro. So far I made it a quite working, but I get some issues - sometimes its not detecting/pulling fish even if it caught one. Could someone check my code and tell me If I made it correctly? The picture that is used is
i67.tinypic.com*23sbx48.png
Code: Select all
global pull_x
global pull_y
ToolTip, Throw Fishing rod keeping it for 3 seconds, move cursor over floater, press F5, 20, 20,
insert::
Loop,
{
ImageSearch, OutputVarX, OutputVarY, pull_x-200, pull_y-200, pull_x+200, pull_y+200, *70 pull.png
If(ErrorLevel == 0){
tooltip, Got a fish!`, 20, 20,
Click,
sleep 2000
Click down,
tooltip, Pulling!, 20, 20,
sleep 6000
tooltip, She is tough!, 20, 20,
Click up,
tooltip, Got Her!, 20, 20,
sleep 2000
Click down,
ToolTip, Throwing bait!, 20, 20,
sleep 3000
click up,
return,
}If(ErrorLevel == 1){
tooltip, Fishing`, 20, 20,
sleep 100
}If(ErrorLevel == 2){
ToolTip, Error!`, 20, 20,
Sleep 2000
}
}
Return
BS::
exitapp
F5::
ToolTip
ToolTip, Make sure your rod is out and you are not touching mouse, and the cursor is hidden`, Press Insert to start, 20, 20,
TrayTip,, Make sure your rod is out and you are not touching mouse, and the cursor is hidden`, Press Insert to start, 20, 20,
MouseGetPos, pull_x, pull_y
Return