Pikacuq is tweaking A-Bot :)

yeah, not really sure what this bit of code doing cos in sanderling development tool i can see sessionduration always 1 000 000
whatever it means :confused:

btw I’ve tweaked Dread retreat → there was a need to introduce another retreat task, which works like:

  1. turn off ab/drones
  2. ignore anomaly with dread
  3. move to another anomaly

because simple retreat as in A-Bot code cause looping between docking and warping to site where dread already is :slight_smile:

So in the meantime trying to figure out how to deal with external config as variables, I’ve made fully working officer (can be customized by Variables.FactionSpawn) looting task. In Bot.cs you need to add setCommanderWreck and CommanderWreck indeed as well

This is only task which sits outside of anything, it’s called from combat.cs when fight is over . Remember we do not want to go to loot it if there is any rats on grid!
I’m using bot.CommaderWreck true/false to determine in combat.cs if we are staying on finished anomaly or we are moving to new one. So do your tweaks to that task as you need.

here you go:

namespace Sanderling.ABot.Bot.Task
{
	public class LootWreck : IBotTask
	{
		public Bot bot;

		public IEnumerable<IBotTask> Component
		{
			get
			{
				var memoryMeasurementAtTime = bot?.MemoryMeasurementAtTime;
				var memoryMeasurementAccu = bot?.MemoryMeasurementAccu;
				var memoryMeasurement = memoryMeasurementAtTime?.Value;

				var OverviewTabActive = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.PresetTab?.OrderByDescending(tab => tab?.LabelColorOpacityMilli ?? 1500)?.FirstOrDefault();
				var OverviewTabLoot = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.PresetTab?.Where(tab => tab?.Label.Text.RegexMatchSuccess(Variables.OverviewTabLoot) ?? false).FirstOrDefault();

				var propmod = memoryMeasurementAccu?.ShipUiModule?.Where(module => module?.TooltipLast?.Value?.IsAfterburner ?? false);

				// switch tabs for wrecks
				if (OverviewTabLoot != OverviewTabActive)
					yield return new BotTask { Effects = new[] { OverviewTabLoot?.MouseClick(MouseButtonIdEnum.Left), } };

				var listOverviewCommanderWreck = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry?.Where(entry => entry?.Name?.RegexMatchSuccessIgnoreCase(Variables.FactionSpawn) ?? true).ToList().FirstOrDefault();

				// if there is a officer wreck -> loot it
				if (listOverviewCommanderWreck != null)
				{
					bot?.SetCommanderWreck(true);

					var isApproaching = memoryMeasurement?.ShipUi?.Indication?.LabelText?.Any(text => text?.Text?.RegexMatchSuccess("approaching", System.Text.RegularExpressions.RegexOptions.IgnoreCase) ?? false) ?? false;
					var WindowInventory = memoryMeasurement?.WindowInventory?.FirstOrDefault(w => (w?.Caption.RegexMatchSuccessIgnoreCase("inventory") ?? false));
					var LootButton = memoryMeasurement?.WindowInventory?[0]?.ButtonText?.FirstOrDefault(text => text.Text.RegexMatchSuccessIgnoreCase("Loot All"));
					var ApproachDistance = listOverviewCommanderWreck.DistanceMin;

					if ((isApproaching == false) && (ApproachDistance > 2000))
						yield return listOverviewCommanderWreck.ClickMenuEntryByRegexPattern(bot, "open cargo");

					if ((isApproaching == true) && (ApproachDistance < 12000))
						yield return bot?.DeactivateModule(propmod);

					if (LootButton != null)
					{
						yield return bot?.DeactivateModule(propmod);
						yield return new BotTask { Effects = new[] { LootButton?.MouseClick(MouseButtonIdEnum.Left), } };
					}
				}
				else
				{
					bot?.SetCommanderWreck(false);
				}
			}
		}

		public IEnumerable<MotionParam> Effects => null;

	}
}

enjoy

note: on your wreck tab you have to configure visibility of empty wrecks to none, otherwise bot will loop endlessly trying to loot empty wreck :slight_smile:

1 Like

was anybody looking into the

		static public int AttackPriorityIndexForOverviewEntryEWar(IEnumerable<EWarTypeEnum> setEWar)

and code around it?

From my understanding of the current code, it will take into consideration ewars and based on code in combat.cs

				var listOverviewEntryToAttack =
					  memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry?.Where(entry => entry?.MainIcon?.Color?.IsRed() ?? false)
					  ?.OrderBy(entry => bot.AttackPriorityIndex(entry))
					  ?.OrderBy(entry => entry?.Name?.RegexMatchSuccessIgnoreCase(@"coreli|centi|alvi|pithi|corpii|gistii"))				//Frigate
					  ?.OrderBy(entry => entry?.Name?.RegexMatchSuccessIgnoreCase(@"corelior|centior|alvior|pithior|corpior|gistior"))		//Destroyer
					  ?.OrderBy(entry => entry?.Name?.RegexMatchSuccessIgnoreCase(@"corelum|centum|alvum|pithum|corpum|gistum"))			//Cruiser
					  ?.OrderBy(entry => entry?.Name?.RegexMatchSuccessIgnoreCase(@"corelatis|centatis|alvatis|pithatis|copatis|gistatis")) //Battlecruiser
					  ?.OrderBy(entry => entry?.Name?.RegexMatchSuccessIgnoreCase(@"core\s|centus|alvus|pith\s|corpus|gist\s"))				//Battleship
					  ?.ThenBy(entry => entry?.DistanceMax ?? int.MaxValue)
					  ?.ToArray();

it will properly order targets, but when locking time on frigats/battleships etc. differs some of the targets are targeted BEFORE ewartargets.
And from the code I don’t see any fuction which will force bot to switch targets to priority ones once there is already targeting queue.

I don’t want to reinvent wheel here, so if anybody was solving it → can you share your bits here? appreciated.

Otherwise I’ll do it later on :slight_smile:

ok, nwm I’ve done it like that:
1.select proper target
2.force drones to switch

					if (targetSelected != listOverviewEntryToAttack.FirstOrDefault())
					{
						yield return new LockTarget { target = overviewEntryLockTarget };
						yield return new BotTask { Effects = new[] { VirtualKeyCode.VK_F.KeyboardPress(), } };
					}

works as needed, so bot is switching targets regarding prioritylist no matter what :wink:

the thing with ewar is a little tricky…
Normally you ( like a humain) do that:
take the frigs,but if these are too far, you take whatever is closer
If you have one lost potential ewar ship, you unlock ( if you are full) and lock the ewar ship.
Again, the distance could play a role…

i worked a little over these things, but is alot of code.
also, the distance fuck up the things.

The only way around all this , in my opinion is;
if you do forsaken, then you put your drones on passive and erase the line with distance. :slight_smile: . Also, you move the line with prioriyindex to last position. It seems illogical, but actually in the stock pile of datas, the last ones is on the surface ( i cannot explain better) so, ewar it take priority.
The second thing is you will take first the frigates, or actually the ewar ship ( because of waves) and the distance will not interfere. So, everything will rest in the timing for locking the rats. You can increase your signature analysys but also you can change another line; the one with number of maximum targets.
You modify that accordingly with your time for locking targets. I modify that at 2 and the bot stops exactly after i have 4 targets ( the number of frigates /ewar)

If you do haven or other anomaly, put your drones in agressive mode. it will fuck up a litle your cycles, but if you take a dampering sensors from 4 ships, your distance for targeting will decrease at 15-20 km,

The other work around is to make a new … something ( dunno what) with the ewar icons in overview and put a condition like:
if shipui is jammed compare the target selected with the overview rows with ewar right icon . If the target selected has right icon, then shoot, else unlock ( i tried like that but actually didnt work so i found the trick with distance)

umm disagree.

It very depends on your ship and skills and fit. I dont care about dampering stuff and so on. I do care only about scrams/webs so this is why I’ve tweaked it → and to be actually scrammed you’ll be in range for 100% sure.

Range does not matter on havens/forsakens as 30km orbit makes everything in range. And even if for some reason not, drones will take care of it by themselfs till targets will be closer.

There is literally no need of any very super complicated stuff, because EWar is already defined → so there is absolutely zero need to define some icons or whatever…
ewar and priority based on ewar is already there, you just need to make sure you SWITCH targets regarding prioritylist, nothing more.

namespace Sanderling.Parse
{
    public enum EWarTypeEnum
    {
        None = 0,
        Other = 1,
        ECM = 10,
        TrackingDisrupt = 11,
        SensorDamp = 12,
        WarpDisrupt = 13,
        WarpScramble = 14,
        Web = 15,
        EnergyNeut = 16,
        EnergyVampire = 17,
        TargetPaint = 18,
        Miscellaneous = 19
    }
}

you can put them in botextension.cs if they arent already there and voila

you have to do unlock selected target if you are scrammed

you dont have to do any unlocking.
usually there is 7targets or so in any ship.

if you set your maxtargets to 2-4 you will have buffer if anything happends, but yes of course there can be code to unlock non-priority targets, but it takes bot’s time and it’s not worth to do so.

and it’s already in botextensions


namespace Sanderling.ABot.Bot
{
	static public class BotExtension
	{
		static readonly EWarTypeEnum[][] listEWarPriorityGroup = new[]
		{
			new[] { EWarTypeEnum.ECM },
			new[] { EWarTypeEnum.Web},
			new[] { EWarTypeEnum.WarpDisrupt, EWarTypeEnum.WarpScramble },
		};

as I said. Only real missing part is/was forcing bot to switch targets, as he just ignores everything if he has targets locked and drones are not idling.

then you just have to change the selected target and put you drones on this one.
you have the trigger in overview on ewar

Pikacuq is tweaking A-Bot :) - #44 by pikacuq

:slight_smile:

1 Like

where in combat.cs would you put this code to ensure that the priority list is taken into account?

priority list is already there and working → ewar targets are always first
what you have to do is make sure bot will switch targets.
but be aware to doit so bot will not change targets every second, so basically do not let him sorting it by distance otherwise as you are moving, he will be switching like madman :slight_smile:

that bit of code have to go somewhere where you are managing targets. I did masively reworked combat.cs so where it is in mine does not correspond with yours.

What would be the best way to get the bot to launch drones ASAP - preferably in this order

Warps to site
Checks if it owns anomaly
Launches drones before orbiting and locking targets ← Hoping to avoid drones getting targeted and destroyed
Orbits a point
Locks Targets
Engage Drones if necessary

well … put this

					if (0 < droneInBayCount && droneInLocalSpaceCount < bot?.ConfigConstants.MaxDrones)
						yield return droneGroupInBay.ClickMenuEntryByRegexPattern(bot, @"launch");

before whenever you have orbit logic

note: you dont have

bot?.ConfigConstants.MaxDrones

change it to 5 or 2 based on your ship

What would be the best way to get the bot to make a call to reload probe scanner window … then move on with the next task … basically trying change the class reloadAnomalies to use ALT+P twice to unload then load it again.

I would just use the default keypress of ALT+P

I have already gave you my code which is responsible to do so → here → A-Bot (small adjustments to the codes) [HELP] - #2 by pikacuq

all you have to do is change your key sequence in ReloadAnomalies

yield return new BotTask
				{
					Effects = new[] { MotionParamExtension.KeyboardPressCombined(new[] {
					 WindowsInput.Native.VirtualKeyCode.ALT,  WindowsInput.Native.VirtualKeyCode.VK_P
					 }) }
				};

read more closely… :slight_smile:

I actually got it working … i was worried about having it hit the same keys twice in a row …

playing more with it

I sometimes find it hard to know where abot is going through in its code - no next step

I keep losing drones … i think its a game aggro issue though - makes me wonder if a laser boat would be better –

loosing drones is not a problem of this bot, it’s common issue when:

a] wrong drones on wrong targets
a] wrong fit
a] wrong orbit distance
a] wrong skills

I’ve been there, managed to improve fit for running a bot. Do not forget that fit which might work for humans will unlikely be working for bot. You have to experiment what to do and how to do it.

For example, augmented drones are worst, they will always die immediately.

go to sun, leave ship for 30-60 sec, get back in.
after that go to station, put you drones in item hangar, repackage them and put them back in cargohold.

alternatively you can put an sensor booster, put an target painter on rats; put un ecm sensor ( that will agro rats on you)
also you can take the drones out after you orbit and you have agro on you

train more drones to be faster, more durable etc

will experiment with both your suggestions