Pikacuq is tweaking A-Bot :)

it is not enough because you cannot evaluate if align is already happening or not.
so if bot clicks on “align to” he will keep clicking on it because he does not have a clue if it is already happening.

so, my question is, if we can add align to to shipmaneuver type or how to recognize if it is aligning or not already

edit: your code above might work, you just need to add new type to parse in ParseStatic.cs, i’ll give it a try tho

so, how i told you, you can read aligning state through caption ShipUI .
but if you orbit (usual around a rock) and you comand align, the bot will read if you are still in orbit state; so he will not keep clicking align.
If you turn off afterburner before, and you give him align, in a matter of max 2 sec ( on vni) you get out from orbit state.
at least for me is like that.
Longer will take to return the drones, if you are too close and in the same spot with drones are many objects in space ( wrecks) that will take some time

				if (ShipManeuverStatus == ShipManeuverTypeEnum.Orbit)
				{
					yield return new MenuPathTask
					{
						RootUIElement = memoryMeasurement?.InfoPanelCurrentSystem?.ListSurroundingsButton,
						Bot = Bot,
						ListMenuListPriorityEntryRegexPattern = new[] { new[] { retreatBookmark }, new[] { @"align", ParseStatic.MenuEntryAlignToRegexPattern } },
					};
				}

This works, I’ll look onto the caption as well, thanks

sure is works, :)) i using him ( i told you from real experience ; always, actually i struggle from +1 month with the bot, coding, recoding, etc)

well, your code was not working as you are enumerating warp, which cannot occur in align to menu, i’ve change it a bit to work in my piece, anyways thanks for hint :wink:

for me is working like a charm, he stop ab, start repairer, align and retreat drones. in 6 sec Im in warp ( if drones come fast)

				var ShipManeuverStatus = memoryMeasurement?.ShipUi?.Indication?.ManeuverType;

				if (armorHitPoitns < 1100)
				{
					yield return Bot.EnsureIsActive(armorRepairers);
				}
				if (ShipManeuverStatus == ShipManeuverTypeEnum.Orbit)
					yield return new MenuPathTask
					{
						RootUIElement = memoryMeasurement?.InfoPanelCurrentSystem?.ListSurroundingsButton,
						Bot = Bot,
						ListMenuListPriorityEntryRegexPattern = new[] { new[] { retreatBookmark }, new[] { @"align", ParseStatic.MenuEntryWarpToAtLeafRegexPattern } },
						//ListMenuListPriorityEntryRegexPattern = new[] { new[] { retreatSafe }, new[] { @"align", ParseStatic.MenuEntryWarpToAtLeafRegexPattern } },
					};
					if (0 < droneInLocalSpaceCount)
						yield return new BotTask //return to bay drone
						{
							Effects = new[] { MotionParamExtension.KeyboardPressCombined(new[] {
									   VirtualKeyCode.SHIFT, VirtualKeyCode.VK_R
										}) }

						};

				if (5 != droneInLocalSpaceCount)
					yield return new RetreatTask { Bot = Bot, };

				if  (2 < setLocalChatWindowCandidate?.Length)
				yield return new RetreatTask { Bot = Bot,};
1 Like

If I’m not mistaken, I also mentioned the need to expand this ShipManeuverTypeEnum. Then the problem was solved as suggested by the kaboonus: by the caption.

var isAligning = memoryMeasurement?.ShipUi?.Indication?.LabelText?.Any(
		text => text?.Text?.RegexMatchSuccess("aligning", System.Text.RegularExpressions.RegexOptions.IgnoreCase) ?? false) ?? false;

if (!isAligning)
{
	yield return new MenuPathTask
	{
		RootUIElement = memoryMeasurement?.InfoPanelCurrentSystem?.ListSurroundingsButton,
		Bot = Bot,
		ListMenuListPriorityEntryRegexPattern = new[] { new[] { retreatBookmark }, new[] { @"align", ParseStatic.MenuEntryWarpToAtLeafRegexPattern } },
	};
}

Offtop: guys, read this thread.

1 Like

Yes , you mentioned in one post , but for personal use, i don’t “stick” nothing to align state .

My problem for now is to wait in haven anomaly to populate… you have any idea?

donne with highlight the code. Thank you

yep kaboonus, i do have very similar code as test one… but it’s very long process as it is always waits for the end. So what i’m trying to tweak, is more parallel approach eg.

click on prop, align, retreat drones, check if all stuff was done.

:wink:


another thing. I’m not sure how and when exactly, but it seems like sometimes bot after retreat is not able to continue when local is clear. He keeps clicking on infopanelwindow, hovering usually around anomalies submenu. When I physically push escape (to get rid of that menu) bot continue just fine then.
Any idea why it might happen?

hmmmmmm the normal behavior is:
check for local ( save ship and he take the standigs from parse extention)
… ( here you can insert some tasks: align, turnoff ab; call drones)
retreat task: warp - dock to home ( btw, what code you use for warping, i know you changed-him)

-so if you changed the code and you warp directly from saveship? i use that, but to another safespot and after that i call retreat.cs to dock.

if you use warp to 0 ( any method)and after that retreat near station ( warpmenu enumerated) is normal, because the menu is changed ( first is aproach and second is dock, but is an ordinaire menu). So, he try to find warpmenu.
or maybe somewhere you have a loop or condition ( IF…) because if the local become clean, normally, he must enter in anomalytask so he must try to click right on anomaly and warp at 50.
Hovering around anomalies means you:
1 he try to ignore anomaly ( but he cant so he push … save. this is a bug from anomaly, you cant avoid him ( actually yes, you can but… normally is too rare) . ALso he can try to find the one with km :slight_smile: maybe… because near you you have a blue/green and thats because maybe you are in combat mode ( so that means you have some rats and you are near stargate)

So, a good home is: far from any stargate, use a home unused by others ( because he sees them like an ocupied place)
In my opinion, because i strugled with sames troubles:
revise your code; put some conditions to enter in combat mode :

				var Anchor = memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
				?.Where(entry => entry?.Name?.RegexMatchSuccessIgnoreCase("broken|pirate gate") ?? false)
				?.OrderBy(entry => entry?.DistanceMax ?? int.MaxValue)
				?.ToList();
 if ((listOverviewEntryToAttack.Count() > 0)  && (Anchor.Count > 0))
start fight

look if you can enter in skipanomaly even if you are not in anomaly ( i have condition: blue, greens, AND anchor to enter in skip anomaly ) So if Im near station, the anchor is not there :d => he enter in normal anomaly enter
Also you can change broken/pirate gate with chemical factory to avoid haven gas :wink: and take out the rats from stargates in overview.
The is another possibility for all this behavior, because he call saveship and after that retreat.cs from inside the combat file ( I think). and that means he doesn’t get out from loop. Again, rats/blues are the reason for that. And again, my anchor var could resolve your trouble, because you enter in combat file only if the anchor is present

ah, so bot thinks SAFE is occupied when there is somebody else? than it kind of make sense he is in loop. Strange, was not really expecting something like that in the code. Have to have a look.

Nope am not warping from saveship, am warping from retreat as i should.
Thing is tho, that bot waits till module stops blinking red, bot waits till drones are in bay etc. to proceed to another task… but in real life, you pres SHIFT+R, disable AB and Align in basically same time. So this is something I want to achieve, but currently without much luck, but am trying :slight_smile:

My idea is to push shortcuts for module where AB sits and for drones in one step. But I’m kind of strugling with fact, that bot keeps pushing that key more than once eg. stopping and starting AB continously. In terms of drones it does not matter, but module is a problem. Kind of can’t figure out how in C# can I run code just once properly. :slight_smile:

That anchor var is pretty clever. Would you be so kind and shared with me your combat and retreat? :wink:

my retreat is the usual one ( except off abot, to be sure, i work all on shipsave.
:slight_smile:
my combat is on development all time, is more green from too many /* */ and // :slight_smile: but i will share parts of him with explanations in Avoiding to struggle - a guide for beginers - #2 by kaboonus
Im more interested how you tweaked the warp line, from the beginning of our discussion.

you cant push all of them in same time that’s work for me Pikacuq is tweaking A-Bot :) - #11 by kaboonus but after that i put them all together … because I fly ships without drones. Also i warp from saveship to an safespot, just because some of reds just passing ( and is enough for me to be in warp before they get out from system and in the end i call retreat task

well you can push as many of buttons you want at same time, that’s not an issue.
Issue is (which am currently struggling with) that code is executing this class over and over again. What I need is to execute it only once and then continue to warpin.

I know that it is solvable with some conditions, issue is, that those conditions - like “check if drones are back” or “check if module is not active” takes quite a long time eg. I dont want to wait to my drones to proceed to another task, they can be returing whils bot is doing another tasks.

which part you are interested in? this is my work-in-progress code around aligning/warping/saving drones.
only “issue” now is that disabling propmod is in my opinion slowest part, because it is simply waiting for module to stop glowing red. Better option will be just push shortcut key, but have no yet idea how to push it just once :slight_smile:

				// step 1 align + first call of drones
				if (ShipManeuverStatus == ShipManeuverTypeEnum.Orbit)
				{
					yield return new BotTask //return to bay drone
					{
						Effects = new[] { MotionParamExtension.KeyboardPressCombined(new[] { VirtualKeyCode.VK_R }) }
					};

					yield return new MenuPathTask
					{
						RootUIElement = memoryMeasurement?.InfoPanelCurrentSystem?.ListSurroundingsButton,
						Bot = Bot,
						ListMenuListPriorityEntryRegexPattern = new[] { new[] { retreatBookmark }, new[] { @"align", ParseStatic.MenuEntryAlignToRegexPattern } },
					};
				}
				// step 2 check if propmod is on and deactivate it
				yield return Bot?.DeactivateModule(setPropmod); //DEACTIVATE AF/MWD

				// step 3 recall drones if they are still in space
				if (0 < droneInLocalSpaceCount)
				{
					yield return droneGroupInLocalSpace.ClickMenuEntryByRegexPattern(Bot, @"return.*bay");
				}

				// step 4 warp to safe
				yield return new MenuPathTask
				{
					RootUIElement = memoryMeasurement?.InfoPanelCurrentSystem?.ListSurroundingsButton,
					Bot = Bot,
					ListMenuListPriorityEntryRegexPattern = new[] { new[] { retreatBookmark }, new[] { @"dock", ParseStatic.MenuEntryWarpToAtLeafRegexPattern } },
				};

this ones are good, but before them you can put:

if (ab.IsActive(Bot) ?? true)
{
{
yield return Bot.DeactivateModule(aboff);
//yield return Bot.EnsureIsActive(armorRepairers);
};
yield return new BotTask //return to bay drone
{
Effects = new[] { MotionParamExtension.KeyboardPressCombined(new[] {
VirtualKeyCode.SHIFT, VirtualKeyCode.VK_R
}) }

};
yield return new MenuPathTask
{
RootUIElement = memoryMeasurement?.InfoPanelCurrentSystem?.ListSurroundingsButton,
Bot = Bot,
ListMenuListPriorityEntryRegexPattern = new[] { new[] { retreatBookmark }, new[] { @"align", ParseStatic.MenuEntryWarpToAtLeafRegexPattern } },
};
}

my trick is using 2 definitions for ab :d one for interogate the modul if is active ( not with glowing because he will wait, like you said) and one for deactivate. And I come with that simply because you cant have both in same definition of ab

         var ab = Bot?.MemoryMeasurementAccu?.ShipUiModule?.Where(m => m?.IsAfterburner(Bot) ?? false).FirstOrDefault();
                var aboff = Bot?.MemoryMeasurementAccu?.ShipUiModule?.Where(m => m?.TooltipLast?.Value?.IsAfterburner ?? false);

and also i deactivated the click left from tooltip module ( so he use only f1/f2/f3). You can try to use only the tooltip module variant and you will see you cant use If is active :)) so i made 2 definitions

interesting, where you have defined m?.IsAfterburner(Bot) ? this code of yours gives me an error there

m= module, you can replace. I have more definitions of module :slight_smile: ( maybe because of that i have errors sometime

well, still error. As I understand this code means you have somewhere defined what “IsAfterburner(Bot)” is because other var is referencing to ShipUI TooltipLast.Value which is defined just fine.

But first one is referencing to ShipUIModule.IsAfterburner which I dont have aparently :slight_smile:

in botextension.cs you have

		static public bool IsAfterburner(this Accumulation.IShipUiModule module, Bot bot) =>
				module?.TooltipLast?.Value?.TitleElementText()?.Text?.RegexMatchSuccessIgnoreCase("Afterburner") ?? false;

gotcha, thanks… anyway it is doing the same as my code …

literally clicks on AB and waits till it is fully off and then continue to retrieve of dones… crapy crap, something is wrong :slight_smile:

hmmmmmm mine is passing really fast to align, the AB is still glowing , i think… because i just see im aligning and ab is already off ( i fact i realize just im aligned and my drones return already) … maybe you have definition of Is active who include the glowing? I remember i deleted someting like that. I see in module I use only rampactive ( in sanderling this is false or true and is changing in instant) what is means is much faster than glowing and etc etc