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.

Difference between revisions of "User:Cegaiel/Macros/MaltingTray/Code"

From ATITD6
Jump to navigationJump to search
(Created page with "<pre> ;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 5/9/2010 ;Explanation of Second...")
 
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
;Ctrl+R to reload script
 
;Ctrl+R to reload script
 
;Date 5/9/2010
 
;Date 5/9/2010
 
+
;Last Update 2/4/2012 - GUI now appears on upper left corner of screen, instead of middle.
  
 
;Explanation of Seconds variable below:
 
;Explanation of Seconds variable below:
Line 41: Line 41:
  
 
Gui, Add, Button, default gMineSetLoops, OK
 
Gui, Add, Button, default gMineSetLoops, OK
Gui, Show
+
Gui, Show, x0 y25
  
 
MineNum = 0
 
MineNum = 0
Line 84: Line 84:
 
Gui, Add, Text, vMineCycleText, 5 seconds to drag window out of way
 
Gui, Add, Text, vMineCycleText, 5 seconds to drag window out of way
 
Gui, Font, norm
 
Gui, Font, norm
Gui, Show
+
Gui, Show, x0 y25
 
GuiControl, Text, MineCycleText, 5 seconds to drag window out of way
 
GuiControl, Text, MineCycleText, 5 seconds to drag window out of way
  
Line 119: Line 119:
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 
MouseMove, %MinePosX%, %MinePosY%, 0
 
MouseMove, %MinePosX%, %MinePosY%, 0
Sleep, 150
+
Sleep, 100
 
Send {M}
 
Send {M}
Sleep, 150
+
Sleep, 100
Send {M}
 
Sleep, 150
 
 
MineNum++
 
MineNum++
 
}
 
}
Line 152: Line 150:
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 
MouseMove, %MinePosX%, %MinePosY%, 0
 
MouseMove, %MinePosX%, %MinePosY%, 0
Sleep, 150
+
Sleep, 100
Send {T}
 
Sleep, 150
 
 
Send {T}
 
Send {T}
Sleep, 150
+
Sleep, 100
 
MineNum++
 
MineNum++
 
}
 
}

Latest revision as of 10:31, 4 February 2012

;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 5/9/2010
;Last Update 2/4/2012 - GUI now appears on upper left corner of screen, instead of middle.

;Explanation of Seconds variable below:

;It takes about 67 seconds for the malting to complete. The more trays you have, the less time you may need.
;ie having many trays can decrease the seconds required because of the time it took to load the other trays...

;67s for 1 tray
;63s for 9 trays


Seconds = 67



IfWinExist eGenesis Client
{
	WinActivate

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

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

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

	AFTER setting malting tray locations, Press OK...

	)

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

	MineNum = 0
	NumPulls = 100




	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% malting trays captured
	TotalTrays := 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, x0 y25
	GuiControl, Text, MineCycleText, 5 seconds to drag window out of way


	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

	loop, %NumPulls%
	{


			MineNum = 1
			MouseGetPos, OldMX, OldMY


	;Malting Loop
	loop, %TotalTrays% {

			WinActivate, eGenesis Client

			;BlockInput, MouseMove
			GuiControl, Text, MineCycleText, Malting Barley -  Tray: %MineNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			Sleep, 100	
			Send {M}
			Sleep, 100	
			MineNum++
			}


			MouseMove, %OldMX%, %OldMY%, 0		

			SecondsCountDown := Seconds

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


			
			;Take Malt

			loop, %TotalTrays% {

			WinActivate, eGenesis Client

			GuiControl, Text, MineCycleText, Taking Malt -  Tray: %MineNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			Sleep, 100	
			Send {T}
			Sleep, 100	
			MineNum++
			}




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


	}


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


^r::reload
^p::Pause