Help with script

Ask gaming related questions (AHK v1.1 and older)
PeaceAlways
Posts: 3
Joined: 16 Oct 2021, 14:04

Help with script

16 Oct 2021, 14:13

Hi Guys, I am new to AHK and really consfused on how to make my code working.

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
}

}
User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Help with script

16 Oct 2021, 16:24

After every variable assignment, display the variable's value. After every image search, display the ErrorLevel. With every "If", display the result of your conditional statement. You will then be able to pinpoint the problem within about five minutes of testing.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 69 guests