When the script dident found no more useable asteroids in his belt, it has to jump to another in the bookmark list. but it wont work… i have search but for me all looks fine. it allways use only the upper belt.
So when all useabel asteroids are away the script get a error after a long while.
bool InitiateDockToOrWarpToLocationInSolarSystemMenu(
string submenuLabel,
Func<IReadOnlyList<MemoryStruct.IMenuEntry>, MemoryStruct.IMenuEntry> pickPreferredDestination = null)
{
Host.Log("Attempt to initiate dock to or warp to menu entry in submenu '" + submenuLabel + "'");
DroneEnsureInBay();
var listSurroundingsButton = Measurement?.InfoPanelCurrentSystem?.ListSurroundingsButton;
Sanderling.MouseClickRight(listSurroundingsButton);
var submenuEntry = Measurement?.Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern("^" + submenuLabel + "$", RegexOptions.IgnoreCase);
if(null == submenuEntry)
{
Host.Log("Submenu '" + submenuLabel + "' not found in the solar system menu.");
return true;
}
Sanderling.MouseClickLeft(submenuEntry);
var submenu = Measurement?.Menu?.ElementAtOrDefault(1);
var destinationMenuEntry = pickPreferredDestination?.Invoke(submenu?.Entry?.ToList()) ?? submenu?.Entry?.FirstOrDefault();
if(destinationMenuEntry == null)
{
Host.Log("Failed to open submenu '" + submenuLabel + "' in the solar system menu.");
return true;
}
Sanderling.MouseClickLeft(destinationMenuEntry);
var actionsMenu = Measurement?.Menu?.ElementAtOrDefault(2);
if(destinationMenuEntry == null)
{
Host.Log("Failed to open actions menu for '" + destinationMenuEntry.Text + "' in the solar system menu.");
return true;
}
var dockMenuEntry = actionsMenu?.EntryFirstMatchingRegexPattern("dock", RegexOptions.IgnoreCase);
var warpMenuEntry = actionsMenu?.EntryFirstMatchingRegexPattern(@"warp.*within.*m", RegexOptions.IgnoreCase);
var approachEntry = actionsMenu?.EntryFirstMatchingRegexPattern(@"approach", RegexOptions.IgnoreCase);
var maneuverMenuEntry = dockMenuEntry ?? warpMenuEntry;
if (null != maneuverMenuEntry)
{
Host.Log("initiating '" + maneuverMenuEntry.Text + "' on '" + destinationMenuEntry?.Text + "'");
Sanderling.MouseClickLeft(maneuverMenuEntry);
return false;
}
if (null != approachEntry)
{
Host.Log("found menu entry '" + approachEntry.Text + "'. Assuming we are already there.");
return false;
}
Host.Log("no suitable menu entry found on '" + destinationMenuEntry?.Text + "'");
return true;
}
WOW! have you xray eyes? ok i have make the change, script works fine, but i need time to make the next belt empty
but randomizing belt still not work… maybe it not works for Bockmarks?
Oh yes, that.
Sorry I didn’t see that ( I use glasses, not xray’s)
From what I see, you wanna use InitiateDockToOrWarpToLocationInSolarSystemMenu ( from begginers mining script) and randomise the belts like it was done in mine ore script ( who take bookmarks). hmmm it doesn’t work like that because first it record the belts and take them in order, the second use random generated numbers.
But you are a lucky man; I have just done a snipet to use listsurroundingsbutton and warp to random belts, like in bookmark. Look on my intel script: Intel script
string Folder = "asteroid belts";
int RandomInt() => new Random((int)Host.GetTimeContinuousMilli()).Next();
T RandomElement<T>(IEnumerable<T> sequence)
{
var array = (sequence as T[]) ?? sequence?.ToArray();
if (!(0 < array?.Length))
return default(T);
return array[RandomInt() % array.Length];
}
void WarpToRandomFromFolder(string Folder, string actions)
{
var listSurroundingsButton = Measurement?.InfoPanelCurrentSystem?.ListSurroundingsButton;
Sanderling.MouseClickRight(listSurroundingsButton);
var bookmarkMenuEntry = Measurement?.Menu?.FirstOrDefault()?.EntryFirstMatchingRegexPattern("^" + Folder + "$", RegexOptions.IgnoreCase);
Sanderling.MouseClickRight(bookmarkMenuEntry);
var Menu = Sanderling?.MemoryMeasurementParsed?.Value?.Menu?.ElementAtOrDefault(1);
var SecondLevelMenuEntry = RandomElement(Menu.Entry?.ToArray());
Sanderling.MouseClickLeft(SecondLevelMenuEntry);
if (actions != null)
{
var subMenu = Sanderling?.MemoryMeasurementParsed?.Value?.Menu?.ElementAtOrDefault(2);
var subMenuEntry = subMenu?.EntryFirstMatchingRegexPattern(actions, RegexOptions.IgnoreCase);
Sanderling.MouseClickLeft(subMenuEntry);
}
}
and use him like that:
WarpToRandomFromFolder(Folder, "warp");
you can use him directly with “asteroid belts” folder from system , or create your own folder with saved bookmarks
it warp at zero, if you want to warp at 30 or 100km, you have to change a little more this snipet
well this looks very good for randomising! i think i have search for this solutions! when i hav time try to buil it in!
for my main question:
it dident work with the “mainstep”.
the bot still try to fly to the first site in the bookmarkfolder when all asteroids with plagioclase are away.
Now i understand what you say
so you have a list of bookmarks ; at a moment, you warp again at the empty bookmarks.
in this case firstly you have to create a array/list with all bookmarks.when it is epty, you simply delete the entry. you have to record position for that.
So you want to take the belt frombookmark and when his veldspar is finished (your mineral) to put the belt on waiting list , so you do not take same belt for a while?