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/Wheat2"

From A Tale in the Desert
Jump to navigationJump to search
(New page: <pre> ;Ctrl+Alt+W to start macro. ;Ctrl+P to pause script (ie to click Water icon) and Ctrl+P again to resume ;The AHK icon in system tray will turn red while paused. ^p::Pause ^!w:: I...)
 
 
(2 intermediate revisions by the same user not shown)
Line 55: Line 55:
  
  
Water:  
+
Water:  
MineNum = 1
+
MineNum = 1
 +
GuiControl, Text, MineCycleText, Fetching Water...
 
MinePosX := MineX%MineNum%
 
MinePosX := MineX%MineNum%
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 +
MouseGetPos, OldMX, OldMY
 
Click, %MinePosX%, %MinePosY%
 
Click, %MinePosX%, %MinePosY%
 
Sleep, 500
 
Sleep, 500
 
Click, 513, 423
 
Click, 513, 423
return
+
Sleep, 250
 +
MouseMove, %OldMX%, %OldMY%, 0
 +
return
  
  
Line 93: Line 97:
 
Gui, Show
 
Gui, Show
 
GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%
 
GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%
 
 
  
 
#Persistent  
 
#Persistent  
Line 101: Line 103:
 
SetTimer, Water, 180000
 
SetTimer, Water, 180000
  
 
+
;You got 7 seconds to drag the status bar out of the way (3s below + and 4 s furthur below
 
+
Sleep 3000
 
 
  
  
Line 109: Line 110:
 
{
 
{
  
Sleep, 5000
+
Sleep, 4000
 
;MinNum = 1 is the water icon location, thus why we are starting at 2. MineNum = 1 is only called during the #Persistent
 
;MinNum = 1 is the water icon location, thus why we are starting at 2. MineNum = 1 is only called during the #Persistent
 
BedNum = 1
 
BedNum = 1
Line 133: Line 134:
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 
MouseMove, %MinePosX%, %MinePosY%, 0
 
MouseMove, %MinePosX%, %MinePosY%, 0
Sleep, 250
 
 
 
Send {H}
 
Send {H}
 
Send {W}
 
Send {W}
Line 142: Line 141:
 
}
 
}
  
GuiControl, Text, MineCycleText, Cycle %MineCycle%  Pausing
 
 
MouseMove, %OldMX%, %OldMY%, 0
 
MouseMove, %OldMX%, %OldMY%, 0
 +
GuiControl, Text, MineCycleText, Cycle %MineCycle%  Pause
 
;BlockInput, MouseMoveOff
 
;BlockInput, MouseMoveOff
  

Latest revision as of 02:05, 25 December 2009

;Ctrl+Alt+W to start macro.
;Ctrl+P to pause script (ie to click Water icon) and Ctrl+P again to resume
;The AHK icon in system tray will turn red while paused.

^p::Pause
^!w::



IfWinExist eGenesis Client
{
	WinActivate
	WinGetPos,,, winWidth, winHeight
	widthOffset := winWidth - 40

	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineNumText, Middle click water icon
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	Hover and middle-click (Click mouse-wheel) on each wheat bed, one by one,
	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)
	)

	Gui, Add, Button, default gMineSetLoops, OK
	Gui, Show

	MineNum = 0
	MineCycle = 0
	NumPulls = 1000

	WinGet, GameWinHandle, ID, eGenesis Client
	loop
	{
		WinActivate
		CoordMode, Mouse, Relative
		KeyWait, MButton, D
		KeyWait, MButton
		MouseGetPos, TestX, TestY, WinHandle
		if (WinHandle = GameWinHandle)
		{
			Gosub, MineRecord
		}
		else
		{
			Gui, Destroy
			break
		}
	}
	return



			Water: 
			MineNum = 1
			GuiControl, Text, MineCycleText, Fetching Water...
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseGetPos, OldMX, OldMY
			Click, %MinePosX%, %MinePosY%
			Sleep, 500
			Click, 513, 423			
			Sleep, 250
			MouseMove, %OldMX%, %OldMY%, 0			
			return


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

if (MineNum = 1)
{
BedNum = 0
	GuiControl, Text, MineNumText, Middle click wheat beds
}
else
{
BedNum ++
	GuiControl, Text, MineNumText, %BedNum% wheat beds captured
}

	TotalBeds := MineNum-1
	return


	MineSetLoops:
	Gui, Submit
	Gui, Destroy
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineCycleText, Cycle %NumPulls% of %NumPulls%
	Gui, Font, norm
	Gui, Show
	GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%

#Persistent 
;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.
SetTimer, Water, 180000

;You got 7 seconds to drag the status bar out of the way (3s below + and 4 s furthur below
Sleep 3000


	loop, %NumPulls%
	{

				Sleep, 4000
			;MinNum = 1 is the water icon location, thus why we are starting at 2. MineNum = 1 is only called during the #Persistent
			BedNum = 1
			MineNum = 2
			MineCycle++
			MouseGetPos, OldMX, OldMY





	loop, %TotalBeds%
	{



			WinActivate, eGenesis Client

			;BlockInput, MouseMove

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

			MouseMove, %OldMX%, %OldMY%, 0			
			GuiControl, Text, MineCycleText, Cycle %MineCycle%   Pause 
			;BlockInput, MouseMoveOff



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