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
< User:Cegaiel‎ | Macros‎ | FlaxHammock
Revision as of 01:48, 8 November 2010 by Cegaiel (talk | contribs)
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/17/2010
;Last Update: 10/11/2010 (Now asks how much you have in inventory and stops when all has been processed, automatically)
;Last Update: 11/07/2010 - Changed Papyrus to Fertile Papyrus and added option for Sterile Papyrus (N Hotkey)


;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


			PoupDelay = 300
			;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)+105



IfWinExist eGenesis Client
{
	WinActivate

	Gui, Add, Text,, What are you drying?
	Gui, Add, DropDownList, vWord Choose1, Grass|Rotten Flax|Fertile Papyrus|Sterile Papyrus
	Gui, Add, Text,, Qty you have in inventory:
	Gui, Add, Edit, vQty wp number, 
	Gui, Font, bold
	Gui, Add, Text,, `nHammock Max capacity:
	Gui, Font, norm
	Gui, Add, Text,, Grass: 200   (2 Teppy Min max)`nPapyrus: 20   (4 Teppy Min max)`nRotten Flax: 10   (2 Teppy Min max)`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



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




	MineSetLoops:
	Gui, Submit
	Gui, Destroy

	Msgbox, Make sure your chat is MINIMIZED!`n`nAfter verifying chat is minimized, Click OK to proceed...

	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineCycleText, 5 seconds countdown to drag this window out of way`n`n`n
	Gui, Font, norm
	Gui, Show
	GuiControl, Text, MineCycleText, 5 seconds countdown to drag this window out of way`n`n`n


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

SetDefaultMouseSpeed, 0




	if (Word == "Rotten Flax") {
	Hammock := "F"
	Seconds := sFlax
	minutes_eta = 2
	seconds_eta = 13
	Cycles := Ceil(Qty / (10 * TotalHammocks))

	} else if (Word == "Grass") {
	Hammock := "S"
	Seconds := sGrass
	Cycles := Ceil(Qty / (200 * TotalHammocks))
	minutes_eta = 11
	seconds_eta = 6

	} else if (Word == "Fertile Papyrus") {
	Hammock := "P"
	Seconds := sPapy
	Cycles := Ceil(Qty / (20 * TotalHammocks))
	minutes_eta = 4
	seconds_eta = 26


	} else if (Word == "Sterile Papyrus") {
	Hammock := "N"
	Seconds := sPapy
	Cycles := Ceil(Qty / (20 * TotalHammocks))
	minutes_eta = 4
	seconds_eta = 26
	}



Remaining := Cycles



	loop, %Cycles%
	{


			WinActivate, eGenesis Client
			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 250
			Send {%Hammock%}
			Sleep, 250	
			MineNum++
			GoSub, Popup
			}


			MouseMove, %OldMX%, %OldMY%, 0		

			SecondsCountDown := Seconds

			loop, %Seconds% {
			GuiControl, Text, MineCycleText, %minutes_eta%m %seconds_eta%s drying time remaining`n`n%Remaining% cycles remaining to process - %Qty% %Word%


			;SecondsCountdown := SecondsCountdown - 1
			sleep 1000
  			Gosub, Timer
			}
	
			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, 250	
			Send {T}
			Sleep, 250	
			GoSub, Popup
			MineNum++
			}

			Remaining --


			;Set the minutes/seconds countdown again, for next cycle
			if (Word == "Rotten Flax") {
			minutes_eta = 2
			seconds_eta = 13
			} else if (Word == "Grass") {
			minutes_eta = 11
			seconds_eta = 6
			} else if (Word == "Papyrus") {
			minutes_eta = 4
			seconds_eta = 26
			}




			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
}



			Popup:

			;Search for the RBG color of 0xECDFBD (Same as HTML code: #ECDFBD)

			PixelSearch, Px, Py, %CenterX%, %CenterY%, %CenterX%, %CenterY%, 0xEBDDBB, %shade%, Fast|RGB

			if ErrorLevel = 0
			{
			Sleep %PopupDelay%
			MouseMove, %CenterX%, %CenterY%
			Sleep %PopupDelay%
			Click
			Sleep %PopupDelay%
			}
			return



		Timer:
		
		if (seconds_eta = 0) and !(minutes_eta = 0)
		{
		seconds_eta := 60
		minutes_eta --
		}
		
		if (minutes_eta < 0)
		minutes_eta := 0

		seconds_eta --
		return



^r::reload
^p::Pause