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/SandMining/Code

From A Tale in the Desert
< User:Cegaiel‎ | Macros‎ | SandMining
Revision as of 22:56, 24 October 2010 by Cegaiel (talk | contribs) (New page: <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: 10/24/2010 ;Author: Cegaiel ;Credits to Ta...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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: 10/24/2010
;Author: Cegaiel
;Credits to Takhetu for the loop/code that generates the combinations, of which mines to click.


;Info from Wiki:
;Alcyone - Topaz
;Celeano - Emerald
;Maia - Ruby
;Merope - Sapphire
;Sterope - Quartz
;Taygete - Opal
;Sinai - Diamond



	ChatWarning = 0


	Start:


;	// START CONIGURATION AREA

	;Set the speed in microsends (100 = 1/10th second, 1000 = 1 second, etc)
	;If you got a slower computer or lag, then try raising it 100 at a time, ie 200, 300
	;This is the speed that it highlights your mine crystals

	Delay = 150  ;Original is 150

	;If you have problems with it not closing the popup, then try adjusting this number higher.

	PopUpDelay = 250  ;Original is 250

	;This is the shade at which is searches the for the color of the popup box.
	;If yourself running all the time, ie its confusing sand with the popup, then try lowering 5 at a time (ie 20,15,etc).
	;If you find it is not even seeing the popup box, then try raising 5 at a time (ie 30,35,etc)

	Shade = 25  ;Original is 25

;	// END CONIGURATION AREA




MineNum = 0

IfWinExist eGenesis Client
{
	;WinActivate



	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineNumText, Record crystal positions
	Gui, Font, norm
	Gui, Add, Text,,
	( LTrim
	Hover and middle-click (Click mouse-wheel) on each mine crystal, one by one,
	until you've clicked on all the crystals. 

	AFTER setting (middle clicking) all your crystals, then click the OK button.

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


	Reminder: Ctrl+P to Pause  -  Ctrl+R to Reload

	)

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


	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% crystals captured
	return


	MineSetLoops:
	Gui, Submit
	Gui, Destroy



	SetDefaultMouseSpeed, 0


	if ChatWarning = 0
	Msgbox, Make sure your chat is MINIMIZED!`n`nThis message will not display again :)`n`n`n`nFYI - Wiki suggests:`n`nAclyone - Topaz`nCeleano - Emerald`nMaia - Ruby`nMerope - Sapphire`nSterope - Quartz`nTaygete - Opal`nSinai - Diamond


			WinActivate, eGenesis Client
			WinWait, eGenesis Client

			WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos 

			;Get coordinates, for your resolutions'  X,Y location of the popups that will occur later.
			CenterX := Floor(Xmax/2)
			CenterY := Floor(Ymax/2)+103








Loop 5
{

	FirstStone := A_Index
	NumToRun1 := 6-A_Index

	Loop, %NumToRun1%
	{
		SecondStone := FirstStone+A_Index
		NumToRun2 := 5-A_Index 

		Loop, %NumToRun2%
		{
			ThirdStone := SecondStone+A_Index





MouseMove, MineX%FirstStone%, MineY%FirstStone%
;Msgbox, FirstStone: MineX%FirstStone%, MineY%FirstStone%
Sleep %Delay%
Send {A}
Sleep %Delay%
MouseMove, MineX%SecondStone%, MineY%SecondStone%
;Msgbox, SecondStone: MineX%SecondStone%, MineY%SecondStone%
Sleep %Delay%
Send {A}
Sleep %Delay%
MouseMove, MineX%Thirdstone%, MineY%Thirdstone%
;Msgbox, ThirdStone: MineX%Thirdstone%, MineY%Thirdstone%
Sleep %Delay%
Send {A}
Sleep %Delay%
Send {S}
Sleep %Delay%
Gosub, Popup

		}
	}
}



	if ChatWarning = 0
	{
	Msgbox, Done, Click the mine and get a new workload!`n`nThis message will not display again :)
	ChatWarning = 1
	}

	Gosub, Start
	return
}

Popup:

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

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

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





^r::reload
^p::Pause