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
< User:Cegaiel | Macros | Wheat
Jump to navigationJump to search| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<pre> | <pre> | ||
| − | |||
;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 script moves fast, so it might be difficult for it to see the Ctrl+P | ||
| Line 7: | Line 6: | ||
;Ctrl+R to reload script | ;Ctrl+R to reload script | ||
| − | + | ||
| − | + | ;Author: Cegaiel | |
| − | + | ;Last Update: 10/25/2010 | |
| Line 25: | Line 24: | ||
Gui, +AlwaysOnTop +ToolWindow | Gui, +AlwaysOnTop +ToolWindow | ||
Gui, Font, bold | Gui, Font, bold | ||
| − | + | Gui, Add, Text, vMineNumText, Step 1 of 2: Middle click Water icon | |
| − | Gui, Add, Text, vMineNumText, Step 1: Middle click Water icon | ||
Gui, Font, norm | Gui, Font, norm | ||
Gui, Add, Text,, | Gui, Add, Text,, | ||
| Line 34: | Line 32: | ||
If the water icon is NOT showing, then: | If the water icon is NOT showing, then: | ||
| − | Hit Esc, Skills, Empty | + | Hit Esc, Skills, Empty ONE or ALL jugs |
| + | |||
| + | They will automatically be refilled next step | ||
| − | |||
| − | |||
| − | + | Now is a good time to pinup your plant wheat menu. | |
| + | It can be anywhere, as you will be manually planting them anyways. | ||
) | ) | ||
| Line 48: | Line 47: | ||
loop | loop | ||
{ | { | ||
| − | + | WinActivate, eGenesis Client | |
| + | WinWait, eGenesis Client | ||
| + | WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos | ||
| + | |||
| + | ;Get coordinates, for your resolutions' X,Y location of the Max button on Water. | ||
| + | MaxX := Floor(Xmax/2) | ||
| + | MaxY := Floor(Ymax/2)+56 | ||
| + | |||
| + | |||
CoordMode, Mouse, Relative | CoordMode, Mouse, Relative | ||
KeyWait, MButton, D | KeyWait, MButton, D | ||
| Line 68: | Line 75: | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| Line 88: | Line 82: | ||
;MineNum1 will be the water icon location | ;MineNum1 will be the water icon location | ||
| + | |||
if (MineNum = 1) { | if (MineNum = 1) { | ||
| + | |||
Gui, Destroy | Gui, Destroy | ||
| − | |||
Sleep 500 | Sleep 500 | ||
| − | + | Click %MineX1%, %MineY1% | |
| − | + | Sleep 500 | |
| − | + | Click %MaxX%, %MaxY% | |
| − | + | Sleep 1000 | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Gui, +AlwaysOnTop +ToolWindow | Gui, +AlwaysOnTop +ToolWindow | ||
Gui, Font, bold | Gui, Font, bold | ||
| − | Gui, Add, Text, vMineNumText, Step | + | Gui, Add, Text, vMineNumText, Step 2 of 2: Manually plant, then Middle click Wheat Beds |
Gui, Font, norm | Gui, Font, norm | ||
Gui, Add, Text,, | Gui, Add, Text,, | ||
| Line 138: | Line 110: | ||
Gui, Show | Gui, Show | ||
| − | ; | + | |
| + | |||
| + | ;MineNum2 is wheat bed 1, MineNum3 is wheat bed 2, etc | ||
} else { | } else { | ||
BedNum ++ | BedNum ++ | ||
| Line 153: | Line 127: | ||
Gui, +AlwaysOnTop +ToolWindow | Gui, +AlwaysOnTop +ToolWindow | ||
Gui, Font, bold | Gui, Font, bold | ||
| − | Gui, Add, Text, vMineCycleText, 5s countdown, drag window out of way of beds | + | Gui, Add, Text, vMineCycleText, 5s countdown, drag window out of way of beds`n`n`n |
Gui, Font, norm | Gui, Font, norm | ||
Gui, Show | Gui, Show | ||
| − | GuiControl, Text, MineCycleText, 5s countdown, drag window out of way of beds | + | GuiControl, Text, MineCycleText, 5s countdown, drag window out of way of beds`n`n`n |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | delay = 5 | |
;You got 5 seconds to drag the status window out of the way | ;You got 5 seconds to drag the status window out of the way | ||
| − | Loop, % | + | Loop, %delay% |
{ | { | ||
| − | GuiControl, Text, MineCycleText, % | + | GuiControl, Text, MineCycleText, %delay%s countdown, drag window out of way of beds |
| − | + | delay -- | |
Sleep 1000 | Sleep 1000 | ||
} | } | ||
| − | SetDefaultMouseSpeed, 0 | + | #Persistent |
| + | ; SetTimer, Water, 180000 | ||
| + | ; SetTimer, Water, 10000 | ||
| + | SetTimer, Timer, 1000 | ||
| + | |||
| + | |||
| + | |||
| + | seconds = 0 | ||
| + | minutes = 0 | ||
| + | seconds_eta = 0 | ||
| + | minutes_eta = 3 | ||
| + | SetDefaultMouseSpeed, 0 | ||
| + | |||
| + | |||
| + | |||
| + | |||
loop, %NumPulls% | loop, %NumPulls% | ||
| Line 182: | Line 165: | ||
;MineNum1 is the water icon location | ;MineNum1 is the water icon location | ||
;MineNum1 is only called during the Water: subroutine (#Persistent) | ;MineNum1 is only called during the Water: subroutine (#Persistent) | ||
| − | ; | + | ;Thus why we are starting at MineNum2, the first wheat bed location. |
WinActivate, eGenesis Client | WinActivate, eGenesis Client | ||
| − | MineNum = | + | MineNum = 2 |
BedNum = 1 | BedNum = 1 | ||
MineCycle++ | MineCycle++ | ||
| Line 200: | Line 183: | ||
;BlockInput, MouseMove | ;BlockInput, MouseMove | ||
| − | GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls% Bed %BedNum% | + | 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 |
MinePosX := MineX%MineNum% | MinePosX := MineX%MineNum% | ||
MinePosY := MineY%MineNum% | MinePosY := MineY%MineNum% | ||
| Line 215: | Line 198: | ||
MouseMove, %OldMX%, %OldMY%, 0 | MouseMove, %OldMX%, %OldMY%, 0 | ||
| − | GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls% PAUSE (Ctrl+P, if needed) | + | 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 |
;BlockInput, MouseMoveOff | ;BlockInput, MouseMoveOff | ||
Sleep, 2000 | Sleep, 2000 | ||
| Line 227: | Line 210: | ||
return | return | ||
} | } | ||
| + | |||
| + | |||
| + | Water: | ||
| + | GuiControl, Text, MineCycleText, Fetching Water...`n`nElapsed Time: %minutes%m %seconds%s`nGather Water in: Now! | ||
| + | MouseGetPos, OldMX, OldMY | ||
| + | ;Click the water icon | ||
| + | Click, %MineX1%, %MineY1% | ||
| + | Sleep, 750 | ||
| + | |||
| + | ;Click the Max button | ||
| + | Click, %MaxX%, %MaxY% | ||
| + | Sleep, 750 | ||
| + | MouseMove, %OldMX%, %OldMY%, 0 | ||
| + | minutes_eta = 3 | ||
| + | seconds_eta = 0 | ||
| + | return | ||
| + | |||
| + | |||
| + | |||
| + | Timer: | ||
| + | seconds ++ | ||
| + | |||
| + | |||
| + | if (seconds = 60) | ||
| + | { | ||
| + | seconds := 0 | ||
| + | minutes ++ | ||
| + | } | ||
| + | |||
| + | if (seconds_eta = 0) and !(minutes_eta = 0) | ||
| + | { | ||
| + | seconds_eta := 60 | ||
| + | minutes_eta -- | ||
| + | } | ||
| + | |||
| + | if (minutes_eta < 0) | ||
| + | minutes_eta := 0 | ||
| + | |||
| + | seconds_eta -- | ||
| + | |||
| + | if (minutes_eta = 0) & (seconds_eta = 0) | ||
| + | Gosub, Water | ||
| + | |||
| + | return | ||
| + | |||
| + | |||
| + | |||
| + | ^r::reload | ||
| + | ^p::Pause | ||
</pre> | </pre> | ||
Latest revision as of 04:01, 26 October 2010
;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
;Author: Cegaiel
;Last Update: 10/25/2010
IfWinExist eGenesis Client
{
WinGet, GameWinHandle, ID, eGenesis Client
MineNum = 0
MineCycle = 0
NumPulls = 1000
BedNum = 0
Gui, +AlwaysOnTop +ToolWindow
Gui, Font, bold
Gui, Add, Text, vMineNumText, Step 1 of 2: 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 ONE or ALL jugs
They will automatically be refilled next step
Now is a good time to pinup your plant wheat menu.
It can be anywhere, as you will be manually planting them anyways.
)
Gui, Show
loop
{
WinActivate, eGenesis Client
WinWait, eGenesis Client
WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos
;Get coordinates, for your resolutions' X,Y location of the Max button on Water.
MaxX := Floor(Xmax/2)
MaxY := Floor(Ymax/2)+56
CoordMode, Mouse, Relative
KeyWait, MButton, D
KeyWait, MButton
MouseGetPos, TestX, TestY, WinHandle
if (WinHandle = GameWinHandle)
{
Gosub, Record
}
else
{
Gui, Destroy
break
}
}
return
Record:
MineNum++
MouseGetPos, MineX%MineNum%, MineY%MineNum%
;MineNum1 will be the water icon location
if (MineNum = 1) {
Gui, Destroy
Sleep 500
Click %MineX1%, %MineY1%
Sleep 500
Click %MaxX%, %MaxY%
Sleep 1000
Gui, +AlwaysOnTop +ToolWindow
Gui, Font, bold
Gui, Add, Text, vMineNumText, Step 2 of 2: Manually plant, then 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
;MineNum2 is wheat bed 1, MineNum3 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`n`n`n
Gui, Font, norm
Gui, Show
GuiControl, Text, MineCycleText, 5s countdown, drag window out of way of beds`n`n`n
delay = 5
;You got 5 seconds to drag the status window out of the way
Loop, %delay%
{
GuiControl, Text, MineCycleText, %delay%s countdown, drag window out of way of beds
delay --
Sleep 1000
}
#Persistent
; SetTimer, Water, 180000
; SetTimer, Water, 10000
SetTimer, Timer, 1000
seconds = 0
minutes = 0
seconds_eta = 0
minutes_eta = 3
SetDefaultMouseSpeed, 0
loop, %NumPulls%
{
;MineNum1 is the water icon location
;MineNum1 is only called during the Water: subroutine (#Persistent)
;Thus why we are starting at MineNum2, the first wheat bed location.
WinActivate, eGenesis Client
MineNum = 2
BedNum = 1
MineCycle++
MouseGetPos, OldMX, OldMY
loop, %TotalBeds%
{
;BlockInput, MouseMove
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
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)`n`nElapsed Time: %minutes%m %seconds%s`nGather Water in: %minutes_eta%m %seconds_eta%s
;BlockInput, MouseMoveOff
Sleep, 2000
}
Gui, Destroy
Gui, Add, Text,, Middle-click on this window to end the script.
Gui, Show
return
}
Water:
GuiControl, Text, MineCycleText, Fetching Water...`n`nElapsed Time: %minutes%m %seconds%s`nGather Water in: Now!
MouseGetPos, OldMX, OldMY
;Click the water icon
Click, %MineX1%, %MineY1%
Sleep, 750
;Click the Max button
Click, %MaxX%, %MaxY%
Sleep, 750
MouseMove, %OldMX%, %OldMY%, 0
minutes_eta = 3
seconds_eta = 0
return
Timer:
seconds ++
if (seconds = 60)
{
seconds := 0
minutes ++
}
if (seconds_eta = 0) and !(minutes_eta = 0)
{
seconds_eta := 60
minutes_eta --
}
if (minutes_eta < 0)
minutes_eta := 0
seconds_eta --
if (minutes_eta = 0) & (seconds_eta = 0)
Gosub, Water
return
^r::reload
^p::Pause