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/Flax

From A Tale in the Desert
Jump to navigationJump to search
#SingleInstance force

;Ctrl+Alt+W to start script
;Plant a 3,4,5 x 3,4,5 bed, wait about 10 seconds, then move and plant
;another set of beds. Soons as it gets done, run back to your first set to weed.
;By the time you weed your first set, its time for the 2nd.


^r::reload
; Reload the script when you make changes
reload
return

!s::
suspend toggle
return

!q::
ExitApp
return

^!w::
InitGui()
return

ButtonFLAX:
Gui, Submit
; Validate input


if (dimension > 5) {
	MsgBox "Make sure your number of objects setting is maxed in video options"
}

Gui, Destroy


Flax()
return


InitGui()
{
	;global cycles
	global weedings
	global dimension


	Gui, Add, Text,, Plot dimensions (NxN):
	Gui, Add, DropDownList, vdimension Choose1a, 3|4|5
	Gui, Add, Text,, Screen set and locked from previous flaxing?`nNo = Automatically zoom in to correct position.`nYes = Skip this step.

	Gui, Add, DropDownList, vLocked Choose1, Yes|No

	Gui, Add, Button, Default, FLAX
	Gui, Show
}

Flax()
{

	global Xcenter
	global Ycenter
	global width
	global cycles
	global dimension
	global Locked	


	if (Locked == "No")
	{
	message := "Please close your friends list and minimize chat and stat tabs in order to ensure proper macroage.`n"
	message .= "Also disable camera moves very fast and camera moves unreasonably fast.`n`n"
	message .= "Pin the plant menu at the very top left corner of the screen`n`n"
	message .= "IN CASE OF EMERGENCY: HIT ALT-Q"
	MsgBox,,, %message%, 5
	}

	; Wait for the window to become active, then get the window stats
	WinWait, eGenesis Client, 
	IfWinNotActive, eGenesis Client, , WinActivate, eGenesis Client, 
	WinWaitActive, eGenesis Client,
	WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos

	if (Locked == "No")
	{
	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


	if (Locked == "No")
	{

	Loop 9 {
		MouseClick, WheelDown
		Sleep 1000
	}

	}



	;Flax beds are ~55 coords wide at this zoom level
	width := 55




Loop 1
{
	Sleep 500
	i = 0
	Loop {	
		i += 1
		Plant_Row("right", dimension)
		Move("down")
		if (i >= dimension)
			break

		i += 1
		Plant_Row("left", dimension)
		Move("down")
		if (i >= dimension)
			break
	}




	Sleep 1000
	Move("left", half_dim)
	Move("up", half_dim)

	Locked = "Yes"
; end of cycle loop
}
; end of function
}
























Move(direction, count = 1) {
	global width
	global Xcenter
	global Ycenter

	distance := width * count
	time := 650 * count
	MouseMove, Xcenter, Ycenter, 0

	if (direction == "right") {
		MouseClick,, distance, 0,, 0,, R
	} else if (direction == "left") {
		MouseClick,, -(distance), 0,, 0,, R
	} else if (direction == "down") {
		MouseClick,, 0, distance,, 0,, R
	} else if (direction == "up") {
		MouseClick,, 0, -(distance),, 0,, R
	}
	Sleep %time%
}
	

Plant_Row(direction, num)
{

;Look at 40,40 to see if the pinup menu is there. If you pinup menu is not at 40,40, then adjust...


	PixelSearch, Px, Py, 40, 40, 40, 40, 0xF2EBD3, 50, Fast|RGB
	if ErrorLevel = 0
	{
	MouseClick,, 40, 40,, 0
	if (num <= 0) {
		return
	}
	num -= 1
	Loop %num% {
		Move(direction)
		MouseClick,, 40, 40,, 0
	}

} else {
Msgbox, Plant menu, pinned in upper left corner, not found!`n`nExiting script. Restart script with Ctrl+Alt+W after you pin up the menu!
Exit
}

	return
}


^p::Pause