Code settings [HELP]

Well my friends, before I start this topic I want to thank the help and collaboration of all the members, especially @kaboonus, @pikacuq and @Terpla, who have helped me significantly improve my BOT and add a series of implementations, so that it works the best it can for me.

Currently I’m at the end of my BOT <just fine-tuning the codes and correcting some small errors.

I created this topic in order to gather all the little questions that I have in doubt (since I’m not a good programmer) and who knows, someone with the right knowledge can help me.

My first question is this:
I implemented this code (adapted from @pikacuq) in my document:

saveship.cs

				bool BackgroundColorsEnemies(ColorORGB color) =>
					(color.OMilli == 500 && color.RMilli == 0 && color.GMilli == 150 && color.BMilli == 600);

				var listOverviewEntryEnemies =
								memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
								?.Where(entry => entry?.ListBackgroundColor?.Any(BackgroundColorsEnemies) ?? false)
								?.ToArray();
						if(listOverviewEntryEnemies.Length > 0)
						{
							yield return new RetreatTaskEmergency { Bot = Bot };
						}
			}

It should call the RetreatTaskEmergency function when an ally enters my overview, however this is not happening …
The ally enters the overview and it continues executing the other codes in a normal way.

My other question, which I am trying to implement is that when my ship is destroyed (to be added to the pod), it goes to RetreatTask, some kind of module verification, if it does not have any, it will call this function. POD).

Anyone have any idea what might be going on?

this code has nothing to do with Allies, but Enemies… why would you warpout when blue enters your site?

I kept the color of allies to make a test with my friends … I enter the anomaly, I start to execute it and I ask a friend to warp on me, so he appreciates in my overview nothing happens, I continue performing the anomaly of normal way, when in fact I should call the RetreatTaskEmergency function.

I put it as an ally just for testing.

you have a lot of bloat in my codes because I’m not using anymore A-bot

bool IsEnemyBackgroundColor(ColorORGB color) =>
				color.OMilli == 500 && color.RMilli == 750 && color.GMilli == 0 && color.BMilli == 600;

				bool IsFriendBackgroundColor(ColorORGB color) =>
				color.OMilli == 500 && color.RMilli == 0 && color.GMilli == 150 && color.BMilli == 600;

				bool IsCorpBackgroundColor(ColorORGB color) =>
				color.OMilli == 500 && color.RMilli == 100 && color.GMilli == 600 && color.BMilli == 100;
				var listOverviewEntryFriends =
				memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
				?.Where(entry => entry?.ListBackgroundColor?.Any(IsFriendBackgroundColor) ?? false)
				?.ToArray();
var listOverviewEntryCorp =
				memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
				?.Where(entry => entry?.ListBackgroundColor?.Any(IsCorpBackgroundColor) ?? false)
				?.ToArray();

				var listOverviewEntryEnemy =
				memoryMeasurement?.WindowOverview?.FirstOrDefault()?.ListView?.Entry
				?.Where(entry => entry?.ListBackgroundColor?.Any(IsEnemyBackgroundColor) ?? false)
				?.ToArray();

					if ((listOverviewAvoidAnomalys.Count() != 0) || (listOverviewEntryFriends.Length != 0) || (listOverviewEntryCorp.Length != 0))
					//	if (listOverviewEntryToAttack.Count() > 1000000)

					{
						//Console.Beep(500, 200);
					//	System.Media.SystemSounds.Beep.Play();
						yield return new AnomalyEnter { bot = bot };
					}
				if (listOverviewEntryEnemy.Count() > 0)
				{

					yield return new RetreatTask { Bot = bot };
				}

about your pod:, if the way used on my bot/script is too complicated, then use this:

			var ShipType = WindowInventory?.LabelText?.FirstOrDefault(text => (text.Text?.RegexMatchSuccessIgnoreCase("Capsule") ?? true));
							if (null != ShipType)

yield return new RetreatTask { Bot = bot };

all are not in saveship.cs but in combat.cs; Is better to have a saveship shorter , without many things inside, to be executed faster, so he can send the execution to retreat (warping)

Thanks for the help, I added the code to capsule however when compiling gave the error stating that:

“WindowInventory” is an ambiguous reference between “Sanderling.Interface.MemoryStruct.WindowInventory” and “Sanderling.Parse.WindowInventory”

				var WindowInventory = memoryMeasurement?.WindowInventory?.FirstOrDefault();
				var inventoryActiveShip = WindowInventory?.ActiveShipEntry;
var inventoryActiveShipEntry = WindowInventory?.ActiveShipEntry;

				if (!(inventoryActiveShip?.IsSelected ?? false))
				{
					yield return new BotTask { Effects = new[] { inventoryActiveShip.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Left) } };

				}




also you have to be all time on inventory active ship and with inventory opened. The order of lines is not the one posted here, you have to put them on good positions ( first define the window, after that open inventory and clik on active ship)
now you have all I have on this subject on my old a-bot and is working; dunno if you have same things/definitions, because you use the weird a-bot

Thank you for your help…

I added the following code, as it passed me:

				var WindowInventory = memoryMeasurement?.WindowInventory?.FirstOrDefault();
				var inventoryActiveShip = WindowInventory?.ActiveShipEntry;
				var inventoryActiveShipEntry = WindowInventory?.ActiveShipEntry;

				if (!(inventoryActiveShip?.IsSelected ?? false))
				{
					yield return new BotTask { Effects = new[] { inventoryActiveShip.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Left) } };

				}

				var ShipType = WindowInventory?.LabelText?.FirstOrDefault(text => (text.Text?.RegexMatchSuccessIgnoreCase("Capsule") ?? true));
				if (null != ShipType)
				{
					yield return new RetreatTask { Bot = Bot };
				}

I opened Active Ship and it did not work.
I opened Inventory and it did not work, either.

When I am in a POD, it continues to follow normal for the anomaly.