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/Kilns/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
;Date 3/17/2010

;Explanation of Seconds variable below:

;If you find the kilns are getting done slightly late:
;(ie it begins making more kilns before they are done), then add 1 second at a time, below

;If you find the kilns are firing before the timer is done,
;(ie there is 1 or more seconds remaining on timer when kilns get done) then decrease 1 second at a time

;It takes about 140 seconds for the kilns to fire, but the time it takes from when the first rack is loaded
;until the time the last one is loaded is the reason that time varies


;About 130s for 10 kilns
;About ---s for -- kilns
;About ---s for -- kilns

Seconds = 130







IfWinExist eGenesis Client
{
	WinActivate

	Gui, Add, Text,, Items to fire:
	Gui, Add, DropDownList, vBrick Choose1, Jugs|Firebricks|Clay Bricks

	Gui, Add, Text,, `nHow many Firings?
	Gui, Add, Edit, vNumPulls wp number

	Gui, Add, Button, gRecord, NEXT

	Gui, Show, x0 y25
	return



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

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

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

	AFTER setting kiln locations, Press OK...

	)

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

	MineNum = 0
;	NumPulls = 100



	if (Brick == "Jugs") {
	Bricks := "J"
	} else if (Brick == "Firebricks") {
	Bricks := "F"
	} else if (Brick == "Clay Bricks") {
	Bricks := "C"
	}



	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% kilns captured
	TotalRacks := 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`n`n
	Gui, Font, norm
	Gui, Show, x0 y25
	GuiControl, Text, MineCycleText, 5 seconds to drag window out of way`n`n


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



SetDefaultMouseSpeed, 0
Firing = 0


	loop, %NumPulls%
	{

			Firing ++
			MineNum = 1
			MouseGetPos, OldMX, OldMY


	;Make Bricks Loop
	loop, %TotalRacks% {

			WinActivate, eGenesis Client

			;BlockInput, MouseMove
			GuiControl, Text, MineCycleText, Loading Kilns -  Kiln: %MineNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			sleep 200
			Send {%Bricks%}
			Sleep, 50
			Send {W}
			Sleep, 100
			Send {F}
			Sleep, 200	
			MineNum++
			}


			MouseMove, %OldMX%, %OldMY%, 0		

			SecondsCountDown := Seconds

			loop, %Seconds% {
			GuiControl, Text, MineCycleText, Waiting %SecondsCountdown%s for kilns to finish firing`n`nFirings: %Firing% of %NumPulls% 
			SecondsCountdown := SecondsCountdown - 1
			sleep 1000
			}
	
			MineNum = 1


			
			;Take Bricks

			loop, %TotalRacks% {

			WinActivate, eGenesis Client

			GuiControl, Text, MineCycleText, Taking Fired Items -  Kiln: %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 
			Sleep 2000


	}


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


^r::reload
^p::Pause