I am trying to automate egg collecting in a game. As you can see below in Part 1 of code I try to locate the egg which is working successfully however, once egg is found I need to click the creature who is holding the egg. I tried o do this in Part 2 of code which does not work at all. The part 2 code does not do anything.
Please help.
Code: Select all
Eggfound = 0
;PART 1
Loop, 100
{
ImageSearch, x, y, 81, 26, 1087, 456, *75 woodegg2.png
If (ErrorLevel = 0)
MsgBox, Egg Found
Eggfound = 1
break
}
;PART 2
If (Eggfound = 1)
{
Loop 100 {
ImageSearch, x2, y2, 81, 26, 1087, 456, *75 woodtree2.png
If (ErrorLevel = 0)
MsgBox, Tree Found
MouseMove, x2, y2, 50
Sleep, 300
Click
break
}
}