Having trouble blocking this script properly

Ask gaming related questions (AHK v1.1 and older)
DinoDoom
Posts: 1
Joined: 16 Jul 2017, 23:09

Having trouble blocking this script properly

16 Jul 2017, 23:52

I've been trying for hours to get this script to work but I can't quite figure it out, I feel like it's almost done but I can't quite get it to behave properly which I'm pretty sure is because I've done the blocks wrong, any help is greatly appreciated thanks!

What I'm trying to do is ImageSearch the same area for 4 different things repeatedly and interact with them until none of them are found, there may be multiples of each image on screen at any given time, this is why I have it loop 45 times and what I use NoneFound so I can cancel the loop early if it's not finding anything new.

Code: Select all

F5::
ToolTip, Debug1
NoneFound = 0
Loop, 45
	{
	ToolTip, Debug2
		if (NoneFound = 1)
		break
		ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *35 C:\Boot.png
		if ErrorLevel = 0
			{
				Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Down}
				Sleep, 25
				Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Up}
				Sleep, 90
				Click 875, 565
			}
			else {
			ToolTip, Debug3
				ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *35 C:\Fish1.png
					if ErrorLevel = 0
					{
						Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Down}
						Sleep, 25
						Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Up}
						Sleep, 90
						Click 875, 565
					}
					}
					else {
						ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *35 C:\Fish2.png
							if ErrorLevel = 0
							{
								Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Down}
								Sleep, 25
								Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Up}
								Sleep, 90
								Click 875, 565
							}
							}
							else {
								ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *35 C:\Fish3.png
									if Errorlevel = 0
									{
										Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Down}
										Sleep, 25
										Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Up}
										Sleep, 90
										Click 875, 565
									}
									}
									else {
										ImageSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *35 C:\Fish4.png
											if Errorlevel = 0
											{
												Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Down}
												Sleep, 25
												Send, {Click, %OutputVarX%, %OutputVarY%, Middle, Up}
												Sleep, 90
												Click 875, 565
											}
											}
										else
										NoneFound = 1
		}
		ToolTip, DebugDone
I'm not 100% sure what's happening but it's spamming clicks when it finds the image like 4 times.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 67 guests