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/FlaxHammock/Code"

From A Tale in the Desert
Jump to navigationJump to search
 
(7 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
;Ctrl+R to reload script
 
;Ctrl+R to reload script
 
;Date 3/17/2010
 
;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: 12/17/2010
;Last Update: 11/07/2010 - Changed Papyrus to Fertile Papyrus and added option for Sterile Papyrus (N Hotkey)
+
;Author: Cegaiel
 +
 
  
  
Line 25: Line 26:
  
  
PoupDelay = 300
+
 
 +
 
 +
 
 +
; // CONFIGURATION
 +
 
 +
 
 +
;Set Delay to 100-150 for fast computer/not much lag. 250 for slower computer.
 +
 
 +
Delay = 125
 +
 
 +
 
 +
 
 +
;Set PopupDelay to 150-200 for fast computer, about 250+ for slower computers (or lots of lag)
 +
 
 +
PoupDelay = 200
 +
 
 +
 
 +
; // END CONFIGURATION
 +
 
 +
 
 +
 
 +
 
 +
 
 
;Get coordinates, for your resolutions'  X,Y location of the popups (OK button) that will occur later.
 
;Get coordinates, for your resolutions'  X,Y location of the popups (OK button) that will occur later.
 
CenterX := Floor(Xmax/2)
 
CenterX := Floor(Xmax/2)
Line 35: Line 58:
 
{
 
{
 
WinActivate
 
WinActivate
 
+
Gui, +AlwaysOnTop +ToolWindow
 
Gui, Add, Text,, What are you drying?
 
Gui, Add, Text,, What are you drying?
 
Gui, Add, DropDownList, vWord Choose1, Grass|Rotten Flax|Fertile Papyrus|Sterile Papyrus
 
Gui, Add, DropDownList, vWord Choose1, Grass|Rotten Flax|Fertile Papyrus|Sterile Papyrus
 
Gui, Add, Text,, Qty you have in inventory:
 
Gui, Add, Text,, Qty you have in inventory:
 
Gui, Add, Edit, vQty wp number,  
 
Gui, Add, Edit, vQty wp number,  
Gui, Font, bold
 
 
Gui, Add, Text,, `nHammock Max capacity:
 
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, 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, Add, Button, gRecord, Next
Gui, Show
+
Gui, Show, x0 y25
 
return
 
return
  
Line 70: Line 91:
  
 
Gui, Add, Button, default gMineSetLoops, OK
 
Gui, Add, Button, default gMineSetLoops, OK
Gui, Show
+
Gui, Show, x0 y25
  
 
MineNum = 0
 
MineNum = 0
 
+
PerCycle = 0
 
+
Dried = 0
  
 
SetDefaultMouseSpeed, 0
 
SetDefaultMouseSpeed, 0
Line 117: Line 138:
 
Gui, +AlwaysOnTop +ToolWindow
 
Gui, +AlwaysOnTop +ToolWindow
 
Gui, Font, bold
 
Gui, Font, bold
Gui, Add, Text, vMineCycleText, 5 seconds countdown to drag this window out of way`n`n`n
+
 
Gui, Font, norm
+
Gui, Add, Text, vMineCycleText, 5 seconds countdown to drag this window out of way`n`n`n`n
Gui, Show
+
Gui, Show, x0 y25
GuiControl, Text, MineCycleText, 5 seconds countdown to drag this window out of way`n`n`n
+
GuiControl, Text, MineCycleText, 5 seconds countdown to drag this window out of way`n`n`n`n
  
  
Delay = 5
+
StartDelay = 5
 
;You got 5 seconds to drag the status window out of the way
 
;You got 5 seconds to drag the status window out of the way
Loop, %Delay%
+
Loop, %StartDelay%
 
{
 
{
GuiControl, Text, MineCycleText, %Delay%s countdown to drag this window out of way`n`n`n
+
GuiControl, Text, MineCycleText, %StartDelay%s countdown to drag this window out of way`n`n`n`n
Delay --
+
StartDelay --
 
Sleep 1000
 
Sleep 1000
 
}
 
}
Line 140: Line 161:
 
Hammock := "F"
 
Hammock := "F"
 
Seconds := sFlax
 
Seconds := sFlax
 +
Cycles := Ceil(Qty / (10 * TotalHammocks))
 +
PerHammock := 10
 
minutes_eta = 2
 
minutes_eta = 2
 
seconds_eta = 13
 
seconds_eta = 13
Cycles := Ceil(Qty / (10 * TotalHammocks))
 
  
 
} else if (Word == "Grass") {
 
} else if (Word == "Grass") {
Line 148: Line 170:
 
Seconds := sGrass
 
Seconds := sGrass
 
Cycles := Ceil(Qty / (200 * TotalHammocks))
 
Cycles := Ceil(Qty / (200 * TotalHammocks))
 +
PerHammock := 200
 
minutes_eta = 11
 
minutes_eta = 11
 
seconds_eta = 6
 
seconds_eta = 6
Line 155: Line 178:
 
Seconds := sPapy
 
Seconds := sPapy
 
Cycles := Ceil(Qty / (20 * TotalHammocks))
 
Cycles := Ceil(Qty / (20 * TotalHammocks))
 +
PerHammock := 20
 
minutes_eta = 4
 
minutes_eta = 4
 
seconds_eta = 26
 
seconds_eta = 26
Line 163: Line 187:
 
Seconds := sPapy
 
Seconds := sPapy
 
Cycles := Ceil(Qty / (20 * TotalHammocks))
 
Cycles := Ceil(Qty / (20 * TotalHammocks))
 +
PerHammock := 20
 
minutes_eta = 4
 
minutes_eta = 4
 
seconds_eta = 26
 
seconds_eta = 26
Line 168: Line 193:
  
  
 
+
PerCycle := PerHammock * MineNum
 
Remaining := Cycles
 
Remaining := Cycles
 
 
  
 
loop, %Cycles%
 
loop, %Cycles%
Line 192: Line 215:
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 
MouseMove, %MinePosX%, %MinePosY%, 0
 
MouseMove, %MinePosX%, %MinePosY%, 0
sleep 250
+
sleep %Delay%
 
Send {%Hammock%}
 
Send {%Hammock%}
Sleep, 250
+
Sleep, %Delay%
 
MineNum++
 
MineNum++
 
GoSub, Popup
 
GoSub, Popup
Line 205: Line 228:
  
 
loop, %Seconds% {
 
loop, %Seconds% {
GuiControl, Text, MineCycleText, %minutes_eta%m %seconds_eta%s drying time remaining`n`n%Remaining% cycles remaining to process - %Qty% %Word%
+
Gui, Font, bold
 
+
GuiControl, Text, MineCycleText, %minutes_eta%m %seconds_eta%s drying time remaining (%Word%)`n`n%Remaining% of %cycles% cycles remaining to process `n`nDried: %Dried% of %Qty%
 +
Gui, Font, norm
 +
Gui, Add, Text,,
 +
( LTrim
 +
 +
%Remaining% cycles remaining to process: %Word%`nDried: %Dried%
 +
)
  
 
;SecondsCountdown := SecondsCountdown - 1
 
;SecondsCountdown := SecondsCountdown - 1
Line 229: Line 258:
 
MinePosY := MineY%MineNum%
 
MinePosY := MineY%MineNum%
 
MouseMove, %MinePosX%, %MinePosY%, 0
 
MouseMove, %MinePosX%, %MinePosY%, 0
Sleep, 250
+
Sleep, %Delay%
 
Send {T}
 
Send {T}
Sleep, 250
+
Sleep, %Delay%
 
GoSub, Popup
 
GoSub, Popup
 
MineNum++
 
MineNum++
Line 237: Line 266:
  
 
Remaining --
 
Remaining --
 
+
Dried := Dried + PerCycle
  
 
;Set the minutes/seconds countdown again, for next cycle
 
;Set the minutes/seconds countdown again, for next cycle
Line 246: Line 275:
 
minutes_eta = 11
 
minutes_eta = 11
 
seconds_eta = 6
 
seconds_eta = 6
} else if (Word == "Papyrus") {
+
} else if (Word == "Fertile Papyrus") {
 +
minutes_eta = 4
 +
seconds_eta = 26
 +
} else if (Word == "Sterile Papyrus") {
 
minutes_eta = 4
 
minutes_eta = 4
 
seconds_eta = 26
 
seconds_eta = 26
Line 271: Line 303:
  
 
;Search for the RBG color of 0xECDFBD (Same as HTML code: #ECDFBD)
 
;Search for the RBG color of 0xECDFBD (Same as HTML code: #ECDFBD)
;Was having too much problems with Sterope public sand mine.
 
;The shade would work one day and not the next, always adjusting and something I still kept walking randomly from misclick
 
;So this has been aborted and using imagesearch method
 
  
 
PixelSearch, Px, Py, %CenterX%, %CenterY%, %CenterX%, %CenterY%, 0xEBDDBB, %shade%, Fast|RGB
 
PixelSearch, Px, Py, %CenterX%, %CenterY%, %CenterX%, %CenterY%, 0xEBDDBB, %shade%, Fast|RGB
Line 279: Line 308:
 
if ErrorLevel = 0
 
if ErrorLevel = 0
 
{
 
{
Sleep %PopupDelay%
 
 
MouseMove, %CenterX%, %CenterY%
 
MouseMove, %CenterX%, %CenterY%
 
Sleep %PopupDelay%
 
Sleep %PopupDelay%

Latest revision as of 09:42, 17 December 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 3/17/2010
;Last Update: 12/17/2010
;Author: Cegaiel



;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





			; // CONFIGURATION


			;Set Delay to 100-150 for fast computer/not much lag. 250 for slower computer.

			Delay = 125



			;Set PopupDelay to 150-200 for fast computer, about 250+ for slower computers (or lots of lag)

			PoupDelay = 200


			; // END CONFIGURATION





			;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, +AlwaysOnTop +ToolWindow
	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, Add, Text,, `nHammock Max capacity:
	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, x0 y25
	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, x0 y25

	MineNum = 0
	PerCycle = 0
	Dried = 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`n
	Gui, Show, x0 y25
	GuiControl, Text, MineCycleText, 5 seconds countdown to drag this window out of way`n`n`n`n


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

SetDefaultMouseSpeed, 0




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

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

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


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


PerCycle := PerHammock * MineNum
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 %Delay%
			Send {%Hammock%}
			Sleep, %Delay%	
			MineNum++
			GoSub, Popup
			}


			MouseMove, %OldMX%, %OldMY%, 0		

			SecondsCountDown := Seconds

			loop, %Seconds% {
			Gui, Font, bold
			GuiControl, Text, MineCycleText, %minutes_eta%m %seconds_eta%s drying time remaining (%Word%)`n`n%Remaining% of %cycles% cycles remaining to process `n`nDried: %Dried% of %Qty%
			Gui, Font, norm
			Gui, Add, Text,,
			( LTrim
	
			%Remaining% cycles remaining to process: %Word%`nDried: %Dried%
			)

			;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, %Delay%	
			Send {T}
			Sleep, %Delay%	
			GoSub, Popup
			MineNum++
			}

			Remaining --
			Dried := Dried + PerCycle

			;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 == "Fertile Papyrus") {
			minutes_eta = 4
			seconds_eta = 26
			} else if (Word == "Sterile 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
			{
			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