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:Daniels/Macros/Barley

From A Tale in the Desert
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. 
;Double F8, and zoom all the way in before starting the macro.  To start the macro, press alt+shift+y:

; The following should stop runaway macros
; ctrl-alt-p and ctrl-alt-r
^!p::Pause
^!r::Reload

; Barley - 1280x1024 resolution
; alt-shift-y
!+y::
IfWinExist eGenesis Client
{
	WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos
	SetDefaultMouseSpeed, 2
	interval = 1200


;Begin update by Ceg

;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

;End update by Ceg

	
	; Zoom out a little
	Loop, 8
	{
		MouseClick, WD
		sleep 200
	}
	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 100
						MouseClick, Left
						sleep 100
						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 100
						SendInput {ESC}
						sleep 100
						intx += 70	
					}
					else if (count = 5) ; harvest
					{
						MouseMove, mousex + intx, mousey + inty
						sleep 100
						MouseClick, Left
						sleep 100
						MouseMove, mousex + intx + 106, mousey + inty + 86
						sleep 100
						MouseClick, Left
						sleep 100
						SendInput {ESC}
						sleep 100
						intx += 70
					}
					else ; water and fert once
					{
						MouseMove, mousex + intx, mousey + inty
						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
						SendInput {ESC}
						sleep 100
						intx += 70	
					}
				}
				mousex = 640
				intx = 0
				inty += 90
			}
			count++
			water++ ; Refill jugs from aquaduct 
			;if (water = 1)
			;{
			;	MouseClick, Left, 500, 45, 1
			;	sleep 1000
			;	MouseClick, Left, 125, 50, 1
			;	sleep 1000
			;	MouseClick, Left, 125, 125, 1
			;	water = 0
			;}
			sleep 2000
		}
		MouseMove, 640, 375
		sleep 100
		MouseClick, Left 
		sleep 3000
		PixelSearch, PX, PY, 965, 702, 965, 704, 0x000000, Fast
		if (ErrorLevel < 1)
		{
			;MouseClick, Left, 965, 703
			return
		}	
	}
}