The Wiki for Tale 4 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/FlaxHammock/Code

From A Tale in the Desert
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

^r::reload
^p::Pause
^!w::

;Wheat is not supported due to the way it brings up a menu and makes you manually select which wheat you are drying

;This is the times based on using 1 hammock. However, the more hammocks you have, the less seconds you will need
;The reason is because the timer doesn't start until the last hammock is loaded.
;If you have 20 hammocks, then it might take 10 seconds to load them all. In that case it would be 10 seconds less

;Rotten flax = 2 Teppy Mins (2:13 real time / 133 seconds)
;Grass = 10 Teppy Mins (11:06 real time / 666 seconds)
;Papy = 4 Teppy Mins (4:26 real time / 266 seconds)


;Time in seconds, 
sFlax = 133
sGrass = 666
sPapy = 266




IfWinExist eGenesis Client
{
	WinActivate

	Gui, Add, Text,, What are you drying?
	Gui, Add, DropDownList, vWord Choose3, Grass|Papyrus|Rotten Flax
	Gui, Add, Text,, Cycles:
	Gui, Add, Edit, vCycles wp number, 100
	Gui, Add, Text,, Cycles = Qty Resources / (Total Hammocks x Max capacity),`nie 100 papyrus using 5 hammocks = 5 cycles`n1 Cycle = Loading, Drying and Taking from ALL hammocks, 1 time`n`nLeave as high number if you will be manually stopping the macro
	Gui, Font, bold
	Gui, Add, Text,, Hammock Max capacity:
	Gui, Font, norm
	Gui, Add, Text,, Grass: 200`nPapyrus: 20`nRotten Flax: 10`n
	Gui, Add, Button, gRecord, Next
	Gui, Show
	return


	Record:
	Gui, Submit
	Gui, Destroy
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineNumText, Record hammock locations
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	Hover and middle-click (Click mouse-wheel) on each hammock, one by one,
	until you've clicked on all the hammocks you want to use. Then click the OK button.

	(Drag this box out of the way if any hammocks are hidden)

	Make sure you chat is minimized and that your screen is locked (Alt+L)

	AFTER setting hammock locations, Press OK...

	)

	Gui, Add, Button, default gMineSetLoops, OK
	Gui, Show

	MineNum = 0


	if (Word == "Rotten Flax") {
	Hammock := "F"
	Seconds := sFlax

	} else if (Word == "Grass") {
	Hammock := "S"
	Seconds := sGrass

	} else if (Word == "Papyrus") {
	Hammock := "P"
	Seconds := sPapy
	}



	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% hammocks captured
	TotalHammocks := MineNum
	return


	MineSetLoops:
	Gui, Submit
	Gui, Destroy
	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineCycleText, 5 seconds to drag window out of way
	Gui, Font, norm
	Gui, Show
	GuiControl, Text, MineCycleText, 5 seconds to drag window out of way


	seconds = 5
	;You got 5 seconds to drag the status window out of the way
	Loop, %seconds%
	{
	GuiControl, Text, MineCycleText, %seconds%s countdown, drag window out of way
	seconds --
	Sleep 1000
	}

SetDefaultMouseSpeed, 0


	loop, %Cycles%
	{


			MineNum = 1
			MouseGetPos, OldMX, OldMY


	;Dry Hammock Loop
	loop, %TotalHammocks% {

			WinActivate, eGenesis Client

			;BlockInput, MouseMove
			GuiControl, Text, MineCycleText, Drying %Word% -  Hammock: %MineNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			sleep 200
			Send {%Hammock%}
			Sleep, 200	
			MineNum++
			}


			MouseMove, %OldMX%, %OldMY%, 0		

			SecondsCountDown := Seconds

			loop, %Seconds% {
			GuiControl, Text, MineCycleText, Waiting %SecondsCountdown%s for %Word% to dry 
			SecondsCountdown := SecondsCountdown - 1
			sleep 1000
			}
	
			MineNum = 1


			
			;Take Dried Items

			loop, %TotalHammocks% {

			WinActivate, eGenesis Client

			GuiControl, Text, MineCycleText, Taking %Word% -  Hammock: %MineNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			Sleep, 200	
			Send {T}
			Sleep, 200	
			MineNum++
			}




			GuiControl, Text, MineCycleText, 2s Pause, Hit Ctrl+P to STOP HAMMOCKS 
			Sleep 2000


	} 

	Gui, Destroy
	Gui, Add, Text,, Middle-click on this window to end the script.
	Gui, Show
	return
}