Looks like i cant modify reserved post anymore…
After testing my script I found that the ModuleMeasureAllTooltip()
function does not work well in a small amount of memory. So I changed it.
Now we specify in the configuration section how many Mining modules we have, how many ShieldBoosters and ArmorRepaiers.
// Numbers of miner laser
const int MinerLasersCount = 2;
// Numbers of ShieldBoosters
const int ShieldBoostersCount = 1;
// Number of ArmorRepeirs
const int ArmorRepairsCount = 0;
Our function goes through all the modules until it finds the number specified in the configuration.
void ModuleMeasureAllTooltip()
{
Host.Log("measure tooltips of all modules.");
var shieldBoostersCount = Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule.Count(m => m?.TooltipLast?.Value?.IsShieldBooster ?? false);
var armorRapairCount = Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule.Count(m => m?.TooltipLast?.Value?.IsArmorRepairer ?? false);
var miningLasersCount = Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule.Count(m => m?.TooltipLast?.Value?.IsMiner ?? false);
while( (shieldBoostersCount < ShieldBoostersCount) || (armorRapairCount < ArmorRepairsCount) || (miningLasersCount < MinerLasersCount) )
{
if(Sanderling.MemoryMeasurementParsed?.Value?.IsDocked ?? false)
break;
foreach(var NextModule in Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule)
{
if(null == NextModule)
break;
Host.Log("measure module.");
// take multiple measurements of module tooltip to reduce risk to keep bad read tooltip.
Sanderling.MouseMove(NextModule);
Sanderling.WaitForMeasurement();
Sanderling.MouseMove(NextModule);
}
shieldBoostersCount = Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule.Count(m => m?.TooltipLast?.Value?.IsShieldBooster ?? false);
armorRapairCount = Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule.Count(m => m?.TooltipLast?.Value?.IsArmorRepairer ?? false);
miningLasersCount = Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule.Count(m => m?.TooltipLast?.Value?.IsMiner ?? false);
Host.Log("Shield Boosters count = " + shieldBoostersCount + ", Armor Repair count = " + armorRapairCount + ", Mining Lasers Count = " + miningLasersCount );
}
}
All script can be found here (TPMiningScript-2018-08-02v3)..