Stop Ship when under 5000 Meter

eve-online

#1

Hi Guys,

my next Ask:

I want to stop the ship from approching when the target is next to 5000 meter.
But i have still problem to figur out to get the right variables from measurmemt. In this Case the Var SpeedNull is not correct :frowning:

PS: and what is wrong with my post format, kaboonus answer allways much pretty… His Code is formatted!

var SpeedNull = Measurement?.ShipUi?.SpeedLabel?.Text?.FirstOrDefault(Text => Text.Text.RegexMatchSuccessIgnoreCase("0.0") ?? false);
var asteroidOverviewEntryNextA = ListAsteroidOverviewEntry?.FirstOrDefault();
if(!(5000 < asteroidOverviewEntryNextA?.DistanceMin) &&(SpeedNull != null))
{
Sanderling.KeyboardPressCombined(new[]{ VirtualKeyCode.CONTROL, VirtualKeyCode.SPACE});
Host.Log("STOP Ship 5000");
}else{
Host.Log("Ship to Target "+ asteroidOverviewEntryNextA?.DistanceMin);
}

#2

before and after the code put 4 like that `
so; you take speed from speeedmilli: ( value is in mili, so 1m/s is 1000

if ...
Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.SpeedMilli>100000

then do something

or you use keep at range in place of approach

ClickMenuEntryOnMenuRoot(objetfromoverview, "keep at range");// and you fix value from overview button.

Alternatively, you can use shortcuts ( default ones)

        Sanderling.KeyDown(VirtualKeyCode.VK_E);
        Sanderling.MouseClickLeft(listasteroids?.FirstOrDefault());
        Sanderling.KeyUp(VirtualKeyCode.VK_E);

#3

o7

To get your ship’s speed, you can read:

Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.SpeedMilli 

And keep in mind that it’s in millimeters per seconds
So you can make your script portion looks like:

var Speed = Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.SpeedMilli 
var asteroidOverviewEntryNextA = ListAsteroidOverviewEntry?.FirstOrDefault();
if ( asteroidOverviewEntryNextA.DistanceMax < 5000 && Speed > 50000)
{  Sanderling.KeyboardPressCombined(new[]{ VirtualKeyCode.CONTROL, VirtualKeyCode.SPACE});
    Host.Log("STOP Ship 5000"); }
else
{  Host.Log("Ship to Target "+ asteroidOverviewEntryNextA.DistanceMax);  }

I suggest stopping stopping the ship once 50m/s reached because it’s quite long to reach 0m/s and no need to make more “noise” than needed by ctrl+Space at 45m/s, ctrl+Space at 40m/s, ctrl+Space at 37m/s and so on…


#4

Hello There!
@ Kaboonus: Now it looks much better! Thank you! “Keep at Range” not work for Asteroids.

@Bitenbois: Thats, what i have search for! i have put it in the code and give it a try! But it looks exactly for what i have search! The idea with the speed sounds also good! Thank You.


#5

Hello together,

It Works well! I have put the Code to the part where the Miner normal working. Also I have put a peace of code to start all Drones and let them “Mine”. Three Drones Guard and two Mine.

Thanks to Bitenbois!


if (null == moduleMinerInactive) {  // when all Miner normal working

if (!(0 &lt; DronesInSpaceCount)){ // Whenn null drones out

Host.Log("launch drones...";);
Sanderling.MouseClickRight(DronesInBayListEntry);
Sanderling.MouseClickLeft(Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern(&quot;launch&quot;, RegexOptions.IgnoreCase));
Host.Delay(2000); //wait 2 seconds so the drones have time to start
Sanderling.MouseClickRight(DronesInSpaceListEntry);
Sanderling.MouseClickLeft(Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern(&quot;mine&quot;, RegexOptions.IgnoreCase));
}

var Speed = Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.SpeedMilli;
var asteroidOverviewEntryNextA = ListAsteroidOverviewEntry?.FirstOrDefault();
if ( asteroidOverviewEntryNextA.DistanceMax &lt; 5000 &amp;&amp; Speed &gt; 50000) {
Sanderling.KeyboardPressCombined(new[]{ VirtualKeyCode.CONTROL, VirtualKeyCode.SPACE});
Host.Log("STOP Ship 5000");
}
else {
Host.Log("Ship to Target" + asteroidOverviewEntryNextA.DistanceMax);  //for develooping Comment it out after testing
}

Thank you!