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

User:Cegaiel/Macros/HacklingRake/Code

From ATITD6
Jump to navigationJump to search
;Ctrl+P to pause script and Ctrl+P again to resume
;The AHK icon in system tray will turn red while paused.
;Ctrl+R to reload script
;Date: 3/26/2010
;Last Update: 12/13/2011



step = 1
cycles = 0
counter = 0

	Gui, +AlwaysOnTop +ToolWindow
	Gui, Add, Text,, How many Rotten Flax`nare in your inventory?
	Gui, Add, Edit, vFlax wp number

	Gui, Add, Text,, Eating Grilled Food?`n(Automatically eat every 10 Teppy Min)
	Gui, Add, DropDownList, vEat Choose1, No|Yes


	Gui, Add, Button, gStart, Continue
	Gui, Show
	return



Start:
Gui, Submit
Gui, Destroy
Cycles := Floor(Flax/10)

Msgbox, This requires %Cycles% cycles, the macro will stop automatically after %Cycles% cycles.`n`nNow, hover mouse over a black letter, in the word ENDURANCE, in skills tab`n`nThis is the letter/skill that turns red when you get tired`n`nWhen you are hovering a black letter it will tell you in the tooltip.`n`nPress F2, when it tells you in tooltip, to set position.`n`nClick OK to proceed...




			IfWinExist eGenesis Client
			{

			WinActivate, eGenesis Client
			WinWait, eGenesis Client
			WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos 

			;Get coordinates, for your resolutions'  X,Y location of the popups (OK button) that will occur later.
			CenterX := Floor(Xmax/2)
			CenterY := Floor(Ymax/2)+109


			;Offsets the search coordinates for OK popup for the imagesearch in Popup sub.
			;ImageSearch method (Popup sub)
			ClickPopX1 := CenterX - 40
			ClickPopY1 := CenterY - 30

			ClickPopX2 := CenterX + 30
			ClickPopY2 := CenterY + 30


			} else {
			MsgBox, eGenesis Client not running, aborting...
			Exit
			}




SetDefaultMouseSpeed, 0





loop
{
MouseGetPos, skillX, skillY
PixelGetColor, color, skillX, skillY, RGB

if color = 0x000000
{
ToolTip, Coordinates: %skillX%`, %skillY%`nColor: %color%`n`n* HOVERING BLACK *`n* Press F2 to set location *
} else {
ToolTip, Coordinates: %skillX%`, %skillY%`nColor: %color%
}


GetKeyState, state, F2
if state = D
{
MsgBox Endurance text location recorded!`n`nNow pinup your Hackling Rake menu. Make sure it says "Seperate Rotten Flax (Step 1, Remove Straw)"`n`nHover mouse over that option and press F2 to record the click position.`n`nClick OK to proceed...
Tooltip
break
}
}


KeyWait, F2, D
if ErrorLevel = 0
{
MouseGetPos, ClickX, ClickY
Msgbox, Hackling Rake menu (Step 1) location recorded!`n`nNote: you can hit Ctrl+P to PAUSE script anytime and Ctrl+P again to RESUME`n`nClick OK to Start...
}



		if (Eat == "Yes")
		{

Msgbox, One more step! You have selected that you will be eating grilled foods!`n`nPinup the Esc, Skills, Consume menu and set the click position of the "Eat Grilled food" menu by hovering and hitting F2.`n`nNote: When this macro begins, it will first eat (so don't manually eat first).`n`nThen every 10 Teppy Mins (11:00 real time), it will automatically click/eat the grilled food.`n`nClick OK, then hit F2 over the grilled food consume menu to set...

	WinActivate, eGenesis Client

	KeyWait, F2, D
	if ErrorLevel = 0
	{
	MouseGetPos, EatX, EatY
	Msgbox, Eat location recorded!`n`nClick OK to eat food and start the macro...

	EatTimer = 1
	#Persistent 
	SetTimer, Eat, 1000

	}
		}






SetDefaultMouseSpeed, 0

	Gui, +AlwaysOnTop +ToolWindow
	Gui, Add, Text, vClickText, Preparing to start... Standby!`n`n`n`n
	Gui, Show
	GuiControl, Text, ClickText, Preparing to start... Standby!`n`n`n`n













		loop
		{

WinActivate, eGenesis Client
PixelGetColor, color, skillX, skillY, RGB

	if color = 0x000000
	{
	MouseGetPos, OldX, OldY





if (step = 1) {
;Step 1 (Remove Straw) - Top/1st menu choice
Click %ClickX%, %ClickY%
} else if (step = 2) {
;Step 2 (Seperate) - 2nd menu choice
NewY := ClickY + 15
Click %ClickX%, %NewY%
} else if (step = 3) {
;Step 3 (Refine) - 2nd menu choice
NewY := ClickY + 15
Click %ClickX%, %NewY%
} else if (step = 4) {
;Clean Hackling Rake - Top/1st menu choice
Click %ClickX%, %ClickY%
step = 0
counter++
}

step++
MouseMove, %OldX%, %OldY%
Sleep 500


GuiControl, Text, ClickText, %counter% of %Cycles% cycles`n`nStep: %step% of 5 until next cycle




;This searches for a popup box, which would suggest something likely went wrong

;			PixelSearch, Px, Py, %CenterX%, %CenterY%, %CenterX%, %CenterY%, 0xECDFBD, 15, Fast|RGB
			ImageSearch, PopX, PopY, ClickPopX1, ClickPopY1, ClickPopX2, ClickPopY2, *50 OK.PNG

			if ErrorLevel = 0
			{
			SoundPlay *16,1
			Msgbox, Pop Up box detected! Pausing macro...`n`nFind the problem, correct and hit Ctrl+P.`n`nYou will resume from where you left off at...`n`nIf your flax comb just broke, then Ctrl+R to reload.
			PAUSE
			}

;End searching for popupbox










		if (Eat == "Yes")
		{
		GuiControl, Text, ClickText, %counter% of %Cycles% cycles`n`nStep: %step% of 5 until next cycle`n`nEat Grilled: %EatTimer%s of 660s

		} else {
		GuiControl, Text, ClickText, %counter% of %Cycles% cycles`n`nStep: %step% of 5 until next cycle
		}



if (Counter = Cycles)
break

	}
		}
SoundPlay *16,1
GuiControl, Text, ClickText, Processed %Flax% rotten flax, Exiting...
PAUSE




	Eat: 

	EatTimer --

	GuiControl, Text, ClickText, %counter% of %Cycles% cycles`n`nStep: %step% of 5 until next cycle`n`nEat Grilled: %EatTimer%s of 660s

	
	if EatTimer = 0
	{
	SoundPlay *64,1
	GuiControl, Text, ClickText, Eating grilled food...
	MouseGetPos, OldMX, OldMY
	;Click the Eat Grilled food menu
	Click, %EatX%, %EatY%			
	Sleep, 500
	MouseMove, %OldMX%, %OldMY%, 0			
	EatTimer = 660
	Sleep 1000
	}
	return




^r::reload
^p::Pause