Ratting bot: anomaly and/or asteroids with Sanderling

Here you have a bot script for Sanderling to ratting anomaly and/or asteroids. Configurations from settings for almost everything.
So:
The asteroids are taken from list surroundings button, and you warp at 20 km ( configurable in code), on anomaly at 50 km ( configurable in code)

and the master link:

2 Likes

Hey kaboonus, looks like you have discovered a new bot! Thank you for sharing this with us!
I added a link to this bot to the bot catalog: https://forum.botlab.org/t/bot-2cae55c4-this-bot-ratting-anomaly-and-or-asteroids-warp-to-asteroids-at-20km-anomaly-at-50km-configurable-from-settings-for-almost-everything/1207

I think I have found an oversight on the ArmorRepair logic at around line 315 you have this statement
if (ActivateArmorRepairer == true || ArmorHpPercent < StartArmorRepairerHitPoints)
which will always be true if you have ActivateArmorRepair set to true so it never really evaluates the second part of the statement.

I believe the correct logic behind this would be use && so the second part ArmorHpPercent < StartArmorRepairHitPoints will get evaluated.

Other than that it runs good for me… I have had a couple of Exceptions that I am trying to track down.

Thanks for your contributions.
Maniac

1 Like

from my logic was: if my armor repairer is not activated all time then i will activate the module when my armor drop in value at 95%.
Yes if ActivateArmorRepairer == true wil never evaluate armorHPpercent and thats ok, because it is already activated all time.
In fact ActivateArmorRepairer == true is for some players who wants armor repairer activate all time if you have cap stable if you don’t take neut etc…
If you change || with &&, then if armor repairer is set to false, then you never have an armor repairer active. ( even if it is in place). You can change end test .

Yes, sometimes he throws some exceptions( is not a perfect script), I’m sure of that and if you can tell me the situations it will be awesome to tell me.

1 Like

The problem I had with the logic was it was activating the repper and then deactivating after 1 cycle because the armor hit points were greater than 95 so it shut it down I got into a loop with the Log spamming each and every time it was activated/deactivated so I looked at that statement and saw it short circuited never really evaluating the second conditional.

My bad…

So in my instance I need to set the ActivateArmorRepper to false then.
Here is a clipboard of my latest exception
I was running havens when there is one wave that jams and you can’t get a target lock.
[
{
“TimeDateTimeIntraDayCal”: “11-26-31”,
“TimeDateTimeIntraSecMilliString”: “645”,
“CaptionString”: “System.AggregateException: One or more errors occurred. —> System.ArgumentNullException: Value cannot be null.\r\nParameter name: first\r\n at System.Linq.Enumerable.Intersect[TSource](IEnumerable1 first, IEnumerable1 second)\r\n at Submission#0.<get_EWarToAttack>b__100_0(IOverviewEntry entry)\r\n at System.Linq.Enumerable.WhereArrayIterator1.MoveNext()\r\n at System.Linq.Buffer1…ctor(IEnumerable1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at Submission#0.get_EWarToAttack()\r\n at Submission#0.DefenseStep()\r\n at Submission#0.<>d__0.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.d__91.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.CodeAnalysis.Scripting.Script1.d__21.MoveNext()\r\n — End of inner exception stack trace —\r\n at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)\r\n at BotSharp.ScriptRun.ScriptRun.<>c__DisplayClass68_0.<Start>b__0()\r\n---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.\r\nParameter name: first\r\n at System.Linq.Enumerable.Intersect[TSource](IEnumerable1 first, IEnumerable1 second)\r\n at Submission#0.<get_EWarToAttack>b__100_0(IOverviewEntry entry)\r\n at System.Linq.Enumerable.WhereArrayIterator1.MoveNext()\r\n at System.Linq.Buffer1..ctor(IEnumerable1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at Submission#0.get_EWarToAttack()\r\n at Submission#0.DefenseStep()\r\n at Submission#0.<<Initialize>>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.<RunSubmissionsAsync>d__91.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.CodeAnalysis.Scripting.Script`1.d__21.MoveNext()<—\r\n”,
“LineIndex”: 626,
“CharacterIndexInLine”: 0,
“LineIndexInAvalonEdit”: 627,
“CharacterIndexInLineInAvalonEdit”: 1
}
]

Thanks
Maniac

2 Likes

So in my instance I need to set the ActivateArmorRepper to false then.no problem.

Yes :slight_smile:

after 1 cycle because the armor hit points were greater than 95

damn, with this weather I’m really tired. so sorry,

From my experience is better to have in reality 2 cycles. so you can cover that (just to be sure, because you will get hit 1 more time, usual)

Ive come in avance with this so, you can change in accordance with your needs ( take in calc the repairer is added at the end of his cycle, your points of repair and add 0.5-1% for adjustements)
at the line 70

var StartArmorRepairerHitPoints = 95; // armor value in % , when it starts armor repairer - change 95 at 94 or even 90  or 80

I took the same exception but at first entry
So, replace at line 510 -513

Parse.IOverviewEntry[] EWarToAttack =>
    WindowOverview?.ListView?.Entry?
        .Where(entry => entry != null && (!entry?.EWarType?.IsNullOrEmpty() ?? false) && listEWarPriorityGroupTeamplate.Intersect(entry.EWarType).Any())
        ?.ToArray();

//with (I put an ordering by distance also)



Parse.IOverviewEntry[] EWarToAttack =>
    WindowOverview?.ListView?.Entry?
    .Where(entry => entry != null && (!entry?.EWarType?.IsNullOrEmpty() ?? false) && listEWarPriorityGroupTeamplate.Intersect(entry?.EWarType).Any())
    ?.OrderBy(entry => entry?.DistanceMax ?? int.MaxValue)
    ?.ToArray();
1 Like

Ive put avoiding gas haven anomaly and fixed Ewar on commit( if you are interested, if not, change CelestialToAvoid to “anyname hgfhghgfhghhfhgkkk” so to be sure are not players with that name)

1 Like

I strongly do not recommend to order EWARS by distance in any thinkable way!
simply because of in many many many cases, there will be more than 2 targets orbiting you at close range and they will be constantly changing distance.

Then, you are screwed because bot will be constantly switching targets to closest one not killing anything.

simply: anything what is in scram/web/neut/ecm EWAR range is close enought to be killed, no matter in which order

thank me later :stuck_out_tongue_winking_eye:

2 Likes

Hi there and thanks for working on the A-Bot

I itried it tonight and i had 2 differents “problems”

1/ When using the ratting in Asteroid belt :
=> When Belt is empty it warps you to another belt BUT if the system choose the same belt it crashes

2/ When using the anomaly part :
=> When the anomaly is finished it still tries to lock some Large collidable object called " Wreck"

Hope this report can help you making improvements for the future version

2 Likes

@Morpheus: first, thank you for the feedback it is really valuable.

problem solved :ok_hand:

Well, there it was a problem; I’m a lazy person and I used variables. It seems Sandy doesn’t love lazy guys :d :)). And… now I followed Terpla advice.
So problem solved ( and extended at other statements)
Anyway, the wrecks are looted in the new version.

@pikacuq

You have right, even if it is a script and is slower than your main bot :slight_smile: It happened one time when i was fucked by 6 ewar ships.
The problem is … I cannot distinguish between scramble, web, etc.
The ewartypeEnum who take the int of each ewar icon packaged into an array throw an argument null exception at first argument of Intersect.
If i put the listEWarPriorityGroupTeamplate !=null

&& listEWarPriorityGroupTeamplate !=null && listEWarPriorityGroupTeamplate.Intersect(entry.EWarType).Any())

then it ignores any ewar attack. :frowning:

Now, the way to solve all that is ( from alot of documentation over net):
step 1 identifyng each ewar id in overview
step 2 comparing him with my list using HashSet and a void - to return the all thinsg if null = …
step 3 make the intersect
step 4 creating the list to attack

Another way is to use directly an" foreach ewar in overview" if is enum.scramble then attack. The problem is again, enum because are not directly accessible.
Anyway, the all process takes time and since I don’t have ( unless I create him) a memory buffer specifically for ewar …

So, unless somebody with bigger experience and knowledge ( i cannot do all that and find an reliable solution) in programming, I will stay at the simple version:

?.Where(entry => entry != null && (!entry?.EWarType?.IsNullOrEmpty() ?? false) && (entry?.EWarType).Any())

or something like that :slight_smile:
I really thank you for feedback,it was really instructive.
The next version will be in a couple days :slight_smile:

1 Like

you dont need anything complicated.
ewar ships are frigates they die quickly … but if you are concerned about scram to be prioritized do something like that instead

				EWarTypeEnum[] EWarPriority = { EWarTypeEnum.WarpDisrupt, EWarTypeEnum.WarpScramble };

				EWarTypeEnum[] EWarRest = { EWarTypeEnum.ECM, EWarTypeEnum.Web };

note, if your ewar is ignored, i do believe it’s caused by entry != null condition.
My bit of working code looks like this

var EWarToAttack =
					listOverviewEntryToAttack.Where(entry => (!(entry?.EWarType?.IsNullOrEmpty()) ?? false ) && EWarPriority.Intersect(entry.EWarType).Any()) 
					?.OrderBy(entry => bot.AttackPriorityIndex(entry))
					?.ToArray();

later on I have simple condition to begin with my code

if (EWarToAttack.Count() > 0)
// DO STUFF

that is done from the begining and throw argument null exception :)( did you read the script?) and crash when is ewared

Sorry for the noob question but did you updated the code somewhere ? i see only your version of 4 days ago on github

Btw if you need more test i can help. As said to Viir i’m not able to write code but understand when i read it :slight_smile:

Happy to help

no, not yet. ok I will make an update right now
The only problem ( from my test) is the ewar, so i let only their presence

the update is online on git. Thank you @Morpheus.
Viir helped me with his post and learn everybody how to configure this bot. there are a lot of setting :slight_smile: ( to be honest I forgot about that)

**** LATER:
I tested the asteroids last entire night on HS so var RetreatOnNeutralOrHostileInLocal = false. - that means if you run him on null, you have to put him on true

Yeah on my side i’m only using it in 0.9 or 1.0 system so i have no rats in system … Less profit but less work to do :slight_smile:

i might need your Help to develop an Orca version i’ll throw you a PM about it :slight_smile:

Is there specific short cut settings that have to be made for this ?

Also … the retreat when neut/red in local isn’t working …

the retreat is working, for everybody and for me; the window has to be biggest possible, not scrollable ( like in all scripts for sanderling.

all shortcuts are in the setting, at the beginning of the script. if you played with shortcuts and you use other ones for orbit(w), attack drones (f), you can change them in settings in code

Also from your deleted post, I have no idea if is working on v17 of sanderling since is an older and local chat is changed in-game from then
The latest version includes the import of script from git https://github.com/Arcitectus/Sanderling

1 Like

Older Version - Working …

Shortcut Settings - Thanks for clarification, i figured that what it was but just wanted to get clarity

When I said retreat not working … it appears to be partially working for me …

it recalls drones … then opens systems window … at that point it throws an error for myself … do you need a botconfig file with retreatbookmark listed in it or is it good enough to name it in the cs file?

on the lines 74+ on script are the settings:

//	Bookmark of location where ore should be unloaded.
string UnloadBookmark = "home"; //supposed your bookmark is named home

//	Name of the container to unload to as shown in inventory.
string UnloadDestContainerName = "Item Hangar"; //supposed it is Item Hangar


//	Bookmark of place to retreat to to prevent ship loss.
string RetreatBookmark = UnloadBookmark;

that means your bookmark for retreat is named “home”, but you can change how you want
I advise you to read all settings

1 Like