"Else without any matching IF" imagesearch error Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Swoon

"Else without any matching IF" imagesearch error  Topic is solved

01 Mar 2018, 16:13

My first attempt at a script. A small bot to automate a simple proccess for me in a game.
I had it working, and decided to slightly improve it by moving some of the delays around, and adding a second image search to it.
After doing this, I got a "Else with no matching if" error when launching.

Found this odd as I did not touch any of the code related to that imagesearch, only copy and paste it to another part of the code (Making it search for two images instead of one), yet the copied part does not get the same error.

Keep in mind this is my first script, and I barely understand any of the language, please be simple :D

https://gyazo.com/bc06c03b01d7bbeec578e141fbeafdb5 <- Error

Code: Select all

F2::
stop = 0
Loop
{
	Start:
	  If stop = 1
      Break
	CoordMode, Mouse, Screen
		Mousemove, 1760, 43
	Sleep, 100
	MouseClick, left
	Sleep, 600
		Mousemove, 1709, 1017
	Sleep, 100
	MouseClick, left
	sleep, 500
		Mousemove, 1744, 838
	Sleep, 100
	MouseClick, left
	sleep, 1500
		Mousemove, 260, 937
	Sleep, 100
	MouseClick, left
	sleep, 5000
		Mousemove, 1000, 744
	Sleep, 100
	MouseClick, right
	sleep, 100
		Mousemove, 1000, 774
	Sleep, 100
	MouseClick, left
		Send, {f4}
CoordMode Pixel						;Search for full inventory
ImageSearch, , , 0, 950, 311, 1095, C:\Users\Christian\Desktop\pkhonor script\Image2.png
if ErrorLevel = 2
    Goto, Start
else if ErrorLevel = 1
	Goto, Chop
else
	Goto, Bank
CoordMode Pixel						;Search for full inventory
ImageSearch, , , 0, 950, 311, 1095, C:\Users\Christian\Desktop\pkhonor script\Image.png
if ErrorLevel = 2
    Goto, Start
else if ErrorLevel = 1
	Chop:
    Sleep, 15000							;Sleep while chopping wood
		Mousemove, 880, 510
	sleep 150
	MouseClick, right
	sleep 150
		Mousemove, 884, 540
else
Bank:
		Send, {f7}
	sleep, 100
    Mousemove, 1744, 838					;Bank items
Sleep, 100
MouseClick, left
sleep, 1500
		Mousemove, 260, 937
	Sleep, 100
	MouseClick, left
	Sleep, 5000
		Mousemove, 963, 427
	Sleep, 100
	MouseClick, left
	Sleep, 3000
		Mousemove, 1800, 873
	Sleep, 100
	MouseClick, right
	sleep, 100
		Mousemove, 1800, 977
	sleep, 200
	MouseClick, left
	Sleep, 400
		Mousemove, 1087, 323
	sleep, 100
	MouseClick, left
	sleep 1000
		Send, {f4}
}
	Return
	
{	
Space::
stop:=!stop
return
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 351 guests