<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.atitd.org/wiki/t6w/index.php?action=history&amp;feed=atom&amp;title=User%3ACegaiel%2FMacros%2FWheat%2FCode</id>
	<title>User:Cegaiel/Macros/Wheat/Code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.atitd.org/wiki/t6w/index.php?action=history&amp;feed=atom&amp;title=User%3ACegaiel%2FMacros%2FWheat%2FCode"/>
	<link rel="alternate" type="text/html" href="http://www.atitd.org/wiki/t6w/index.php?title=User:Cegaiel/Macros/Wheat/Code&amp;action=history"/>
	<updated>2026-06-03T05:48:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>http://www.atitd.org/wiki/t6w/index.php?title=User:Cegaiel/Macros/Wheat/Code&amp;diff=149091&amp;oldid=prev</id>
		<title>Cegaiel: Created page with &quot;&lt;pre&gt; ;Ctrl+P to pause script (ie to click Water icon) and Ctrl+P again to resume ;The script moves fast, so it might be difficult for it to see the Ctrl+P ;The best time to Paus...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.atitd.org/wiki/t6w/index.php?title=User:Cegaiel/Macros/Wheat/Code&amp;diff=149091&amp;oldid=prev"/>
		<updated>2012-02-03T06:33:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; ;Ctrl+P to pause script (ie to click Water icon) and Ctrl+P again to resume ;The script moves fast, so it might be difficult for it to see the Ctrl+P ;The best time to Paus...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
;Ctrl+P to pause script (ie to click Water icon) and Ctrl+P again to resume&lt;br /&gt;
;The script moves fast, so it might be difficult for it to see the Ctrl+P&lt;br /&gt;
;The best time to Pause is during the 2s pause after each cycle&lt;br /&gt;
;The AHK icon in system tray will turn red while paused.&lt;br /&gt;
;Ctrl+R to reload script&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Author: Cegaiel&lt;br /&gt;
;Last Update: 10/25/2010&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IfWinExist eGenesis Client&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	WinGet, GameWinHandle, ID, eGenesis Client&lt;br /&gt;
	MineNum = 0&lt;br /&gt;
	MineCycle = 0&lt;br /&gt;
	NumPulls = 1000&lt;br /&gt;
	BedNum = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	Gui, +AlwaysOnTop +ToolWindow&lt;br /&gt;
	Gui, Font, bold&lt;br /&gt;
	Gui, Add, Text, vMineNumText, Step 1 of 2:  Middle click Water icon&lt;br /&gt;
	Gui, Font, norm&lt;br /&gt;
	Gui, Add, Text,,&lt;br /&gt;
	( LTrim&lt;br /&gt;
	Middle click (click mouse wheel) the Water icon to record its location&lt;br /&gt;
&lt;br /&gt;
	If the water icon is NOT showing, then:&lt;br /&gt;
&lt;br /&gt;
	Hit Esc, Skills, Empty ONE or ALL jugs&lt;br /&gt;
&lt;br /&gt;
	They will automatically be refilled next step&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	Now is a good time to pinup your plant wheat menu.&lt;br /&gt;
	It can be anywhere, as you will be manually planting them anyways.&lt;br /&gt;
&lt;br /&gt;
	)&lt;br /&gt;
	Gui, Show&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	loop&lt;br /&gt;
	{&lt;br /&gt;
			WinActivate, eGenesis Client&lt;br /&gt;
			WinWait, eGenesis Client&lt;br /&gt;
			WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos &lt;br /&gt;
&lt;br /&gt;
			;Get coordinates, for your resolutions'  X,Y location of the Max button on Water.&lt;br /&gt;
			MaxX := Floor(Xmax/2)&lt;br /&gt;
			MaxY := Floor(Ymax/2)+56&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		CoordMode, Mouse, Relative&lt;br /&gt;
		KeyWait, MButton, D&lt;br /&gt;
		KeyWait, MButton&lt;br /&gt;
		MouseGetPos, TestX, TestY, WinHandle&lt;br /&gt;
		if (WinHandle = GameWinHandle)&lt;br /&gt;
		{&lt;br /&gt;
&lt;br /&gt;
			Gosub, Record&lt;br /&gt;
		}&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			Gui, Destroy&lt;br /&gt;
			break&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	Record:&lt;br /&gt;
	MineNum++&lt;br /&gt;
	MouseGetPos, MineX%MineNum%, MineY%MineNum%&lt;br /&gt;
&lt;br /&gt;
	;MineNum1 will be the water icon location&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	if (MineNum = 1) {&lt;br /&gt;
&lt;br /&gt;
	Gui, Destroy&lt;br /&gt;
	Sleep 500&lt;br /&gt;
	Click %MineX1%, %MineY1%&lt;br /&gt;
	Sleep 500&lt;br /&gt;
	Click %MaxX%, %MaxY%&lt;br /&gt;
	Sleep 1000&lt;br /&gt;
&lt;br /&gt;
	Gui, +AlwaysOnTop +ToolWindow&lt;br /&gt;
	Gui, Font, bold&lt;br /&gt;
	Gui, Add, Text, vMineNumText, Step 2 of 2:  Manually plant, then Middle click Wheat Beds&lt;br /&gt;
	Gui, Font, norm&lt;br /&gt;
	Gui, Add, Text,,&lt;br /&gt;
	( LTrim&lt;br /&gt;
	Leave this window up and drag out of the way. Now start planting your wheat.&lt;br /&gt;
&lt;br /&gt;
	When done planting, quickly, hover and middle-click (Click mouse-wheel)&lt;br /&gt;
	on each wheat bed, one by one, until you've clicked on all the beds.&lt;br /&gt;
&lt;br /&gt;
	Then click the OK button.&lt;br /&gt;
&lt;br /&gt;
	)&lt;br /&gt;
	Gui, Add, Button, default gStart, OK&lt;br /&gt;
	Gui, Show&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	;MineNum2 is wheat bed 1, MineNum3 is wheat bed 2, etc&lt;br /&gt;
	} else	{&lt;br /&gt;
	BedNum ++&lt;br /&gt;
	GuiControl, Text, MineNumText, %BedNum% wheat beds captured&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	TotalBeds := BedNum&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	Start:&lt;br /&gt;
	Gui, Submit&lt;br /&gt;
	Gui, Destroy&lt;br /&gt;
	Gui, +AlwaysOnTop +ToolWindow&lt;br /&gt;
	Gui, Font, bold&lt;br /&gt;
	Gui, Add, Text, vMineCycleText, 5s countdown, drag window out of way of beds`n`n`n&lt;br /&gt;
	Gui, Font, norm&lt;br /&gt;
	Gui, Show&lt;br /&gt;
	GuiControl, Text, MineCycleText, 5s countdown, drag window out of way of beds`n`n`n&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	delay = 5&lt;br /&gt;
	;You got 5 seconds to drag the status window out of the way&lt;br /&gt;
	Loop, %delay%&lt;br /&gt;
	{&lt;br /&gt;
	GuiControl, Text, MineCycleText, %delay%s countdown, drag window out of way of beds&lt;br /&gt;
	delay --&lt;br /&gt;
	Sleep 1000&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	#Persistent &lt;br /&gt;
;	SetTimer, Water, 180000&lt;br /&gt;
;	SetTimer, Water, 10000&lt;br /&gt;
	SetTimer, Timer, 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		seconds = 0&lt;br /&gt;
		minutes = 0&lt;br /&gt;
		seconds_eta = 0&lt;br /&gt;
		minutes_eta = 3 &lt;br /&gt;
		SetDefaultMouseSpeed, 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	loop, %NumPulls%&lt;br /&gt;
	{&lt;br /&gt;
&lt;br /&gt;
	;MineNum1 is the water icon location &lt;br /&gt;
	;MineNum1 is only called during the Water: subroutine (#Persistent)&lt;br /&gt;
	;Thus why we are starting at MineNum2, the first wheat bed location.&lt;br /&gt;
&lt;br /&gt;
			WinActivate, eGenesis Client&lt;br /&gt;
			MineNum = 2&lt;br /&gt;
			BedNum = 1&lt;br /&gt;
			MineCycle++&lt;br /&gt;
			MouseGetPos, OldMX, OldMY&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	loop, %TotalBeds%&lt;br /&gt;
	{&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			;BlockInput, MouseMove&lt;br /&gt;
&lt;br /&gt;
			GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%   Sending H+W: Bed %BedNum%`n`nElapsed Time: %minutes%m %seconds%s`nGather Water in: %minutes_eta%m %seconds_eta%s&lt;br /&gt;
			MinePosX := MineX%MineNum%&lt;br /&gt;
			MinePosY := MineY%MineNum%&lt;br /&gt;
			MouseMove, %MinePosX%, %MinePosY%, 0&lt;br /&gt;
			Sleep, 100&lt;br /&gt;
			Send {H}&lt;br /&gt;
			Send {W}&lt;br /&gt;
			MineNum++&lt;br /&gt;
			BedNum ++&lt;br /&gt;
			Sleep, 100	&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			MouseMove, %OldMX%, %OldMY%, 0			&lt;br /&gt;
			GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%   PAUSE  (Ctrl+P, if needed)`n`nElapsed Time: %minutes%m %seconds%s`nGather Water in: %minutes_eta%m %seconds_eta%s&lt;br /&gt;
			;BlockInput, MouseMoveOff&lt;br /&gt;
				Sleep, 2000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	Gui, Destroy&lt;br /&gt;
	Gui, Add, Text,, Middle-click on this window to end the script.&lt;br /&gt;
	Gui, Show&lt;br /&gt;
	return&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	Water: &lt;br /&gt;
	GuiControl, Text, MineCycleText, Fetching Water...`n`nElapsed Time: %minutes%m %seconds%s`nGather Water in: Now!&lt;br /&gt;
	MouseGetPos, OldMX, OldMY&lt;br /&gt;
	;Click the water icon&lt;br /&gt;
	Click, %MineX1%, %MineY1%			&lt;br /&gt;
	Sleep, 750&lt;br /&gt;
&lt;br /&gt;
	;Click the Max button&lt;br /&gt;
	Click, %MaxX%, %MaxY%			&lt;br /&gt;
	Sleep, 750&lt;br /&gt;
	MouseMove, %OldMX%, %OldMY%, 0			&lt;br /&gt;
	minutes_eta = 3&lt;br /&gt;
	seconds_eta = 0&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		Timer:&lt;br /&gt;
		seconds ++&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		if (seconds = 60)&lt;br /&gt;
		{&lt;br /&gt;
		seconds := 0&lt;br /&gt;
		minutes ++&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if (seconds_eta = 0) and !(minutes_eta = 0)&lt;br /&gt;
		{&lt;br /&gt;
		seconds_eta := 60&lt;br /&gt;
		minutes_eta --&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if (minutes_eta &amp;lt; 0)&lt;br /&gt;
		minutes_eta := 0&lt;br /&gt;
&lt;br /&gt;
		seconds_eta --&lt;br /&gt;
&lt;br /&gt;
		if (minutes_eta = 0) &amp;amp; (seconds_eta = 0)&lt;br /&gt;
		Gosub, Water&lt;br /&gt;
&lt;br /&gt;
		return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
^r::reload&lt;br /&gt;
^p::Pause&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cegaiel</name></author>
	</entry>
</feed>