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

From A Tale in the Desert
Jump to navigationJump to search
Line 64: Line 64:
 
Gui, Add, Text,,
 
Gui, Add, Text,,
 
( LTrim
 
( LTrim
Hover and middle-click (Click mouse-wheel) on each mine crystal, one by one,
+
Hover and middle-click (Click mouse-wheel) on each ore stone, one by one,
 
until you've clicked on all the crystals.  
 
until you've clicked on all the crystals.  
  
AFTER setting (middle clicking) all your crystals, then click the OK button.
+
AFTER setting (middle clicking) all your stones, then click the OK button.
  
(Drag this box out of the way if any crystals are hidden)
+
(Drag this box out of the way if any stones are hidden)
  
  
Line 118: Line 118:
  
 
if ChatWarning = 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
+
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`n`nMake sure you are mining in the correct region.
  
  

Revision as of 01:27, 26 October 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: 10/24/2010
;Author: Cegaiel
;Credits to Takhetu for the loop/code that generates the combinations, of which mines to click.

Last Update: 10/24/2010 - At 9:14PM (-4 GMT) on same day as original release date.


;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 microseconds (100 = 1/10th second, 1000 = 1 second, etc)
	;If you got a slower computer or lag, then try raising it 50 or 100 at a time, ie 200, 250, 300
	;This is the speed that it highlights your mine crystals

	Delay = 200  ;Original is 200

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

	PopUpDelay = 300  ;Original is 300

	;This is the shade at which is searches the for the color of the popup box.
	;If you find 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 and finetune 1 at a time (ie 30,35,etc)

	Shade = 24  ;Original is 24

;	// 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 ore stone, one by one,
	until you've clicked on all the crystals. 

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

	(Drag this box out of the way if any stones 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`n`nMake sure you are mining in the correct region.


			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




MainLoop := MineNum-2

Loop %MainLoop%
{

	FirstStone := A_Index
;	NumToRun1 := 6-A_Index
	NumToRun1 := MineNum-A_Index-1

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

		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