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.

Silver Macro

From A Tale in the Desert
Jump to navigationJump to search
// Written by: Coyan/Mosaic Guild
// This is what I suggest for setting up for this macro
// First align your view so you can see all 7 crystals clearly
// second use Alt-L to lock your camera angle
// Third before starting this, I suggest you have your mouse sitting over
//  the first crystal.
// You will have 3 seconds between the recording of each crystal's location
// place your mouse over the darkest part of each crystal in turn
// Once it has identified the 7 crystals, it will run the mine
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
	CrystalSat=List // array of crystal Saturation
	OEOffset=List

END
Constants
	totalpulls = 100 // number of pulls
 	OELevel = 4  // With Silver this will allow you to pull up to 4 a go, it will fail a few times
 							// initially, I'm still working on why
	OElistcnt = 0
	OELvlset = 2
	loopcnt = 1
	mnloopcnt = 1
	Mousecnt = 1
	MouseXN = 0
	MouseYN = 0
	ColorN = 0
	ColorS = 0
	Color2S = 0
	Minval = 0
	Maxval = 255
	CONSTVAL = 0
	Tmpval = 0
End

Compute CONSTVAL = 100/255 // constant being set for saturation calculation

// 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 mnloopcnt = 1
	ListClear CrystalSat

	loop 7
		mousepos MouseX[$mnloopcnt], MouseY[$mnloopcnt]
		LoadRGB MouseX[$mnloopcnt], MouseY[$mnloopcnt]
		
		Call CALCSATCOLOR
		Compute mnloopcnt = $mnloopcnt + 1
	END
	
	Call Findsecondsat
	
	CALL OreExtractionstore

	ListCount OEOffset, $OElistcnt
	IF $OELevel > $OElistcnt
		Compute OELvlset = OEOffset[$OElistcnt]
	ELSE
		Compute OELvlset = OEOffset[$OELevel]
	END

	mousepos MouseX[$OELvlset], MouseY[$OELvlset]
	Delay 200 
	leftclick
	Compute MouseXN = MouseX[$OELvlset] + 15 // adjust this if you need to for the menu click
	Compute MouseYN = MouseY[$OELvlset] - 10// adjust this if you need to for the menu click
	Mousepos $MouseXN, $MouseYN
	Delay 200
	Leftclick
	
	Delay 4200 // Delay to manage the str/perc timer on mining, adjust as needed
	
end

Procedure CALCSATCOLOR // This procedure calculates the saturation of the crystal
	Compute Minval = 0
	Compute Maxval = 255
	IF {RGBRed} > {RGBGreen}
		Compute Minval = {RGBGreen}
		Compute Maxval = {RGBRed}
	Else
		Compute Maxval = {RGBGreen}
		Compute Minval = {RGBRed}
	END
	IF {RGBBlue} < $Minval
		Compute Minval = {RGBBlue}
	ELSE
		IF {RGBBlue} > $Maxval
			Compute Maxval = {RGBBlue}
		END
	END
	Compute Tmpval = $Maxval - $Minval
	Compute Tmpval = $Tmpval / $Maxval
	Compute ColorN = $Tmpval * $CONSTVAL
	
	Listadd CrystalSat, $ColorN
END

Procedure Findsecondsat // find the second most saturated crystal, Silver mining
	Compute ColorS = 0
	Compute Color2S = 0
	Compute loopcnt = 1
	loop 7
		IF CrystalSat[$loopcnt] > $ColorS
			Compute ColorS = CrystalSat[$loopcnt]
		END
		Compute loopcnt = $loopcnt + 1
	END
	Compute loopcnt = 1
	loop 7
		IF CrystalSat[$loopcnt] > $Color2S AND $ColorS > CrystalSat[$loopcnt]
			Compute Color2S = CrystalSat[$loopcnt]
			Compute Mousecnt = $loopcnt
		END
		Compute loopcnt = $loopcnt + 1
	
	END		

END

Procedure OreExtractionstore
	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

back to Macro list:[Mosaic Macros]