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

Users > AatonPulonich > Macros

Updated for T3! (well, more like I copied them over and they just worked...)

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.

New T3 Mining Macro (2006/09/02)

Latest version 09/02: Will now detect the color of your timer window automatically, hopefully eliminating 99% of the /chats I get about the mining macro screwing up. However, in order to detect the timer color the macro will attempt to pull on the mine; if you're already resting from an action that incurs a timer you may get a "you are too tired" message. Click OK and wait; this behavior is normal (if not exactly desirable).

New tale, new macro! The current theory concerning mining yield suggests that clicking on the crystals inside a mine randomly will increase the yield of the mine. To that end, I've rewritten the mining macro that will click one of several pinned crystal menus at random, simulating the random crystal mining behavior. Simply click on as many crystals as you like (I use 9-12), pin the menus up around your window (taking care not to block the part of the screen where the stat timers appear), run the macro and follow the instructions.

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
	WinGetPos,,, winWidth, winHeight
	widthOffset := winWidth - 40

	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineNumText, Recording mouse position
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	Please middle-click on the mine crystal menus, one by one,
	until you've clicked on all the menus you want to use.
	Then click the OK button.
	)
	Gui, Add, Button, default gMineSetLoops, OK
	Gui, Show
	MineNum = 0
	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

	MineRecord:
	MineNum++
	MouseGetPos, MineX%MineNum%, MineY%MineNum%
	GuiControl, Text, MineNumText, %MineNum% mine crystals captured
	return

	MineSetLoops:
	Gui, Destroy
	Gui, Add, Text,, How many mine pulls?
	Gui, Add, Edit, Number vNumPulls
	Gui, Add, Button, default gMineCommit, OK
	Gui, Show
	return
	
	MineCommit:
	Gui, Submit
	Gui, Destroy
	MineCycle = 0
	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%

	loop, %NumPulls%
	{
		WinActivate, eGenesis Client
		if (MineCycle = 0) {
			MouseGetPos, OldMX, OldMY
			Random, Crystal, 1, MineNum
			;BlockInput, Mouse
			MinePosX := MineX%Crystal%
			MinePosY := MineY%Crystal%
			MouseClick, left, %MinePosX%, %MinePosY%,, 0
			MouseMove, %OldMX%, %OldMY%, 0
			MineCycle++
			GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%
			;BlockInput, Default
			widthOffset2 := winWidth - 20
			PixelGetColor, timerColor, widthOffset2, 145
		}
		else {
			loop {
				Sleep, 1000
				;PixelSearch, Px, Py, widthOffset, 140, winWidth, 150, 0x88DCEF
				PixelSearch, Px, Py, widthOffset, 140, winWidth, 150, %timerColor%
				if (ErrorLevel = 1 and WinActive("eGenesis Client"))
				{
					break
				}
			}
			MouseGetPos, OldMX, OldMY
			Random, Crystal, 1, MineNum
			;BlockInput, Mouse
			MinePosX := MineX%Crystal%
			MinePosY := MineY%Crystal%
			MouseClick, left, %MinePosX%, %MinePosY%,, 0
			MouseMove, %OldMX%, %OldMY%, 0
			MineCycle++
			GuiControl, Text, MineCycleText, Cycle %MineCycle% of %NumPulls%
			;BlockInput, Default
		}
	}
	Gui, Destroy
	Gui, Add, Text,, Middle-click on this window to end the script.
	Gui, Show
	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. You can use either the F5 or the double-F8 camera with this macro; be sure not to zoom in all the way (in fact, medium zoom probably works best--you'll see why), and make sure you've got plenty of empty grassland around you.

If you're having trouble getting this macro to work (your avatar walks but doesn't click on the grass icon), please see the Grass Macro w/ Training below.

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

Grass Macro w/ Training (2006/11/12)

This macro was developed to deal with the pesky few systems that don't render graphics in quite the same way as my system does, and thus shifts the colors just enough to throw off the macro. The macro works exactly like the basic grass macro (read the notes above on usage), but with one difference: you middle-click on the grass icon before you begin to "train" the macro. Then enter the number of grass cycles and you're off.

Default hotkey is Ctrl-Alt-Shift-G, but this can be changed by altering the first line.

; grass collector with training
^!+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, Add, Text,, Recording mouse position`nPlease middle-click on the blue area of the grass icon.
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Show
	WinActivate
	CoordMode, Mouse, Relative
	KeyWait, MButton, D
	MouseGetPos, ColorPosX, ColorPosY
	detectYMin := ColorPosY - 1
	detectYMax := ColorPosY + 1
	PixelGetColor, GrassIcon, ColorPosX, ColorPosY

	Gui, Destroy
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Add, Text,, How many grass cycles?
	Gui, Add, Edit, Number vNumGrass
	Gui, Add, Button, default gTGrassCommit, OK
	Gui, Show
	return
	
	TGrassCommit:
	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
	BlockInput, MouseMove
	loop, %NumGrass%
	{
		if circleMove = 0 
		{
			MouseClick, left, %winXCenter%, %winYFarUp%,, 0
			circleMove++
		}
		else if circleMove = 1 
		{
			MouseClick, left, %winXRight%, %winYUp%,, 0
			circleMove++
		}
		else if circleMove = 2 
		{
			MouseClick, left, %winXFarRight%, %winYCenter%,, 0
			circleMove++
		}
		else if circleMove = 3 
		{
			MouseClick, left, %winXRight%, %winYDown%,, 0
			circleMove++
		}
		else if circleMove = 4 
		{
			MouseClick, left, %winXCenter%, %winYFarDown%,, 0
			circleMove++
		}
		else if circleMove = 5 
		{
			MouseClick, left, %winXLeft%, %winYDown%,, 0
			circleMove++
		}
		else if circleMove = 6 
		{
			MouseClick, left, %winXFarLeft%, %winYCenter%,, 0
			circleMove++
		}
		else if circleMove = 7 
		{
			MouseClick, left, %winXLeft%, %winYUp%,, 0
			circleMove = 0
		}
		BlockInput, MouseMoveOff
		loop
		{
			PixelSearch, Px, Py, 0, %detectYMin%, %winWidth%, %detectYMax%, %GrassIcon%
			Sleep, 250
			if ErrorLevel = 0 
			{
				GrassCycle++
				GuiControl, Text, GrassCycleText, Cycle %GrassCycle% of %NumGrass%
				BlockInput, MouseMove
				MouseClick, left, %Px%, %Py%,, 0
				BlockInput, MouseMoveOff
				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
		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.

What resolution is used with the grass macro? Grass macro should work with any resolution. I've tried it at 800x600 and 1024x768 and both seem to work fine. —AatonPulonich

What is the problem when mining and the macro dont read the stat timers? Nothing is blocking. Screen resolution?

For Hetaeros

I don't know what I am doing wrong but the macro never clicks on the Work This Mine button and therefore does not pull ore.


Home | Atlas | Guides | Tests | Research | Techs | Skills | Index | Recent Changes | Preferences | Login
You must log in to edit pages. | View other revisions
Last edited November 13, 2006 4:47 am by AatonPulonich (diff)
Search: