These are all works in progress; please leave comments at the bottom of the page if you find any problems.
If you're running a macro involving an action causing an attribute timer (like the END timer for mine pulls), make sure that portion of the window remains unblocked. Right now these macros only work with large action buttons; I'm trying to figure out a way to auto-detect what kind of action buttons you've selected and adjusting the script accordingly.
The macro won't actually sort rocks or otherwise touch them; you will have to do the sorting/picking yourself. Some nice things about the macro, though: you don't have to pin the menu in a specific place, you can tell the macro how many pulls to make, and you don't have to adjust the macro based on your endurance level—the macro will figure out when your Endurance timer runs out by itself. Also, if you're like me and switch between applications often, you'll find this handy: the macro pauses if you switch away from ATITD, and will automatically resume mining when you bring up the game window again.
AT THE MOMENT, the macro only works for a roughly 800x600 window. I'm changing this soon to work with any size window.
The hotkey I've assigned is Ctrl-Alt-M, but you can of course change this by altering the first line (^ stands for Ctrl, ! stands for Alt, # stands for shift. Leave the two colons.)
^!m::
IfWinExist eGenesis Client
{
WinActivate
Gui, 2:Add, Text,, Recording mouse position`nPlease click on the "Work This Ore Mine" button.
Gui, 2:Show
KeyWait, LButton, D
MouseGetPos, MinePosX, MinePosY
Gui, 2:Destroy
Gui, 2:Add, Text,, How many mine pulls?
Gui, 2:Add, Edit, Number vNumPulls
Gui, 2:Add, Button, default gMineCommit, OK
Gui, 2:Show
return
MineCommit:
Gui, 2:Submit
Gui, 2:Destroy
loop, %NumPulls%
{
WinActivate
loop {
Sleep, 1000
PixelSearch, Px, Py, 760, 140, 805, 150, 0x88DCEF
if (ErrorLevel = 1 and WinActive("eGenesis Client"))
{
break
}
}
MouseClick, left, %MinePosX%, %MinePosY%
}
return
}
Default hotkey is Ctrl-Alt-G, but this can be changed by changing the first line.
; grass collector
^!g::
IfWinExist eGenesis Client
{
WinActivate
WinGetPos,,, winWidth, winHeight
minorOffset = 70
majorOffset = 100
winXCenter := winWidth / 2
winYCenter := ((winHeight - 22) / 2) + 32
winXLeft := winXCenter - minorOffset
winXFarLeft := winXCenter - majorOffset
winXRight := winXCenter + minorOffset
winXFarRight := winXCenter + majorOffset
winYUp := winYCenter - minorOffset
winYFarUp := winYCenter - majorOffset
winYDown := winYCenter + minorOffset
winYFarDown := winYCenter + majorOffset
circleMove = 0
Gui, +AlwaysOnTop +ToolWindow
Gui, Add, Text,, How many grass cycles?
Gui, Add, Edit, Number vNumGrass
Gui, Add, Button, default gGrassCommit, OK
Gui, Show
return
GrassCommit:
Gui, Submit
Gui, Destroy
GrassCycle = 0
Gui, +AlwaysOnTop +ToolWindow
Gui, Font, bold
Gui, Add, Text, vGrassCycleText, Cycle %NumGrass% of %NumGrass%
Gui, Font, norm
Gui, Show
GuiControl, Text, GrassCycleText, Cycle %GrassCycle% of %NumGrass%
WinActivate, eGenesis Client
CoordMode, Mouse, Relative
loop, %NumGrass%
{
if circleMove = 0
{
MouseClick, left, %winXCenter%, %winYFarUp%
circleMove++
}
else if circleMove = 1
{
MouseClick, left, %winXRight%, %winYUp%
circleMove++
}
else if circleMove = 2
{
MouseClick, left, %winXFarRight%, %winYCenter%
circleMove++
}
else if circleMove = 3
{
MouseClick, left, %winXRight%, %winYDown%
circleMove++
}
else if circleMove = 4
{
MouseClick, left, %winXCenter%, %winYFarDown%
circleMove++
}
else if circleMove = 5
{
MouseClick, left, %winXLeft%, %winYDown%
circleMove++
}
else if circleMove = 6
{
MouseClick, left, %winXFarLeft%, %winYCenter%
circleMove++
}
else if circleMove = 7
{
MouseClick, left, %winXLeft%, %winYUp%
circleMove = 0
}
loop
{
PixelSearch, Px, Py, 0, 0, %winWidth%, 30, 0xB46E6C
Sleep, 250
if ErrorLevel = 0
{
GrassCycle++
GuiControl, Text, GrassCycleText, Cycle %GrassCycle% of %NumGrass%
MouseClick, left, %Px%, %Py%
Sleep, 2000
break
}
}
}
Gui, Destroy
return
}
return
Activate using Ctrl-Alt-S, and walk along the shoreline. 95% of the time it'll pick up slate (occasionally it'll either click too late or miss a slate). If you wish to improve the macro's accuracy at the expense of system performance/frame rate, remove the "Sleep, 5" line from the macro.
; persistent slate macro
^!s::
IfWinExist eGenesis Client
{
WinActivate
WinGetPos,,, winWidth, winHeight
widthOffset := winWidth - 300
heightOffset := 50
loop
{
CoordMode, Mouse, Relative
BlockInput, Mouse
Sleep, 5
PixelSearch, Px, Py, widthOffset, 20, winWidth, 50, 0x006AC0
if (ErrorLevel = 0 and WinActive("eGenesis Client"))
{
MouseGetPos, OldMX, OldMY
MouseClick, left, %Px%, %Py%,, 0
MouseMove, %OldMX%, %OldMY%, 0
Sleep, 2000
}
}
}
return