Yet Another Mining Script ;)

Hello,

I discovered Sanderling a few days ago and I’m in love. It’s very nice work, congratulations and thanks to the authors!

The subject of my post is threefold:

  • Thank the authors
  • Participate modestly
  • To ask questions

I started from this Mine.ore.cs

I added the use of ShieldBoost written by Terpla whose description is on this thread:

I also emerge the PickNextMiningSiteFromSystemMenu and InitiateDockToOrWarpToLocationInSolarSystemMenu functions in order to be able to do without a bookmark to mine (beginners-ore-asteroid-miner.cs)

Finally, I added some options:

  • Using Micro Warp Drive if available
  • Use of crystals for mining (optional)
  • Added a parameterizable filter on the Ore to be mined (without changing the overview)
  • Return drones automatically after a fight

The most interesting feature is obviously the use of crytals :

void LoadMiningCrystalForTarget(Sanderling.Accumulation.IShipUiModule module, Sanderling.Parse.IShipUiTarget target)
{
	string[] targetTextRow = target?.TextRow;
	if (targetTextRow != null && targetTextRow.Length > 0) {
		string baseOre = BaseOreFromAsteroidName(String.Join(" ", targetTextRow));
		if (!String.IsNullOrEmpty(baseOre)) {
			Sanderling.MouseMove(module);
			Sanderling.WaitForMeasurement();
			var foundCrystal = module?.TooltipLast?.Value?.LabelText?.FirstOrDefault(entry => entry.Text.RegexMatchSuccessIgnoreCase("Mining Crystal"));
			
			if (foundCrystal != null && foundCrystal.Text.Contains(baseOre))
				return;
			
			Sanderling.MouseClickRight(module);
			var menuCrystal = Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern(baseOre +".*mining.*crystal", RegexOptions.IgnoreCase);
			
			if (menuCrystal != null)
				Sanderling.MouseClickLeft(menuCrystal);
			else if (foundCrystal != null)
				Sanderling.MouseClickLeft( Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern("unload to cargo", RegexOptions.IgnoreCase));
			else
				Sanderling.MouseClickLeft(target);
		}
	}
}

You can find this complete dirty script here: mining script - Pastebin.com
Be indulgent, I know very little about the C # :slight_smile:

It seems to be a bug (which must have existed before my changes). Sometimes the robot targets something other than rats to defend itself, and sometimes even attacks those same targets. I think it’s a race condition between targeting and taking it into account. I will try to correct this in my next project.

My next project: fork A-Bot (whose architecture is nice) and include the two example scripts in the form of modules (traveling and mining). I will name this project simply and with a lot of imagination: “E-Bot”:wink:

So, if you read me so far, here are my questions ^^

  • Is there any reason why A-Bot (master) is so far not related to the latest version of sanderling? (lack of time ?)

  • How often do automated mining accounts get banned? What are your experiences? Is reasonable use tolerated by CPP?

Yours,

Zappy

4 Likes

Hey zappy, looks like you have discovered a new bot! Thank you for sharing this with us!
I added a link to this bot to the bot catalog: https://forum.botlab.org/t/bot-f87c9dc0-this-script-mines-ore-from-asteroids/1071