All pastes #272247 Raw Edit

Someone

public text v1 · immutable
·published 2006-12-08 21:23 UTC
rendered paste body


ImageSearch, FX, FY, 70, 120, 1215, 785, *100 f3.bmp 
;^^^ Ideally this one command would search for 4 different images at once.  The only way I know how to do this now is to have 4 identical image search commands (with all the other code they entail), one for each image searched.

if ErrorLevel = 0
{
	MouseClick, left, FX, FY
	Sleep 5000
	MouseClick, left, 1102, 696 ;Lock
	Sleep 200
	Mouseclick, left, 521, 676 ;Placement
	Sleep 400
	MouseClick, left, 1108, 742 ;Ready

;This is one of the first big sticking points.  Here should be the following command:
;	PixelGetColor, 0x0066FF, 750, 820
;	if ErrorLevel = 0
;It must loop over and over until ErrorLevel = 0 becomes True.
;Only when it's confirmed that a 0x0066FF color pixel is at that location should the rest of the script proceed.



	MouseMove, 932, 887 
	Sleep, 200
	MouseClick, left, 932, 887
	Sleep, 500
	MouseClick, left, 640, 652 
	Sleep, 500
	MouseMove, 825, 936 
	Sleep, 200
	MouseClick, left, 825, 936 
	Sleep 500

;When testing the script I have yet to get to the Loop I've written below to see if it will even work!
;The biggest question I have is that this Loop must repeat until AHK is unable to find any more 0xFF0000 pixels in the rectangle I specify.
;When that happens, the loop must terminate and a new set of commands (the Sleep/Send Enter ones) begin.

	Loop
	{
	PixelGetColor, 0x0066FF, 750, 820
	if ErrorLevel = 0

;^^^ Once again, I need to set this so the Loop continues only when ErrorLevel = 0 is reached and not before.
;Currently in this case as in the one above the moment the color can't be found the script "ends".

	{
		PixelSearch PX, PY, 200, 760, 1090, 328, 0xFF0000, 3, Fast
		if ErrorLevel = 0
		{
			MouseMove, 887, 881 ;Coins
			Sleep 100
			MouseClick, left, 887, 881 ;Coins
			Sleep 100
			MouseMove, PX, PY ;Coins
			Sleep 100
			MouseClick, left, PX, PY ;Coins
			Sleep 900				
			MouseMove, 887, 881 ;Coins
			Sleep 100
			MouseClick, left, 887, 881 ;Coins
			Sleep 100
			MouseMove, PX, PY ;Coins
			Sleep 100
			MouseClick, left, PX, PY ;Coins
			Sleep 900
		
			MouseMove, 887, 881 ;Coins
			Sleep 100
			MouseClick, left, 887, 881 ;Coins
			Sleep 100
			MouseMove, PX, PY ;Coins
			Sleep 100
			MouseClick, left, PX, PY ;Coins
			Sleep 900

			MouseMove, 825, 936 ;End turn
			Sleep 100
			MouseClick, left, 825, 936 ;End turn
			Sleep 500
		}
	if ErrorLevel = 1
		MouseClick, left, 825, 936
		Sleep 200
	}
	}
}

Sleep 300
Send {ENTER}
Sleep 500
Send {ENTER}
Sleep 500
Send {ENTER}

	PixelGetColor, 0x000B3, 736, 805
	if ErrorLevel = 1
	{
		MouseMove, 978, 881
		Click 2
	}
}


Pause::Pause
Insert::Reload