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/Barley/Code"
From A Tale in the Desert
< User:Cegaiel | Macros | Barley
Jump to navigationJump to search| Line 2: | Line 2: | ||
;Barley Macro written for http://www.autohotkey.com, 1280x1024 resolution, pin window in the upper left corner of the screen. | ;Barley Macro written for http://www.autohotkey.com, 1280x1024 resolution, pin window in the upper left corner of the screen. | ||
| − | ;Have 10 Raw Barley, | + | ;Have 10 Raw Barley, 60 Grain Fertilizer and 60 jugs of water, in inventory, for "Water + 6 fertilizer" mode |
| + | ;Have 10 Raw Barley, 30 Grain Fertilizer and 60 jugs of water, in inventory, for "Water + 3 fertilizer" mode | ||
| + | ;Have 10 Raw Barley, 0 Grain Fertilizer and 60 jugs of water, in inventory, for "Water only" mode | ||
| + | |||
; Barley - 1280x1024 resolution | ; Barley - 1280x1024 resolution | ||
; Ctrl+Alt+W | ; Ctrl+Alt+W | ||
| + | |||
| + | |||
| + | ; Author: Cegaiel | ||
| + | ; Based on Daniels barley macro | ||
| + | ; Date: 6/3/2010 | ||
| Line 16: | Line 24: | ||
IfWinExist eGenesis Client | IfWinExist eGenesis Client | ||
{ | { | ||
| + | WinActivate, eGenesis Client | ||
| + | |||
WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos | WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos | ||
| − | SetDefaultMouseSpeed, | + | SetDefaultMouseSpeed, 0 |
| − | + | ||
| Line 33: | Line 43: | ||
| + | Gui, +AlwaysOnTop +ToolWindow | ||
| + | Gui, Font, bold | ||
| + | Gui, Add, Text,, Adjust Camera/Zoom Level? | ||
| + | Gui, Font, normal | ||
| + | Gui, Add, Text,, Choose Yes if this is the first time running.`nChoose No if you already performed this step and locked screen. | ||
| + | Gui, Add, DropDownList, vAdjust Choose2, Yes|No | ||
| + | |||
| + | |||
| + | Gui, Font, bold | ||
| + | Gui, Add, Text,, `nChoose method/fertilizer qty: | ||
| + | Gui, Font, normal | ||
| + | ;Gui, Add, Text,, | ||
| + | Gui, Add, DropDownList, vMethod Choose1, Water + 3 fertilizer|Water + 6 fertilizer|Water only | ||
| + | |||
| + | |||
| + | |||
| + | Gui, Add, Button, Default gStart, GO | ||
| + | Gui, Show | ||
| + | return | ||
| + | |||
| + | |||
| + | |||
| + | Start: | ||
| + | Gui, Submit | ||
| + | Gui, Destroy | ||
| + | Sleep 250 | ||
| + | if (Adjust = "Yes") | ||
| + | { | ||
;Now Zoom in all the way with F8 | ;Now Zoom in all the way with F8 | ||
| Line 53: | Line 91: | ||
Loop, 8 | Loop, 8 | ||
{ | { | ||
| − | + | click, WD | |
sleep 250 | sleep 250 | ||
} | } | ||
| + | Sleep 3000 | ||
| − | Msgbox, Screen adjusted, | + | Msgbox, Screen adjusted, Lock screen (Alt+L) NOW so you wont have to repeat this step on next plantings.`n`nDon't forget to make sure you have your Plant menu in top left corner before continuing!`n`nClick OK when you are ready to continue... |
| + | |||
| + | } | ||
| + | |||
| + | |||
| + | |||
| + | WinActivate, eGenesis Client | ||
Loop, 100 | Loop, 100 | ||
| Line 76: | Line 121: | ||
MouseMove, 30, 45 | MouseMove, 30, 45 | ||
sleep 100 | sleep 100 | ||
| − | + | click, Left ; Plant | |
sleep 100 | sleep 100 | ||
MouseMove, mousex + incx, mousey | MouseMove, mousex + incx, mousey | ||
sleep 100 | sleep 100 | ||
| − | + | click, Left | |
sleep interval | sleep interval | ||
} | } | ||
| Line 87: | Line 132: | ||
MouseMove, 30, 45 | MouseMove, 30, 45 | ||
sleep 100 | sleep 100 | ||
| − | + | click, Left ; Plant | |
sleep 100 | sleep 100 | ||
MouseMove, mousex - incx, mousey | MouseMove, mousex - incx, mousey | ||
sleep 100 | sleep 100 | ||
| − | + | click, Left | |
sleep interval | sleep interval | ||
} | } | ||
| Line 97: | Line 142: | ||
MouseMove, 30, 45 | MouseMove, 30, 45 | ||
sleep 100 | sleep 100 | ||
| − | + | click, Left ; Plant | |
sleep 100 | sleep 100 | ||
MouseMove, mousex, mousey + incy | MouseMove, mousex, mousey + incy | ||
sleep 100 | sleep 100 | ||
| − | + | click, Left | |
sleep interval | sleep interval | ||
rows++ | rows++ | ||
| Line 116: | Line 161: | ||
Loop, 2 | Loop, 2 | ||
{ | { | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
Loop, 5 | Loop, 5 | ||
{ | { | ||
| + | |||
| + | Gosub, Calc | ||
| + | |||
if (count = 0) ; water and fert twice | if (count = 0) ; water and fert twice | ||
{ | { | ||
| − | + | Click, %x%, %y% | |
| − | + | Sleep 250 | |
| − | + | ||
| − | + | ;Water | |
| − | + | click, %WaterX%, %WaterY% | |
| − | + | Sleep 250 | |
| − | + | click, %WaterX%, %WaterY% | |
| − | + | ||
| − | + | ||
| − | + | if !(Method = "Water only") | |
| − | + | { | |
| − | + | Sleep 250 | |
| − | + | ;Fert | |
| − | + | click, %FertX%, %FertY% | |
| − | + | Sleep 250 | |
| − | + | click, %FertX%, %FertY% | |
| − | + | } | |
| − | + | ||
| − | + | Sleep 250 | |
| − | |||
SendInput {ESC} | SendInput {ESC} | ||
| − | sleep | + | sleep 350 |
intx += 70 | intx += 70 | ||
| + | |||
| + | Gosub, Calc | ||
| + | |||
| + | |||
| + | } | ||
| + | else if (count = 3) and (Method = "Water + 3 fertilizer") ; water and fert once | ||
| + | { | ||
| + | click, %x%, %y% | ||
| + | Sleep 250 | ||
| + | click, %waterX%, %waterY% | ||
| + | Sleep 250 | ||
| + | click, %FertX%, %FertY% | ||
| + | |||
| + | Sleep 250 | ||
| + | SendInput {ESC} | ||
| + | sleep 350 | ||
| + | intx += 70 | ||
| + | |||
| + | Gosub, Calc | ||
| + | |||
| + | |||
} | } | ||
else if (count = 5) ; harvest | else if (count = 5) ; harvest | ||
{ | { | ||
| − | + | click, %x%, %y% | |
| − | + | Sleep 250 | |
| − | + | click, %harvestX%, %harvestY% | |
| − | + | ||
| − | + | Sleep 250 | |
| − | |||
| − | |||
| − | |||
SendInput {ESC} | SendInput {ESC} | ||
| − | sleep | + | sleep 500 |
intx += 70 | intx += 70 | ||
| + | Gosub, Calc | ||
| + | |||
} | } | ||
else ; water and fert once | else ; water and fert once | ||
{ | { | ||
| − | + | click, %x%, %y% | |
| − | + | Sleep 250 | |
| − | + | ||
| − | + | ;Water | |
| − | + | click, %waterX%, %waterY% | |
| − | + | ||
| − | + | if (Method = "Water + 6 fertilizer") | |
| − | + | { | |
| − | + | ;Fert | |
| − | + | Sleep 250 | |
| − | + | click, %FertX%, %FertY% | |
| − | + | } | |
| + | |||
| + | Sleep 250 | ||
SendInput {ESC} | SendInput {ESC} | ||
| − | sleep | + | sleep 350 |
intx += 70 | intx += 70 | ||
| + | Gosub, Calc | ||
} | } | ||
} | } | ||
| Line 180: | Line 255: | ||
intx = 0 | intx = 0 | ||
inty += 90 | inty += 90 | ||
| + | Gosub, Calc | ||
} | } | ||
count++ | count++ | ||
| − | sleep | + | |
| + | if (count = 5) | ||
| + | { | ||
| + | sleep 40000 ;Last cycle, let is sit for 30s, usually get more barley | ||
| + | } else{ | ||
| + | sleep 6000 | ||
| + | } | ||
| + | |||
| + | |||
| + | |||
} | } | ||
| Line 190: | Line 275: | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
} | } | ||
| − | </pre> | + | |
| + | |||
| + | Calc: | ||
| + | ;Bed 1 Location | ||
| + | x := mousex + intx | ||
| + | y := mousey + inty | ||
| + | |||
| + | waterX := mousex + intx + 189 | ||
| + | waterY := mousey + inty + 23 | ||
| + | |||
| + | FertX := mousex + intx + 189 | ||
| + | FertY := mousey + inty + 46 | ||
| + | |||
| + | HarvestX := mousex + intx + 106 | ||
| + | HarvestY := mousey + inty + 86 | ||
| + | return</pre> | ||
Revision as of 07:39, 3 June 2010
;Barley Macro written for http://www.autohotkey.com, 1280x1024 resolution, pin window in the upper left corner of the screen.
;Have 10 Raw Barley, 60 Grain Fertilizer and 60 jugs of water, in inventory, for "Water + 6 fertilizer" mode
;Have 10 Raw Barley, 30 Grain Fertilizer and 60 jugs of water, in inventory, for "Water + 3 fertilizer" mode
;Have 10 Raw Barley, 0 Grain Fertilizer and 60 jugs of water, in inventory, for "Water only" mode
; Barley - 1280x1024 resolution
; Ctrl+Alt+W
; Author: Cegaiel
; Based on Daniels barley macro
; Date: 6/3/2010
^r::reload
^p::Pause
^!w::
IfWinExist eGenesis Client
{
WinActivate, eGenesis Client
WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos
SetDefaultMouseSpeed, 0
;Check to see if we are in the correct resolution, or else exit script
if (Xmax = 1288) && (Ymax = 1002)
{
nothing = 0
} else {
Msgbox, You are not in 1280x1024 resolution`n`nExiting...
EXIT
}
Gui, +AlwaysOnTop +ToolWindow
Gui, Font, bold
Gui, Add, Text,, Adjust Camera/Zoom Level?
Gui, Font, normal
Gui, Add, Text,, Choose Yes if this is the first time running.`nChoose No if you already performed this step and locked screen.
Gui, Add, DropDownList, vAdjust Choose2, Yes|No
Gui, Font, bold
Gui, Add, Text,, `nChoose method/fertilizer qty:
Gui, Font, normal
;Gui, Add, Text,,
Gui, Add, DropDownList, vMethod Choose1, Water + 3 fertilizer|Water + 6 fertilizer|Water only
Gui, Add, Button, Default gStart, GO
Gui, Show
return
Start:
Gui, Submit
Gui, Destroy
Sleep 250
if (Adjust = "Yes")
{
;Now Zoom in all the way with F8
WinActivate, eGenesis Client
Sleep 1000
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
; Zoom out a little
Loop, 8
{
click, WD
sleep 250
}
Sleep 3000
Msgbox, Screen adjusted, Lock screen (Alt+L) NOW so you wont have to repeat this step on next plantings.`n`nDon't forget to make sure you have your Plant menu in top left corner before continuing!`n`nClick OK when you are ready to continue...
}
WinActivate, eGenesis Client
Loop, 100
{
mousex := Xmax//2 - 3
mousey := Ymax//2 + 16
incx = 70
incy = 70
rows = 0
Loop, 2 ; columns of barley
{
bug = 0
Loop, 4 ; rows of barley
{
if (Mod(rows, 2) = 0) ; plant left to right
{
MouseMove, 30, 45
sleep 100
click, Left ; Plant
sleep 100
MouseMove, mousex + incx, mousey
sleep 100
click, Left
sleep interval
}
else ; plant right to left
{
MouseMove, 30, 45
sleep 100
click, Left ; Plant
sleep 100
MouseMove, mousex - incx, mousey
sleep 100
click, Left
sleep interval
}
}
MouseMove, 30, 45
sleep 100
click, Left ; Plant
sleep 100
MouseMove, mousex, mousey + incy
sleep 100
click, Left
sleep interval
rows++
}
; Begin watering and fertalizing
water = 0
count = 0
Loop, 6
{
mousex = 640
mousey = 375
intx = 0
inty = 0
Loop, 2
{
Loop, 5
{
Gosub, Calc
if (count = 0) ; water and fert twice
{
Click, %x%, %y%
Sleep 250
;Water
click, %WaterX%, %WaterY%
Sleep 250
click, %WaterX%, %WaterY%
if !(Method = "Water only")
{
Sleep 250
;Fert
click, %FertX%, %FertY%
Sleep 250
click, %FertX%, %FertY%
}
Sleep 250
SendInput {ESC}
sleep 350
intx += 70
Gosub, Calc
}
else if (count = 3) and (Method = "Water + 3 fertilizer") ; water and fert once
{
click, %x%, %y%
Sleep 250
click, %waterX%, %waterY%
Sleep 250
click, %FertX%, %FertY%
Sleep 250
SendInput {ESC}
sleep 350
intx += 70
Gosub, Calc
}
else if (count = 5) ; harvest
{
click, %x%, %y%
Sleep 250
click, %harvestX%, %harvestY%
Sleep 250
SendInput {ESC}
sleep 500
intx += 70
Gosub, Calc
}
else ; water and fert once
{
click, %x%, %y%
Sleep 250
;Water
click, %waterX%, %waterY%
if (Method = "Water + 6 fertilizer")
{
;Fert
Sleep 250
click, %FertX%, %FertY%
}
Sleep 250
SendInput {ESC}
sleep 350
intx += 70
Gosub, Calc
}
}
mousex = 640
intx = 0
inty += 90
Gosub, Calc
}
count++
if (count = 5)
{
sleep 40000 ;Last cycle, let is sit for 30s, usually get more barley
} else{
sleep 6000
}
}
EXIT
}
}
Calc:
;Bed 1 Location
x := mousex + intx
y := mousey + inty
waterX := mousex + intx + 189
waterY := mousey + inty + 23
FertX := mousex + intx + 189
FertY := mousey + inty + 46
HarvestX := mousex + intx + 106
HarvestY := mousey + inty + 86
return