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.

Tin macro

From A Tale in the Desert
Jump to navigationJump to search

Please talk to Coyan or Xyrrus if you have a change or addition to make.

// ATITD Tin Ore Mining Macro for ACTool
// RELEASE: Jan-9-2009
// Original Mining Script by Coyan
// Adapted for Tin by Xyrrus
//
// 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 TIN ** Place your cursor over the **DARKEST PART* of each particular gem or you will experience higher failure rates.
// This is often the base/corner of the crystal.
//
// Method:
// Script mines the gem with the lowest blue component value.
//
// Accuracy:
// Tested 50 pulls, 3 errors. - Xyrrus Jan-9-2009
// Incidently, this is better than many players report by hand.

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
	CrysBlue=List
	OEOffset=List
END

Constants
	OELevel = 3	// ** SET THIS ** to the 'depth' you want the memory game to play. A higher number will mean that you will achieve higher quantities per pull. However, a failure means that the sequence is reset and you will get "failed" messages equal to this number. Set this higher if you're very confident in your ability to place the cursor on the darkest part of each gem. Set it lower if you're less accurate. 3 is a good starting number. If you consistently see low-error performance, set it higher. Note that this number *for tin ore* does not appear to rely on ore extraction skill level (?)
	totalpulls = 100 // How many times do you want it to pull the mine.
	//colordiff = 10 // this is used to find a base for comparison, shouldn't need adjusting
	//CDiff = 0
	RepairAdjust = 15 	// ** SET THIS ** to adjust the vertical positining of the mouse if the mine is not being worked. Increase / decrease by 15 per line as needed. "This mine has been repaired" text and custom mine labels will result in adjustments being required:
// 15 - No Repairs or Text
// 0 - Repair or Text


	Compare = 0
	Currcrys = 0
	LowestCrystal = 0
	CurrentLow = 0
	//DIFFFOUND = 0
	//Minval = 0
	//Maxval = 0
	Tmpval = 0
	loopcnt = 1 
	Mousecnt = 1
	MouseXN = 0
	MouseYN = 0
	//ColorHS = 0
	OElistcnt = 0
	OELvlset = 1
	CurrCrysBlue = 0
End


Compute LowestCrystal = 0
Compute CurrentLow = 255

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

ListClear OEOffset

loop $totalpulls
	Compute loopcnt = 1
	ListClear CrysBlue
	loop 7
		mousepos MouseX[$loopcnt], MouseY[$loopcnt]
		LoadRGB MouseX[$loopcnt], MouseY[$loopcnt]

		// Setup the List
		Call GetBlueValues

		Compute loopcnt = $loopcnt + 1
		Delay 100
	END
	//Delay 100000 for testing
	CALL FindTinOre
	
	CALL OreExtractionstore
		
	ListCount OEOffset, $OElistcnt
	IF $OELevel >= $OElistcnt
		Compute OELvlset = OEOffset[1] // work the current crystal until we are at our OE Level
	ELSE
		Compute OELvlset = OEOffset[$OELevel]
	END
	//Saypaste $OELevel $OElistcnt $OELvlset
	
	mousepos MouseX[$OELvlset], MouseY[$OELvlset]
	Delay 200 //200
	leftclick
	Compute MouseXN = MouseX[$OELvlset] + 15 // adjust this if you need to for the menu click
	Compute MouseYN = MouseY[$OELvlset] - $repairadjust // adjust this if you need to for the menu click
	Mousepos $MouseXN, $MouseYN
	Delay 200
	Leftclick
	
	Delay 4300 // Delay to manage the str/perc timer on mining, adjust as needed
	
end

Procedure GetBlueValues
	// Find the 'blueness' of each crystal, add it to the list. The gem with tin is the gem with the lowest blue component.
	Compute CurrCrysBlue = {RGBBlue}
	Listadd CrysBlue, $CurrCrysBlue
END

Procedure FindTinOre
  // Find which element in the list has the least amount of blue in it.
	Compute LowestCrystal = 0
	Compute CurrentLow = 255
	Compute Currcrys = 1
	loop 7 
		If CrysBlue[$CurrCrys] < $CurrentLow
			compute lowestCrystal = $currCrys
			compute currentLow = crysblue[$currcrys]
		END
	
		Compute Currcrys = $Currcrys + 1
	END //loop
	
	Compute Mousecnt = $LowestCrystal
END

Procedure OreExtractionstore
	// Memory game storage
	ListCount OEOffset, $OElistcnt
	IF $OElistcnt = 0
		Listadd OEOffset, $Mousecnt
	ELSE
		IF $OElistcnt = 1
			Listadd OEOffset, OEOffset[1]
		END
		IF $OElistcnt = 2
			Listadd OEOffset, OEOffset[2]
			Compute OEOffset[2] = OEOffset[1]
		END
		IF $OElistcnt = 3
			Listadd OEOffset, OEOffset[3]
			Compute OEOffset[3] = OEOffset[2]
			Compute OEOffset[2] = OEOffset[1]
		END
		IF $OElistcnt = 4
			Listadd OEOffset, OEOffset[4]
			Compute OEOffset[4] = OEOffset[3]
			Compute OEOffset[3] = OEOffset[2]
			Compute OEOffset[2] = OEOffset[1]
		END
		IF $OElistcnt = 5
			Listadd OEOffset, OEOffset[5]
			Compute OEOffset[5] = OEOffset[4]
			Compute OEOffset[4] = OEOffset[3]
			Compute OEOffset[3] = OEOffset[2]
			Compute OEOffset[2] = OEOffset[1]
		END
		IF $OElistcnt = 6
			Listadd OEOffset, OEOffset[6]
			Compute OEOffset[6] = OEOffset[5]
			Compute OEOffset[5] = OEOffset[4]
			Compute OEOffset[4] = OEOffset[3]
			Compute OEOffset[3] = OEOffset[2]
			Compute OEOffset[2] = OEOffset[1]
		END
		IF $OElistcnt = 7
			Compute OEOffset[7] = OEOffset[6]
			Compute OEOffset[6] = OEOffset[5]
			Compute OEOffset[5] = OEOffset[4]
			Compute OEOffset[4] = OEOffset[3]
			Compute OEOffset[3] = OEOffset[2]
			Compute OEOffset[2] = OEOffset[1]
		END

		Compute OEOffset[1] = $Mousecnt
	END

END