How can I make the bot orbit around Asteroids instead of approach??
I have written a couple of functions that seem to work for me to orbit objects at 10 km
you can change the distance to something else
// Orbit asteroid at 10km Orbit("Crokite") will orbit first asteroid named Crokite at 10 km
void Orbit(string whatToOrbit,string distance="10 km")
{
var ToOrbit=Measurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry?.Where(entry => entry?.Name?.RegexMatchSuccessIgnoreCase(whatToOrbit) ?? false)?.ToArray();
ClickMenuEntryOnMenuRoot(ToOrbit.FirstOrDefault(),"Orbit",distance);
}
// Stolen and modified from MineOre.cs
// modified to click on Submenu if SubMenuEntryRegexPattern not null
void ClickMenuEntryOnMenuRoot(IUIElement MenuRoot, string MenuEntryRegexPattern,string SubMenuEntryRegexPattern=null)
{
Sanderling.MouseClickRight(MenuRoot);
var Menu = Sanderling?.MemoryMeasurementParsed?.Value?.Menu?.FirstOrDefault();
var MenuEntry = Menu?.EntryFirstMatchingRegexPattern(MenuEntryRegexPattern, RegexOptions.IgnoreCase);
Sanderling.MouseClickLeft(MenuEntry);
if(SubMenuEntryRegexPattern!=null) {
// Using the API explorer when we click on the top menu we get another menu that has more options
// So skip the MenuRoot and click on Submenu
var subMenu=Sanderling?.MemoryMeasurementParsed?.Value?.Menu?.Skip(1).First();
var subMenuEntry = subMenu?.EntryFirstMatchingRegexPattern(SubMenuEntryRegexPattern, RegexOptions.IgnoreCase);
Sanderling.MouseClickLeft(subMenuEntry);
}
}
Hope this helps
1 Like
Hi,
Sorry for resurrecting an old thread but I’m trying to add the orbit function but I’m not sure where to place the above code.
Has anyone used this to make their ship orbit and can you explain a bit more about where in the script you placed the code and how you implemented the functionality?
Thanks in advance