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
PS: and what is wrong with my post format, kaboonus answer allways much pretty… His Code is formatted!
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)
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…
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.
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 < DronesInSpaceCount)){ // Whenn null drones out
Host.Log("launch drones...";);
Sanderling.MouseClickRight(DronesInBayListEntry);
Sanderling.MouseClickLeft(Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern("launch", RegexOptions.IgnoreCase));
Host.Delay(2000); //wait 2 seconds so the drones have time to start
Sanderling.MouseClickRight(DronesInSpaceListEntry);
Sanderling.MouseClickLeft(Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern("mine", RegexOptions.IgnoreCase));
}
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); //for develooping Comment it out after testing
}