how is asked in Pikacuq is tweaking A-Bot :), i will share parts of my combat.cs; but is always in dev. mode, so is not a clean code or even logical.
So for me, armor perma is off , because i fly an speed vni ( you can looking on forum to find him) and i dont need too much of him. Actually i think at some point I wil replace him with an drone damage2. So , when i need armor he will be later activated and deactivated.
NExt: later i change some tabs, and i have anchor var to make the difference between anomaly and near citadel position. Thats because sometime , its happens to be near citadel, and have some rats around and blues. Well, in my sense, the presence of anchor make the difference.
public class CombatTask : IBotTask
{
const int TargetCountMax = 2;
public Bot bot;
public bool OwnAnomaly = false;
//public bool Jammed => ShipUi?.EWarElement?.Any(EwarElement => (EwarElement?.EWarType).RegexMatchSuccess("electronic")) ?? false;
// public bool Jammed => bot?.MemoryMeasurementAtTime?.Value?.ShipUi?.EWarElement?.Any(EwarElement => (EwarElement?.EWarType).RegexMatchSuccess("electronic")) ?? false;
static public bool ActuallyAnomaly(Interface.MemoryStruct.IListEntry scanResult) =>
scanResult?.CellValueFromColumnHeader("Distance")?.RegexMatchSuccessIgnoreCase("km|m") ?? false;
public bool Completed { private set; get; }
public IEnumerable<IBotTask> Component
{
get
{
var ArmorPERMATANK = false;
var memoryMeasurementAtTime = bot?.MemoryMeasurementAtTime;
var memoryMeasurementAccu = bot?.MemoryMeasurementAccu;
var memoryMeasurement = memoryMeasurementAtTime?.Value;
if (!memoryMeasurement.ManeuverStartPossible())
yield break;
Tab OverviewTabActive =
memoryMeasurement.WindowOverview?.FirstOrDefault()?.PresetTab
?.OrderByDescending(tab => tab?.LabelColorOpacityMilli ?? 1500)
?.FirstOrDefault();
var combatTab = memoryMeasurement.WindowOverview?.FirstOrDefault()?.PresetTab
?.OrderByDescending(tab => tab?.Label.Text.RegexMatchSuccessIgnoreCase("combat"))
?.FirstOrDefault();
var salvageTab = memoryMeasurement.WindowOverview?.FirstOrDefault()?.PresetTab
?.OrderByDescending(tab => tab?.Label.Text.RegexMatchSuccessIgnoreCase("misc"))
?.FirstOrDefault();
var Anchor = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
?.Where(entry => entry?.Name?.RegexMatchSuccessIgnoreCase("broken|pirate gate") ?? false)
?.OrderBy(entry => entry?.DistanceMax ?? int.MaxValue)
?.ToList();
`Becasue haven sites are divided, and i dont like the gas ones, I avoid them using an separated list ( trust me I even dont know if the bot can work with so many var, lists, arrays etc and conditions, i supose he open a new thread for each one of them; but I’m happy he work, for now)
so how can I avoid an anomaly( occupied or not)? simple like that:
var listOverviewAvoidAnomalys = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry?.Where(entry => entry?.Name?.RegexMatchSuccess("Chemical Factory") ?? true)
.ToList();
if (bot?.OwnAnomaly == false)
{
if ((listOverviewAvoidAnomalys.Count() > 0) || (listOverviewEntryFriends.Length > 0) || (listOverviewEntryCorp.Length > 0) || (listOverviewEntryToAttack.Count() > 100))
{
yield return new AnomalyEnter { bot = bot };
}
else
{
bot?.SetOwnAnomaly(true);
if (null != scanActuallyAnomaly)
{
yield return scanActuallyAnomaly.ClickMenuEntryByRegexPattern(bot, "save location");
}
var Broken = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
?.Where(entry => entry?.Name?.RegexMatchSuccessIgnoreCase("broken|pirate gate") ?? false)
?.OrderBy(entry => entry?.DistanceMax ?? int.MaxValue)
?.ToArray();
var orbitKeyCode = (VirtualKeyCode)'W';
yield return bot?.EnsureIsActive(ab); //ACTIVE AF/MWD
if (Anchor.Count > 0)
//yield return Broken.FirstOrDefault().ClickMenuEntryByRegexPattern(bot, "Orbit", "30 km"); Im not using this line just because i change sometime the orbit range, but is working
yield return new BotTask
{
Effects = new[]
{
MotionParamExtension.KeyDown(orbitKeyCode),
Broken.FirstOrDefault().MouseClick(MouseButtonIdEnum.Left),
MotionParamExtension.KeyUp(orbitKeyCode)
}
};
yield return bot?.EnsureIsActive(ab); //ACTIVE AF/MWD
}
}
the last one for today, is the one to enter in combat. Actually, i put the condition of dread and reds only, because if i put the green ones, … well, the bot dont make the difference betwen a new anomaly and my own anomaly( they are before, to mark my own anomaly and to orbit for the first time, ( good for haven sites because you orbit and wait until the rats are coming) After that they are forgoten by bot.
if (listOverviewDreadCheck.Count() > 0 || (listOverviewEntryEnemy.Count() > 0))
{
yield return new RetreatTask { Bot = bot };
}
else
{
yield return bot?.EnsureIsActive(ab); //ACTIVE AF/MWD
if (combatTab != OverviewTabActive)
and from here its starts the fight
if ((listOverviewEntryToAttack.Count() > 0) && (Anchor.Count > 0))
{
if (ShipManeuverStatus != ShipManeuverTypeEnum.Orbit)
{
var Broken = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
?.Where(entry => entry?.Name?.RegexMatchSuccessIgnoreCase("broken|pirate gate") ?? false)
?.OrderBy(entry => entry?.DistanceMax ?? int.MaxValue)
?.ToArray();
var orbitKeyCode = (VirtualKeyCode)'W';
//yield return Broken.FirstOrDefault().ClickMenuEntryByRegexPattern(bot, "Orbit", "30 km");
yield return new BotTask
{
Effects = new[]
{
MotionParamExtension.KeyDown(orbitKeyCode),
Broken.FirstOrDefault().MouseClick(MouseButtonIdEnum.Left),
MotionParamExtension.KeyUp(orbitKeyCode)
}
};
}
you ask yourself why i put the orbit again? me too, :)) i kidding . Well, an really fast ship can get in and out from you system before your drones, imbricated betwen rocks, other drones wrecks and rats to even start to come to you. So even if Im in fight, the red come and disapear, but Im aligned, my ab is off, my perma is on and … this lines put me again on orbit mode :d ( saveship is disapeared from savetask) and even if the drones get inside your ship in the same time, he will get them out and fight :
actually, if you ask me like a friend the trickery with anchor is from 3-4 days, before i used only this lines :))
you really want to take the faction loot, isn’t?
Well, i have for you something more : take the loot and salvage.
about salvage , i think you have to tweak a little more, to put the salvager in framework sanderling, compile and copy some dll into abot. i do that some time ago, and i don’t remember exactly how;
but you have another way to do: tooltip and caption for module
I suppose you know more than me to realize this stuff, but if you need, i can offer my help.
back to salvage and taking the loot. Once the rats are dead, you can change the tab to the one with wrecks.or not, how you want.
you can change the salvage range with 1000 , no problem, I think.
int? salvageRange = 500;
if (listOverviewCommanderWreck.Count > 0)
{
if (null == targetSelected)
{
if (!(wreckCommander.DistanceMax < salvageRange))
yield return wreckCommander.ClickMenuEntryByRegexPattern(bot, "open cargo");
else
yield return wreckCommander.ClickMenuEntryByRegexPattern(bot, @"^lock\s*target");
if (LootButton != null)
{
yield return new BotTask { Effects = new[] { LootButton.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Left) } };
}
}
else
if (!(absalvager.IsActive(bot) ?? true))
yield return bot.EnsureIsActive(absalvager);
}
I wanna thanks to the real programmers and coders who made/contribute at the miner script. Without this script i could not accomplish all this stuff ( because Im null at programming, you see my coding style :d :)) )
And the bonus, traveling with A-bot
var RouteElementMarkerNext =
memoryMeasurement?.InfoPanelRoute?.RouteElementMarker
?.OrderByCenterDistanceToPoint(new Vektor2DInt(0, 0))?.FirstOrDefault();
// you have to put the using bib3geometry up on the head on file, VS help you :slight_smile:
//later, when you don't have any anomaly in you system, this lines help you:
if (null == scanResultCombatSite)
if (null != RouteElementMarkerNext)
{
var MenuEntry =
memoryMeasurement?.Menu?.FirstOrDefault()
?.Entry?.FirstOrDefault(candidate => candidate.Text.RegexMatchSuccessIgnoreCase("dock|Jump through stargate"));
if (null != MenuEntry)
yield return new BotTask { Effects = new[] { MenuEntry.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Left) } };
yield return new BotTask { Effects = new[] { RouteElementMarkerNext.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Right) } };
}
else
yield return new DiagnosticTask
{
MessageText = NoSuitableAnomalyFoundDiagnosticMessage,
};
var ShipManeuverStatus = memoryMeasurement.ShipUi?.Indication?.ManeuverType;
if (ShipManeuverStatus != ShipManeuverTypeEnum.Warp)
{
if (null != RouteElementMarkerNext)
{
so it will not be clicking on menu every second during warp…
mine doesn’t click on warp since is in anomaly enter and
if (!memoryMeasurement.ManeuverStartPossible())
yield break;
the invul field doesn't matter where is defined; there is someting who activate him
maybe because of that:
static public bool ShouldBeActivePermanent(this Accumulation.IShipUiModule module, Bot bot) =>
new[]
{
module?.TooltipLast?.Value?.IsHardener,
bot?.ConfigSerialAndStruct.Value?.ModuleActivePermanentSetTitlePattern
?.Any(activePermanentTitlePattern => module?.TooltipLast?.Value?.TitleElementText()?.Text?.RegexMatchSuccessIgnoreCase(activePermanentTitlePattern) ?? false),
}
.Any(sufficientCondition => sufficientCondition ?? false);
and module task, since is defined.
anyway; is just annoying if you use a gila/vni and you travel between systems, because afterwarp h try to activate him.
Btw about gila and drones number< 5; you can put that ( you need inventory window opened all time):
var ShipType = WindowInventory?.LabelText?.FirstOrDefault(text => (text.Text?.RegexMatchSuccessIgnoreCase("Gila") ?? true));
if (null != ShipType)
DroneNumber = 2;
else
DroneNumber= 5;
you can change Gila with any ship you need ( or even made some arrays from *.conf, how you like)
for myself, i created a new task and the name of task is defined in bot.cs. the new task is a new class and you have to put them like skipanomaly class
if is hard , you can put the lines for closing the windows in combat.cs.
If you still want a new task, the model is in bot.cs ( see skip anomaly)