The Wiki for Tale 5 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.

Takhetu/Macros

From ATITD5
Revision as of 21:20, 21 October 2010 by Takhetu (talk | contribs)
Jump to navigationJump to search

First test.

;Ctrl+R to reload
;Ctrl+P to pause

IfWinExist eGenesis Client
{
	WinGet, GameWinHandle, ID, eGenesis Client
} else {
	Msgbox, eGenesis client not running, exiting...
Exit
}

WinActivate, eGenesis Client
WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos
StartXGUI := Xmax+win_Xpos-255
StartYGUI := win_Ypos+35
Gui, +AlwaysOnTop +ToolWindow -Border +Background 
Gui, Add, Text,,Type in how many rows and columns `nof kettles you will be working with:
Gui, Add, Text, x10 y40, Rows:
Gui, Add, Edit,xp+35 yp-4 vnumRows, 4
Gui, Add, Text,xp+20 y40, Columns:
Gui, Add, Edit,xp+45 yp-4 vnumColumns, 4
Gui, Add, Button, x10 y70 gNext, Next »
Gui, Add, Button, x200 y5 gClose, Close 
; Generated using SmartGUI Creator 4.0
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window
Return

Next:
Gui, submit
Gui, Destroy
;Get Top Left
Gui, +AlwaysOnTop +ToolWindow -Border +Background 
Gui, Add, Text,,Using F8F8 camera view make `nsure you can see all kettles.
Gui, Add, Text,,Position your mouse over `nthe topleft kettle and press the F2 key.
Gui, Add, Button, x200 y5 gClose, Close 
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window

loop
{
	WinActivate eGenesis Client
	KeyWait, F2, D
	KeyWait, F2
	MouseGetPos, FirstX, FirstY, WinHandle
	if (WinHandle = GameWinHandle)
	{
		Gosub, GotTopLeft
	}
}
return

GotTopLeft:
Gui, Destroy
;Get Bottom Right
Gui, +AlwaysOnTop +ToolWindow -Border +Background 
Gui, Add, Text,,Position your mouse over `nthe bottom right kettle `nand press the F2 key.
Gui, Add, Button, x200 y5 gClose, Close 
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window

loop
{
	WinActivate eGenesis Client
	KeyWait, F2, D
	KeyWait, F2
	MouseGetPos, LastX, LastY, WinHandle
	if (WinHandle = GameWinHandle)
	{
		Gosub, GotBottomRight
	}
}
return

GotBottomRight:
Gui, Destroy
;Open Windows
Gui, +AlwaysOnTop +ToolWindow -Border +Background
Gui, Add, Text,vTimeLeft,Leave your mouse alone, `nopening windows in 5 seconds.
Gui, Add, Button, x200 y5 gClose, Close 
Gui, Show, X%StartXGUI% Y%StartYGUI% w240 h100, New GUI Window

	SmallPause := 5
	Loop, %SmallPause%
	{
	GuiControl, Text, TimeLeft, Leave your mouse alone, `nopening windows in %SmallPause% seconds.
	SmallPause --
	Sleep 1000
	}

GuiControl, Text, TimeLeft, Opening Windows Now.
WinActivate eGenesis Client

topNotFound := true
Loop, %numColumns%
{
	curColumn := A_Index 
	openPosX := FirstX+(A_Index-1)*floor((LastX-FirstX)/(numColumns-1))
	Loop, %numRows% 
	{
		openPosY := FirstY+(A_Index-1)*floor((LastY-FirstY)/(numRows-1))
		MouseClick,Right,openPosX,openPosY
		sleep, 200
		startSeaX := openPosX+5
		finishSeaY := openPosY-200
		If topNotFound 
		{
			Loop, 20 
			{
				curStartB := openPosY-(10*A_Index)
				curStartT := openPosY-(10*A_Index)-10
				PixelSearch,OutX,OutY,%startSeaX%,%curStartT%,%startSeaX%,%curStartB%,0x000000,Fast 
				if ErrorLevel < 1
				{
					break	
				}
			}
			PixelSearch,OutX,OutY,%startSeaX%,%curStartB%,%startSeaX%,%curStartT%,0x000000
			curStartB := openPosY-OutY+3
			curStartT := openPosY-OutY-3
			topNotFound := false 
		}
		startSeaYB := openPosY-curStartB
		startSeaYT := openPosY-curStartT
		PixelSearch,OutX,OutY,%startSeaX%,%startSeaYT%,%startSeaX%,%startSeaYB%,0x000000,50
		arrX := 18+20*(numColumns)*(curColumn-1)+20*(A_Index-1)
		MouseClick,Left,%OutX%,%OutY%,,,D
		sleep 100
		MouseMove,%arrX%,50
		sleep 300
		MouseClick,Left,,,,,U
		sleep, 100
	}
}

Close:
ExitApp

^r::reload
^p::Pause