Search: Home | Atlas | Guides | Tests | Research | Index | Recent Changes | Preferences | Login

Users > AatonPulonich > Macros

Autohotkey has some neat features built into it that allow the end user to have more control over their macros. If you're tired of having to read a long set of instructions about what menus to pin, where they should be placed and exactly how many rows and columns of panels you can have open, this is for you. There are some macros out there for ACTool that already have advanced interfaces asking you to click in various spots to "train" the macro; my scripts use the same idea, but with a slightly nicer interface made possible by Autohotkey's GUI construction abilities.

These are all works in progress; please leave comments at the bottom of the page if you find any problems.

General Notes

These macros require v1.0.25+ of AutoHotKey. If you get an error about := not being a valid operator, you need to upgrade.

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.

Basic Mining Macro

This macro just pulls on a mine for you. All you have to do is pin the mining menu somewhere, run the macro and follow the instructions. The macro will ask you to train it by clicking on the "Work this ore mine" button, and ask you how many rocks you want to pull. Then sit back, relax and chat with your guildies while the mine brings up rocks.

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
}

Basic Grass Macro (updated 2006/05/13)

Collects grass with your avatar walking around in a small circle. Now with super-duper custom functionality: set the number of grass pickings and let it run.

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

Basic Slate Macro (2006/05/13)

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

Comments, Bugs, etc.


Home | Atlas | Guides | Tests | Research | Index | Recent Changes | Preferences | Login
You must log in to edit pages. | View other revisions
Last edited May 15, 2006 3:16 am by AatonPulonich (diff)
Search: