The Wiki for Tale 4 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

User:Cegaiel/Macros/Barley/Code

From A Tale in the Desert
< User:Cegaiel‎ | Macros‎ | Barley
Revision as of 02:54, 2 February 2010 by Cegaiel (talk | contribs)
Jump to navigationJump to search
;Barley Macro written for http://www.autohotkey.com, 1280x1024 resolution, pin window in the upper left corner of the screen. 

;Have 59 Grain Fertilizer and 59 jugs of water, in inventory, each time you start this script

; Barley - 1280x1024 resolution
; Ctrl+Alt+W



^r::reload
^p::Pause
^!w::


IfWinExist eGenesis Client
{
	WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos
	SetDefaultMouseSpeed, 1
	interval = 1200
	


;Check to see if we are in the correct resolution, or else exit script
if (Xmax = 1288) && (Ymax = 1002)
{
nothing = 0
} else {
Msgbox, You are not in 1280x1024 resolution`n`nExiting...
EXIT
}





;Now Zoom in all the way with F8
	WinActivate, eGenesis Client
	Sleep 1000
	Send {F5}{F8}{F8}
	MouseMove, 0,0
	Sleep 5000
	MouseMove, 0, 0
	Sleep 5000

	Xcenter := Xmax//2 - 3
	Ycenter := Ymax//2 + 16
	MouseMove, Xcenter, Ycenter, 0



	; Zoom out a little
	Loop, 8
	{
		MouseClick, WD
		sleep 250
	}


Msgbox, Screen adjusted, hit OK when you are ready to continue...

	Loop, 100
	{
		mousex := Xmax//2 - 3
		mousey := Ymax//2 + 16
		incx = 70
		incy = 70
		rows = 0
		Loop, 2 ; columns of barley
		{
			bug = 0
			Loop, 4 ; rows of barley
			{
				if (Mod(rows, 2) = 0) ; plant left to right
				{
					MouseMove, 30, 45
					sleep 100
					MouseClick, Left ; Plant
					sleep 100
					MouseMove, mousex + incx, mousey
					sleep 100
					MouseClick, Left
					sleep interval
				}
				else ; plant right to left
				{
					MouseMove, 30, 45
					sleep 100
					MouseClick, Left ; Plant
					sleep 100
					MouseMove, mousex - incx, mousey
					sleep 100	
					MouseClick, Left
					sleep interval
				}
			}
			MouseMove, 30, 45
			sleep 100
			MouseClick, Left ; Plant
			sleep 100
			MouseMove, mousex, mousey + incy
			sleep 100
			MouseClick, Left
			sleep interval	
			rows++
		}	
		; Begin watering and fertalizing
		water = 0
		count = 0
		Loop, 6
		{
			mousex = 640
			mousey = 375
			intx = 0
			inty = 0
			Loop, 2
			{
				Loop, 5
				{
					if (count = 0) ; water and fert twice
					{
						MouseMove, mousex + intx, mousey + inty
						sleep 300
						MouseClick, Left
						sleep 300
						MouseMove, mousex + intx + 189, mousey + inty + 23
						sleep 100
						MouseClick, Left
						sleep 100
						MouseMove,  mousex + intx + 189, mousey + inty + 23
						sleep 100
						MouseClick, Left
						sleep 100
						MouseMove, mousex + intx + 189, mousey + inty + 46
						sleep 100
						MouseClick, Left
						sleep 100
						MouseMove, mousex + intx + 189, mousey + inty + 46
						sleep 100
						MouseClick, left
						sleep 200
						SendInput {ESC}
						sleep 300
						intx += 70	
					}
					else if (count = 5) ; harvest
					{
						MouseMove, mousex + intx, mousey + inty
						sleep 300
						MouseClick, Left
						sleep 300
						MouseMove, mousex + intx + 106, mousey + inty + 86
						sleep 100
						MouseClick, Left
						sleep 200
						SendInput {ESC}
						sleep 300
						intx += 70
					}
					else ; water and fert once
					{
						MouseMove, mousex + intx, mousey + inty
						sleep 300
						MouseClick, Left
						sleep 300
						MouseMove, mousex + intx + 189, mousey + inty + 23
						sleep 100
						MouseClick, Left
						sleep 100
						MouseMove, mousex + intx + 189, mousey + inty + 46
						sleep 100
						MouseClick, left
						sleep 200
						SendInput {ESC}
						sleep 300
						intx += 70	
					}
				}
				mousex = 640
				intx = 0
				inty += 90
			}
			count++


			sleep 5000
		}

		EXIT


		;PixelSearch, PX, PY, 965, 702, 965, 704, 0x000000, Fast
		;if (ErrorLevel < 1)
		;{
			;MouseClick, Left, 965, 703
			;return
		;}	
	}
}