Having issues with my Loop command?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
joedithas
Posts: 3
Joined: 22 May 2018, 00:12

Having issues with my Loop command?

22 May 2018, 00:17

Why is my code broke? It all works, except for the loop :'(

Code: Select all

Escape::
Reload

0:: 

Loop, 120
{
	sleep, 1000
			;Left click on bank
	Random, a, 803,754
	Random, b, 513,545
	send {Click, Left, %a%, %b%} 
	
	Random, ab, 950,1250
	sleep, ab
	  
			;right click on inventory
	Random, c, 1418,1405
	Random, d, 616,623
	send {Click, right, %c%, %d%}
	
	Random, bb, 950,1250
	sleep, bb
	
			;empty inventory
	Random, a, 1435,1448
	Random, b, 716,720
	send {Click, Left, %a%, %b%} 
	
	Random, bd, 950,1250
	Sleep bd
	  
		; Right click on upper left item
	Random, c, 494,512
	Random, d, 114,125
	send {Click, right, %c%, %d%}
	
	Random, bc, 950,1250
	sleep, bc
	
		;Withdraw all
	Random, e, 524,500
	Random, f, 223,235
	send {Click, Left, %e%, %f%}
	
	Random, cd, 950,1250
	sleep, cd
	
		;left click on map
	Random, g, 1541,1540
	Random, h, 44,55
	send {Click, Left, %g%, %h%}
	
	Random, de, 9500,10250
	sleep, de
	
		;left click on stairs
	Random, i, 867,899
	Random, j, 463,491
	send {Click, Left, %i%, %j%}
	
	random, dd, 2500,3000
	sleep, dd
	
		PixelSearch ,PX,PY,610,840,644,888,0x596961,1,Fast   ;-- search between upper left 0,0 >> lower right X=100 Y=100
if ErrorLevel

    Gosub Phase2
	
else
	Gosub Phase3
	
return 

	phase2:
	
			;left click spindle
	Random, K, 521,540
	Random, L, 700,720
	send {Click, %K%, %L%}
	
	Random, zy, 8250, 8850
	sleep, zy
	
			;left click bow string
	Random, Q, 167,214
	Random, R, 792,846
	send {Click, %Q%, %R%}
	
	gosub phase4
	
return
	
	phase3: 
	
			;left click door
	Random, M, 615,625
	Random, N, 878,892
	send {Click, %M%, %N%}
	
	Random, zx, 5250, 5850
	sleep, zx
	
			;left click spindle
	Random, O, 655,665
	Random, P, 364,390
	send {Click, %O%, %P%}
	
	Random, xz, 4250, 4850
	sleep, xz
	
			;left click bow string
	Random, S, 167,214
	Random, T, 792,846
	send {Click, %S%, %T%}
	
	Gosub phase4
	
return
	
	phase4:
	sleep 54500
	
			;Right Click on stairs
	Random, U, 1103,1120
	Random, V, 116,125
	send {Click, Right, %U%, %V%}
	
	random, uu, 500,800
	sleep, uu
	
			;left click on 'go up stairs'
	Random, W, 1092,1110
	Random, X, 160,165
	send {Click, %W%, %X%}
	
	random, ui, 7750,8500
	sleep, ui
	
			;left click on map
	Click, 1500, 158
	random, uv, 8250, 9000
	sleep uv
	
return
	
}

return
	

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, mmflume, OrangeCat and 82 guests