The Wiki for Tale 5 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.

CoD/silver

From ATITD5
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
;Release 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/30/2010




	ChatWarning = 0


;	// START CONFIGURATION 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 selects/highlights your ore stones
	;If you fail to see all the stones getting selected, or getting "Ore Busy" popup messages, etc

		Delay = 200  ;Safe (lag) is 200+, Fast is 100 (fast computer, no lag)


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

		PopUpDelay = 300  ;Safe (lag) is 300+, Fast is 100 (fast computer, no lag)



;	// END CONFIGURATION AREA



			IfWinExist eGenesis Client
			{

			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 (OK button) that will occur later.
			CenterX := Floor(Xmax/2)
			CenterY := Floor(Ymax/2)+103


			;Offsets the search coordinates for OK popup for the imagesearch in Popup sub.
			ClickPopX1 := CenterX - 40
			ClickPopY1 := CenterY - 30

			ClickPopX2 := CenterX + 30
			ClickPopY2 := CenterY + 30


			} else {
			MsgBox, eGenesis Client not running, aborting...
			Exit
			}


	Start:

	MineNum = 0



	Gui, +AlwaysOnTop +ToolWindow
	Gui, Font, bold
	Gui, Add, Text, vMineNumText, Record ore stone 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 stones. 

	AFTER setting (middle clicking) all your stones, then click the START 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, START
	Gui, Show, x0 y25


	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% ore stones 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 :)




Sleep 1000

MainLoop := MineNum-3

Loop %MainLoop%
{

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

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

		Loop, %NumToRun2%
		{
			ThirdStone := SecondStone+A_Index
			;NumToRun3 := 4-A_Index 
			NumToRun3 := MineNum-ThirdStone

			Loop, %NumToRun3%
			{
				FourthStone := ThirdStone+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%
MouseMove, MineX%FourthStone%, MineY%FourthStone%
;Msgbox, FourthStone: MineX%FourthStone%, MineY%FourthStone%
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:

			ImageSearch, PopX, PopY, ClickPopX1, ClickPopY1, ClickPopX2, ClickPopY2, *50 OK.PNG
			if ErrorLevel = 0
			{
			NewX := PopX + 3
			NewY := PopY + 3

			MouseMove, %NewX%, %NewY%
			Sleep %PopupDelay%
			Click
			Sleep %PopupDelay%
			}
			return




			PopupOld:

			;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
			{
			Sleep %PopupDelay%
			MouseMove, %CenterX%, %CenterY%
			Sleep %PopupDelay%
			Click
			Sleep %PopupDelay%
			}
			return





^r::reload
^p::Pause