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.

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

From A Tale in the Desert
Jump to navigationJump to search
Line 3: Line 3:
 
;The AHK icon in system tray will turn red while paused.
 
;The AHK icon in system tray will turn red while paused.
 
;Ctrl+R to reload script
 
;Ctrl+R to reload script
;Date 3/17/2010
+
;Date 4/27/2010
  
 
^r::reload
 
^r::reload
Line 17: Line 17:
 
;(ie there is 1 or more seconds remaining on timer when jugs get done) then decrease 1 second at a time
 
;(ie there is 1 or more seconds remaining on timer when jugs get done) then decrease 1 second at a time
  
;It takes about 69 seconds for the jugs to form, but the time it takes from when the first rack is loaded
+
;It takes about 33 seconds for the jugs to form, but the time it takes from when the first wheel is loaded
 
;until the time the last one is loaded is the reason that time varies
 
;until the time the last one is loaded is the reason that time varies
  
  
 
;About 69s for 1 wheel
 
;About 69s for 1 wheel
;About 59s for 36 wheels
+
;About 58s for 36 wheels
  
Seconds = 59
+
 
 +
Seconds = 58
 +
 
 +
 
 +
 
 +
 
 +
;X/Y mouse coordinates of a popup box's OK button (yellowish part of the OK button, not the black text)
 +
;529,476 is the position of OK button in 1024x768 resolution
 +
;You can find out your position, at your resolution, with a free tool called Magnify at:
 +
;http://www.atitd.org/wiki/tale4/User:Cegaiel/Macros#Tool:_Magnify_.28Windows_Executable.29
 +
 
 +
 
 +
PopX = 529
 +
PopY = 476
  
  
Line 61: Line 74:
  
 
MineNum = 0
 
MineNum = 0
NumPulls = 100
 
  
  
Line 121: Line 133:
  
  
loop, %NumPulls%
+
loop
 
{
 
{
  
Line 130: Line 142:
  
 
;Make Jugs Loop
 
;Make Jugs Loop
loop, %TotalRacks% {
+
loop, %TotalRacks%
 +
{
  
 
WinActivate, eGenesis Client
 
WinActivate, eGenesis Client
 +
 +
 +
 +
  
 
;BlockInput, MouseMove
 
;BlockInput, MouseMove
Line 139: Line 156:
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 
MouseMove, %MinePosX%, %MinePosY%, 0
 
MouseMove, %MinePosX%, %MinePosY%, 0
sleep 200
+
Sleep 100
 
Send {J}
 
Send {J}
Sleep, 200
+
Gosub, SearchPopupBox
 
MineNum++
 
MineNum++
 
}
 
}
 +
 +
 +
  
  
Line 152: Line 172:
 
loop, %Seconds% {
 
loop, %Seconds% {
 
GuiControl, Text, MineCycleText, Waiting %SecondsCountdown%s for Jugs to complete  
 
GuiControl, Text, MineCycleText, Waiting %SecondsCountdown%s for Jugs to complete  
SecondsCountdown := SecondsCountdown - 1
+
SecondsCountdown --
 
sleep 1000
 
sleep 1000
 
}
 
}
Line 165: Line 185:
  
 
WinActivate, eGenesis Client
 
WinActivate, eGenesis Client
 +
 +
 +
  
 
GuiControl, Text, MineCycleText, Taking Jugs -  Wheel: %MineNum%  
 
GuiControl, Text, MineCycleText, Taking Jugs -  Wheel: %MineNum%  
Line 170: Line 193:
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 
MouseMove, %MinePosX%, %MinePosY%, 0
 
MouseMove, %MinePosX%, %MinePosY%, 0
Sleep, 200
+
Sleep, 100
 
Send {T}
 
Send {T}
Sleep, 200
+
Gosub, SearchPopupBox
 
MineNum++
 
MineNum++
 
}
 
}
Line 191: Line 214:
 
return
 
return
 
}
 
}
 +
 +
 +
SearchPopupBox:
 +
;This searches for a poup box which I occassionally would get (Pottery wheel busy) and closes it immediately.
 +
 +
PixelSearch, Px, Py, %PopX%, %PopY%, %PopX%, %PopY%, 0xECDFBD, 25, Fast|RGB
 +
 +
if ErrorLevel = 0
 +
Click, %PopX%, %PopY%
 +
 +
Sleep 200
 +
return
 
</pre>
 
</pre>

Revision as of 01:12, 28 April 2010

;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 4/27/2010

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

;Explanation of Seconds variable below:

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

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

;It takes about 33 seconds for the jugs to form, but the time it takes from when the first wheel is loaded
;until the time the last one is loaded is the reason that time varies


;About 69s for 1 wheel
;About 58s for 36 wheels


Seconds = 58




;X/Y mouse coordinates of a popup box's OK button (yellowish part of the OK button, not the black text)
;529,476 is the position of OK button in 1024x768 resolution
;You can find out your position, at your resolution, with a free tool called Magnify at:
;http://www.atitd.org/wiki/tale4/User:Cegaiel/Macros#Tool:_Magnify_.28Windows_Executable.29


PopX = 529
PopY = 476






IfWinExist eGenesis Client
{
	WinActivate



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

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

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

	AFTER setting pottery wheel locations, Press OK...

	)

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

	MineNum = 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% pottery wheel 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
	Gui, Font, norm
	Gui, Show
	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
	{


			MineNum = 1
			MouseGetPos, OldMX, OldMY


	;Make Jugs Loop
	loop, %TotalRacks%
			{

			WinActivate, eGenesis Client





			;BlockInput, MouseMove
			GuiControl, Text, MineCycleText, Making Jugs -  Wheel: %MineNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			Sleep 100
			Send {J}
			Gosub, SearchPopupBox
			MineNum++
			}





			MouseMove, %OldMX%, %OldMY%, 0		

			SecondsCountDown := Seconds

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


			
			;Take Jugs

			loop, %TotalRacks% {

			WinActivate, eGenesis Client




			GuiControl, Text, MineCycleText, Taking Jugs -  Wheel: %MineNum% 
			MinePosX := MineX%MineNum%
			MinePosY := MineY%MineNum%
			MouseMove, %MinePosX%, %MinePosY%, 0
			Sleep, 100	
			Send {T}
			Gosub, SearchPopupBox
			MineNum++
			}




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


	}


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


SearchPopupBox:
;This searches for a poup box which I occassionally would get (Pottery wheel busy) and closes it immediately.

PixelSearch, Px, Py, %PopX%, %PopY%, %PopX%, %PopY%, 0xECDFBD, 25, Fast|RGB

if ErrorLevel = 0
Click, %PopX%, %PopY%

Sleep 200
return