ModuleMeasureAllTooltip failure

Hello,

I have been seeing situations where the mining script’s ModuleMeasureAllTooltip() is not detecting my mining module (or one of two when fitted with multiple).  I was wondering what corrective action I could take in MainStep() to force a re-read of the configured modules?  I tried to invoke ModuleMeasureAllTooltip() a second time but there was no change.

ModuleMeasureAllTooltip();if (SetModuleMiner.IsNullOrEmpty()) {    ???????}

Thank you,

Hack.

The code in the ‘ModuleMeasureAllTooltip’ method of the sample mining script only measures the subset of modules for which no Tooltip is already stored in its ‘TooltipLast’ property. (Any suggestions for a better Name?) I guess that in those situations you described the memory reading has read some garbage and this was stored as the last tooltip. I see two possible approaches here:

Filter out the measurements of Module Tooltips which contain garbage

As long as the tooltip coming from the memory reading is not stored in said property, the method should read it again. So this would solve the problem. When I have an algorithm to filter out bad reads, I can distribute it with the executable release and you can use the new version without having to change your script.

In order to create an algorithm to filter out the bad reads, I would need samples of the data stored in those situations. For collecting the samples, please see this post: http://forum.botlab.org/thread/anderling-release-v16-03-09/?order=all#comment-6221cb1d-6d5f-4281-9e68-a5e800c3634b

Force reading of the modules

This is an option for your specific case where you know from that something went wrong. I do not know which subset you are referring to with ‘configured modules’.

To force a re-read of all modules, I would try this code:

foreach(var module in (Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule).WhereNotDefault().EmptyIfNull()){     Host.Log("measure module.");     //    take multiple measurements of module tooltip to reduce risk to keep bad read tooltip.     Sanderling.MouseMove(module);     Sanderling.WaitForMeasurement();     Sanderling.MouseMove(module);}

Thank you.  I will give this code snippit a try.  I had tried to invoke ModuleMeasureAllTooltip() again when I detected the mining module was not discovered but this did not clear the problem.

I usually find my ship sitting in the asteroid belt with 0 mining modules discovered.  Will collecting samples of the data after it has been sitting there for possibly a couple hours still help?

Thanks - Hack.

Thank you.  I will give this code snippit a try.  I had tried to invoke ModuleMeasureAllTooltip() again when I detected the mining module was not discovered but this did not clear the problem.

Was the ‘TooltipLast’ property already populated for each module by then?

I usually find my ship sitting in the asteroid belt with 0 mining modules discovered.  Will collecting samples of the data after it has been sitting there for possibly a couple hours still help?

Thanks - Hack.

The timespan which has passed does not matter. I am only after the value of the ‘TooltipLast’ property. As long as the module tooltip is not visible, this value should not change anyway.

The issue is that on undock, after warp has been initated to belt, I added the following code to MainStep() and it never discovered a mining module:

ModuleMeasureAllTooltip();int count = 0;while (SetModuleMiner.IsNullOrEmpty()){    Host.Log("No minign modules, count=" + count);    ModuleMeasureAllTooltip();    if (count++ > 4) {       Host.Log("Giving up, count=" + count);       break;    }}
 

The hardeners were discovered and activated but 0 mining modules were detected.  I will add code to dump the TooltipLast and see what is there.

Hack.

The issue is that on undock, after warp has been initated to belt, I added the following code to MainStep() and it never discovered a mining module:

ModuleMeasureAllTooltip();int count = 0;while (SetModuleMiner.IsNullOrEmpty()){    Host.Log("No minign modules, count=" + count);    ModuleMeasureAllTooltip();    if (count++ > 4) {       Host.Log("Giving up, count=" + count);       break;    }}

As far as I can see, the outcome would still depend on whether there is already an object in ‘TooltipLast’.

I will add code to dump the TooltipLast and see what is there.

Now I am wondering, do you expect adding code to be simpler than the method I proposed to dump the data? Did that not work?

And, in case you just want to see what is there, you can expand this path in the API Explorer:

MemoryMeasurementAccu?.Value?.ShipUiModule?[Index_of_the_module]?.TooltipLast

Now I am wondering, do you expect adding code to be simpler than themethod I proposed to dump the data? Did that not work?

LoL - no my natural reaction when debugging an issue is to write logging statements :slight_smile:

Have not yet encountered it again.  It is not a regular occurance.  When it happens I will take a memory dump.