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.

Difference between revisions of "User:Cegaiel/Macros/Wheat/Code"

From A Tale in the Desert
Jump to navigationJump to search
Line 2: Line 2:
 
;Ctrl+Alt+W to start macro.
 
;Ctrl+Alt+W to start macro.
 
;Ctrl+P to pause script (ie to click Water icon) and Ctrl+P again to resume
 
;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 Pause is during the 2s pause after each cycle
 
;The AHK icon in system tray will turn red while paused.
 
;The AHK icon in system tray will turn red while paused.
 
;Ctrl+R to reload script
 
;Ctrl+R to reload script
Line 13: Line 15:
 
IfWinExist eGenesis Client
 
IfWinExist eGenesis Client
 
{
 
{
WinActivate
+
 
 +
WinGet, GameWinHandle, ID, eGenesis Client
 +
MineNum = 0
 +
MineCycle = 0
 +
NumPulls = 1000
 +
BedNum = 0
 +
 
  
 
Gui, +AlwaysOnTop +ToolWindow
 
Gui, +AlwaysOnTop +ToolWindow
 
Gui, Font, bold
 
Gui, Font, bold
Gui, Add, Text, vMineNumText, Middle click water icon
+
Gui, Font, underline
 +
Gui, Add, Text, vMineNumText, Step 1:  Middle click Water icon
 
Gui, Font, norm
 
Gui, Font, norm
 
Gui, Add, Text,,
 
Gui, Add, Text,,
 
( LTrim
 
( LTrim
Hover and middle-click (Click mouse-wheel) on each wheat bed, one by one,
+
Middle click (click mouse wheel) the Water icon to record its location
until you've clicked on all the beds you want to use. Then click the OK button.
+
 
(Drag this box out of the way if any beds are hidden)
+
If the water icon is NOT showing, then:
 +
 
 +
Hit Esc, Skills, Empty jugs, Empty one or all jugs
 +
 
 +
Step 2 will click the icon to bring up the menu
 +
so you can record the Max button. Your jugs will be refilled, too.
 +
 
 +
P.S. Wait until Step 3 before planting your wheat.
 +
 
 
)
 
)
 +
Gui, Show
  
Gui, Add, Button, default gMineSetLoops, OK
 
Gui, Show
 
  
MineNum = 0
 
MineCycle = 0
 
NumPulls = 1000
 
  
WinGet, GameWinHandle, ID, eGenesis Client
 
 
loop
 
loop
 
{
 
{
Line 43: Line 55:
 
if (WinHandle = GameWinHandle)
 
if (WinHandle = GameWinHandle)
 
{
 
{
Gosub, MineRecord
+
 
 +
Gosub, Record
 
}
 
}
 
else
 
else
Line 55: Line 68:
  
  
Water:  
+
Water:  
MineNum = 1
+
GuiControl, Text, MineCycleText, Fetching Water...  
GuiControl, Text, MineCycleText, Fetching Water...
+
MouseGetPos, OldMX, OldMY
MinePosX := MineX%MineNum%
+
;Click the water icon
MinePosY := MineY%MineNum%
+
Click, %MineX1%, %MineY1%
MouseGetPos, OldMX, OldMY
+
Sleep, 750
Click, %MinePosX%, %MinePosY%
+
 
Sleep, 750
+
;Click the Max button
Click, 513, 423
+
Click, %MineX2%, %MineY2%
Sleep, 750
+
Sleep, 750
MouseMove, %OldMX%, %OldMY%, 0
+
 
return
+
MouseMove, %OldMX%, %OldMY%, 0
 +
return
  
  
MineRecord:
+
Record:
 
MineNum++
 
MineNum++
 
MouseGetPos, MineX%MineNum%, MineY%MineNum%
 
MouseGetPos, MineX%MineNum%, MineY%MineNum%
  
if (MineNum = 1)
+
;MineNum1 will be the water icon location
{
+
 
BedNum = 0
+
if (MineNum = 1) {
GuiControl, Text, MineNumText, Middle click wheat beds
+
Gui, Destroy
}
+
Click, %MineX1%, %MineY1%
else
+
Sleep 500
{
+
Gui, +AlwaysOnTop +ToolWindow
BedNum ++
+
Gui, Font, bold
 +
Gui, Font, underline
 +
Gui, Add, Text, vMineNumText, Step 2:  Middle click Water MAX button
 +
Gui, Font, norm
 +
Gui, Add, Text,,
 +
( LTrim
 +
The water menu should now be showing...
 +
 
 +
Middle click the MAX button to record its location...
 +
Your jugs will also be refilled, after recording.
 +
 
 +
Drag this window out of the way if it is covering the water menu
 +
 
 +
P.S. You automatically gather water every 3 mins, after wheat is planted.
 +
 
 +
Recommend about 50 jugs to start out with, depends on how many beds you plant.
 +
 
 +
)
 +
Gui, Show
 +
 
 +
 
 +
;MinNum2 will be the Water Max button location
 +
} else if (MineNum = 2) {
 +
 
 +
Gui, Destroy
 +
Click, %MineX2%, %MineY2%
 +
Sleep 500
 +
Gui, +AlwaysOnTop +ToolWindow
 +
Gui, Font, bold
 +
Gui, Add, Text, vMineNumText, Step 3:  Middle click Wheat Beds
 +
Gui, Font, norm
 +
Gui, Add, Text,,
 +
( LTrim
 +
Leave this window up and drag out of the way. Now start planting your wheat.
 +
 
 +
When done planting, quickly, hover and middle-click (Click mouse-wheel)
 +
on each wheat bed, one by one, until you've clicked on all the beds.
 +
 
 +
Then click the OK button.
 +
 
 +
)
 +
Gui, Add, Button, default gStart, OK
 +
Gui, Show
 +
 
 +
;MineNum3 is wheat bed 1, MineNum4 is wheat bed 2, etc
 +
} else {
 +
BedNum ++
 
GuiControl, Text, MineNumText, %BedNum% wheat beds captured
 
GuiControl, Text, MineNumText, %BedNum% wheat beds captured
}
+
}
  
TotalBeds := MineNum-1
+
TotalBeds := BedNum
 
return
 
return
  
  
MineSetLoops:
+
Start:
 
Gui, Submit
 
Gui, Submit
 
Gui, Destroy
 
Gui, Destroy
 
Gui, +AlwaysOnTop +ToolWindow
 
Gui, +AlwaysOnTop +ToolWindow
 
Gui, Font, bold
 
Gui, Font, bold
Gui, Add, Text, vMineCycleText, Cycle %NumPulls% of %NumPulls%
+
Gui, Add, Text, vMineCycleText, 5s countdown, drag window out of way of beds
 
Gui, Font, norm
 
Gui, Font, norm
 
Gui, Show
 
Gui, Show
GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%
+
GuiControl, Text, MineCycleText, 5s countdown, drag window out of way of beds
  
#Persistent
 
 
;Every 3 mins, get water (180s for 3 mins. SetTimer = s*1000 per min, thus 180,000s for 3 mins)
 
;Every 3 mins, get water (180s for 3 mins. SetTimer = s*1000 per min, thus 180,000s for 3 mins)
 
;Normally each wheat needs watered every 33 seconds, real time, so 3 mins is plenty of time for water icon to appear.
 
;Normally each wheat needs watered every 33 seconds, real time, so 3 mins is plenty of time for water icon to appear.
SetTimer, Water, 180000
+
 
 +
#Persistent
 +
SetTimer, Water, 180000
 +
; SetTimer, Water, 10000
  
  
;You got 5 seconds to drag the status bar out of the way (3s below + and 4 s furthur below
+
;You got 5 seconds to drag the status window out of the way
Sleep 5000
+
Sleep 5000
  
  
Line 111: Line 173:
 
{
 
{
  
;MinNum = 1 is the water icon location, thus why we are starting at 2. MineNum = 1 is only called during the #Persistent
+
;MineNum1 is the water icon location
 +
;MineNum1 is only called during the Water: subroutine (#Persistent)
 +
;MineNum2 is the water max button location, thus why we are starting at 3, the first wheat bed location.
 +
 
 +
WinActivate, eGenesis Client
 +
MineNum = 3
 
BedNum = 1
 
BedNum = 1
MineNum = 2
 
 
MineCycle++
 
MineCycle++
 
MouseGetPos, OldMX, OldMY
 
MouseGetPos, OldMX, OldMY
Line 124: Line 190:
 
{
 
{
  
 
 
WinActivate, eGenesis Client
 
  
 
;BlockInput, MouseMove
 
;BlockInput, MouseMove
  
GuiControl, Text, MineCycleText, Cycle %MineCycle%  Bed %BedNum%  
+
GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%  Bed %BedNum%  
 
MinePosX := MineX%MineNum%
 
MinePosX := MineX%MineNum%
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
Line 140: Line 203:
 
BedNum ++
 
BedNum ++
 
Sleep, 100
 
Sleep, 100
}
+
}
 +
 
 +
 
  
 
MouseMove, %OldMX%, %OldMY%, 0
 
MouseMove, %OldMX%, %OldMY%, 0
GuiControl, Text, MineCycleText, Cycle %MineCycle%  PAUSE  
+
GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%  PAUSE (Ctrl+P, if needed)
 
;BlockInput, MouseMoveOff
 
;BlockInput, MouseMoveOff
 
Sleep, 2000
 
Sleep, 2000

Revision as of 02:48, 1 February 2010

;Ctrl+Alt+W to start macro.
;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 Pause is during the 2s pause after each cycle
;The AHK icon in system tray will turn red while paused.
;Ctrl+R to reload script

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



IfWinExist eGenesis Client
{

	WinGet, GameWinHandle, ID, eGenesis Client
	MineNum = 0
	MineCycle = 0
	NumPulls = 1000
	BedNum = 0


	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Font, underline
	Gui, Add, Text, vMineNumText, Step 1:  Middle click Water icon
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	Middle click (click mouse wheel) the Water icon to record its location

	If the water icon is NOT showing, then:

	Hit Esc, Skills, Empty jugs, Empty one or all jugs

	Step 2 will click the icon to bring up the menu
	so you can record the Max button. Your jugs will be refilled, too.	

	P.S. Wait until Step 3 before planting your wheat.

	)
	Gui, Show



	loop
	{
		WinActivate
		CoordMode, Mouse, Relative
		KeyWait, MButton, D
		KeyWait, MButton
		MouseGetPos, TestX, TestY, WinHandle
		if (WinHandle = GameWinHandle)
		{

			Gosub, Record
		}
		else
		{
			Gui, Destroy
			break
		}
	}
	return



	Water: 
	GuiControl, Text, MineCycleText, Fetching Water... 
	MouseGetPos, OldMX, OldMY
	;Click the water icon
	Click, %MineX1%, %MineY1%			
	Sleep, 750

	;Click the Max button
	Click, %MineX2%, %MineY2%			
	Sleep, 750

	MouseMove, %OldMX%, %OldMY%, 0			
	return


	Record:
	MineNum++
	MouseGetPos, MineX%MineNum%, MineY%MineNum%

	;MineNum1 will be the water icon location

	if (MineNum = 1) {
	Gui, Destroy
	Click, %MineX1%, %MineY1%			
	Sleep 500
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Font, underline
	Gui, Add, Text, vMineNumText, Step 2:  Middle click Water MAX button
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	The water menu should now be showing...

	Middle click the MAX button to record its location...
	Your jugs will also be refilled, after recording.

	Drag this window out of the way if it is covering the water menu

	P.S. You automatically gather water every 3 mins, after wheat is planted.

	Recommend about 50 jugs to start out with, depends on how many beds you plant.

	)
	Gui, Show


	;MinNum2 will be the Water Max button location
	} else if (MineNum = 2) {

	Gui, Destroy
	Click, %MineX2%, %MineY2%			
	Sleep 500
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineNumText, Step 3:  Middle click Wheat Beds
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	Leave this window up and drag out of the way. Now start planting your wheat.

	When done planting, quickly, hover and middle-click (Click mouse-wheel)
	on each wheat bed, one by one, until you've clicked on all the beds.

	Then click the OK button.

	)
	Gui, Add, Button, default gStart, OK
	Gui, Show

	;MineNum3 is wheat bed 1, MineNum4 is wheat bed 2, etc
	} else	{
	BedNum ++
	GuiControl, Text, MineNumText, %BedNum% wheat beds captured
	}

	TotalBeds := BedNum
	return


	Start:
	Gui, Submit
	Gui, Destroy
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineCycleText, 5s countdown, drag window out of way of beds
	Gui, Font, norm
	Gui, Show
	GuiControl, Text, MineCycleText, 5s countdown, drag window out of way of beds

;Every 3 mins, get water (180s for 3 mins. SetTimer = s*1000 per min, thus 180,000s for 3 mins)
;Normally each wheat needs watered every 33 seconds, real time, so 3 mins is plenty of time for water icon to appear.

	#Persistent 
	SetTimer, Water, 180000
;	SetTimer, Water, 10000


	;You got 5 seconds to drag the status window out of the way
	Sleep 5000


	loop, %NumPulls%
	{

	;MineNum1 is the water icon location 
	;MineNum1 is only called during the Water: subroutine (#Persistent)
	;MineNum2 is the water max button location, thus why we are starting at 3, the first wheat bed location.

			WinActivate, eGenesis Client
			MineNum = 3
			BedNum = 1
			MineCycle++
			MouseGetPos, OldMX, OldMY





	loop, %TotalBeds%
	{


			;BlockInput, MouseMove

			GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%   Bed %BedNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			Sleep, 100
			Send {H}
			Send {W}
			MineNum++
			BedNum ++
			Sleep, 100	
	}



			MouseMove, %OldMX%, %OldMY%, 0			
			GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%   PAUSE  (Ctrl+P, if needed)
			;BlockInput, MouseMoveOff
				Sleep, 2000



	}
	Gui, Destroy
	Gui, Add, Text,, Middle-click on this window to end the script.
	Gui, Show
	return
}