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.

Titanium Macro

From A Tale in the Desert
Jump to navigationJump to search
// ATITD Titanium Ore Mining Macro for ACTool
// RELEASE: Jan-9-2009
// Script Adapted for Titanium by Xyrrus
// Original Mining Script by Coyan
//
// Setup:
//
// First align your view so you can see all 7 crystals clearly
// second use Alt-L to lock your camera angle
//
// You will have 3 seconds between the recording of each crystal's location
// place your mouse over a spot of average gem color for each crystal in turn
// Once it has identified the 7 crystals, it will run the mine
//
// ** FOR TITANIUM **
// Place your cursor over an 'average' color for the gem. The titanium macro is quite forgiving about misplaced clicks.
//
// Method:
// The goal is to click the gem which has been the same for the longest. Macro stores the previous and current RGB values for each gem. When a match is found, the gem's streak is updated. The macro clicks on the gem with the longest streak.
// Attempted to compare hex values for more efficient storage, but it resulted in floating point errors (?)
//
// Accuracy:
// Appears 95%+
// Tested Jan-9-2008 Xyrrus
// Every so often it fails for no apparant reason. If you can figure out why, please chat or email me - Xyrrus

Constructs
	MouseX=List // this is an array of mouse X coords for gem sample points
	MouseY=List // this is an array of mouse X coords for gem sample points
	
	previousRValues=List
	currentRValues=List
	
	previousGValues=List
	currentGValues=List
	
	previousBValues=List
	currentBValues=List
	
	previousStreaks=List
	currentStreaks=List
	
END

Constants
	// ** User Settable Constants **
	totalpulls = 100 	// How many times do you want it to pull the mine.
	RepairAdjust = 15 	// Adjust the vertical positining of the mouse, used when 

	// ** Other Variable **
	currentR = 0
	currentG = 0
	currentB = 0
	previousR = 0
	previousG = 0
	previousB = 0
	
	longestGem = 1 // Set this to 1, because we have no idea which is the correct gem to select the first time around.
	longestStreak = 0
	
	currentGem = 0
	
	Mousecnt = 1
	MouseX = 0
	MouseY = 0
	
	//trash variables
	temp1 = 0
End

// First part that requires a detailed explanation
// this loop will pause for 3 seconds then grab the current mouse location
// its purpose is to identify the 7 sampling locations for the crystals
// when it grabs the sampling spot, it will then echo a . to the chat window
// make sure you are in your main chat tab.

Loop 7
	Delay 3000
	Listadd MouseX, {MouseX}
	Listadd MouseY, {MouseY}
	SayPaste .
END

// Need to setup the previous values
Loop 7
	listAdd previousRValues, 0
	listAdd previousGValues, 0
	listAdd previousBValues, 0
	listAdd previousStreaks, 0
End

// Main Gathering Loop

loop $totalpulls
	
	Compute currentGem = 1
	Compute longestStreak = 0
	
	// Clear the Current List
	ListClear currentRValues
	ListClear currentGValues
	ListClear currentBValues
	ListClear currentStreaks
	
	loop 7
		mousepos MouseX[$currentGem], MouseY[$currentGem]
		LoadRGB MouseX[$currentGem], MouseY[$currentGem]

		// Setup the List
		CALL UpdateGemInfo

		Compute currentGem = $currentGem + 1
		Delay 100
	END
	//Delay 100000 for testing
	


	// Set the Old List to the Current List
	ListAssign currentRValues, previousRValues
	ListAssign currentGValues, previousGValues
	ListAssign currentBValues, previousBValues
	ListAssign currentStreaks, previousStreaks

	//keys {RETURN}
	//say mining $longestgem

	mousepos MouseX[$longestGem], MouseY[$longestGem]
	Delay 200 //200
	leftclick
	Compute MouseX = MouseX[$longestGem] + 15 // adjust this if you need to for the menu click
	Compute MouseY = MouseY[$longestGem] - $repairadjust // adjust this if you need to for the menu click
	Mousepos $MouseX, $MouseY
	Delay 200
	Leftclick
	
	Delay 4300 // Delay to manage the str/perc timer on mining, adjust as needed	
end // Main Loop

// UpdateGemInfo

Procedure UpdateGemInfo
	// Get the RGB Values for Each Gem
	Compute currentR = {RGBRed}
	Compute currentG = {RGBGreen}
	Compute currentB = {RGBBlue}
	
	listAdd currentRValues, $currentR
	listAdd currentGValues, $currentG
	listAdd currentBValues, $currentB
	
	setConst previousR = previousRValues[$currentGem]
	setConst previousG = previousGValues[$currentGem]
	setConst previousB = previousBValues[$currentGem]
	
	if $currentR = $previousR AND $currentG = $previousG AND $currentB = $previousB
		compute temp1 = previousStreaks[$currentGem] + 1
		listAdd currentStreaks, $temp1
	else
		listAdd currentStreaks, 0
	end

	if currentStreaks[$currentGem] > $longestStreak
		compute longestStreak = currentStreaks[$currentGem]
		compute longestGem = $currentGem
	end

END // Update Gem Info