Mining

Would it be possible to add  a surveillance for warpout if a neutral or an enemi appears to the local?

Would it be possible to add  a surveillance for warpout if a neutral or an enemi appears to the local?

Sure, you can find the chat windows in

MemoryMeasurementParsed?.Value?.WindowChatChannel

To identify the “Local” channel, you can use the “Caption” property of the window.

In the chat window, you find the list of members in the property

ParticipantView?.Entry
Sanderling.Interface.MemoryStruct.WindowChatChannel[] WindowChatChannel => Measurement?.WindowChatChannel;
Sanderling.Interface.MemoryStruct.IListEntry[] ParticipantView => Measurement?.ListEntry;

Je capte pas trop là pour déclarer le nombre de neutre au local et pouvoir l’appeler ensuite dans une condition.

Sanderling.Interface.MemoryStruct.WindowChatChannel[] WindowChatChannel => Measurement?.WindowChatChannel;
Sanderling.Interface.MemoryStruct.IListEntry[] ParticipantView => Measurement?.ListEntry;

Je capte pas trop là pour déclarer le nombre de neutre au local et pouvoir l’appeler ensuite dans une condition.

You can get the number by using the “Count” method on the subset of entries which match your definition.

How about this, where “setAllyName” is the set of names of players you do not consider neutral or enemy:

var NumberOfNeutralOrEnemy =     Sanderling.MemoryMeasurementParsed?.Value?.WindowChatChannel     ?.FirstOrDefault(chatWindow => chatWindow?.Caption?.RegexMatchSuccessIgnoreCase("local") ?? false)     ?.ParticipantView?.Entry     ?.Count(participantEntry =>         !(setAllyName?.Any(allyName => string.Equals(allyName, (participantEntry as ChatParticipant)?.NameLabel?.Text, StringComparison.InvariantCultureIgnoreCase)) ?? false));
int  setflagIcon = (1174);        if (!(1174 > setflagIcon))                {            InitiateDockToOrWarpToBookmark(StationBookmark);        }                var NumberOfNeutralOrEnemy =     Sanderling.MemoryMeasurementParsed?.Value?.WindowChatChannel     ?.FirstOrDefault(chatWindow => chatWindow?.Caption?.RegexMatchSuccessIgnoreCase("local") ?? false)     ?.ParticipantView?.Entry    !(setflagIcon?.Any(flagIcon => string.Equals(flagIcon, (participantEntry as ChatParticipant)?.SetSprite?.TextureOld?.Id, StringComparison.InvariantCultureIgnoreCase)) ?? false))

Merci pour ton aide Je suis un newbie et  je cale là pour aujourd’hui:

Dans

ParticipantView?.Entry?.ChatParticipant?.SetSprite?.TextureOld?.Id

il y a une Id qui doit corespondre à l’icone de stanting car les valeurs sont les même pour l’ally et differente pour les neutres.

1 Like
int  setflagIcon = (1174);        if (!(1174 > setflagIcon))                {            InitiateDockToOrWarpToBookmark(StationBookmark);        }                var NumberOfNeutralOrEnemy =     Sanderling.MemoryMeasurementParsed?.Value?.WindowChatChannel     ?.FirstOrDefault(chatWindow => chatWindow?.Caption?.RegexMatchSuccessIgnoreCase("local") ?? false)     ?.ParticipantView?.Entry    !(setflagIcon?.Any(flagIcon => string.Equals(flagIcon, (participantEntry as ChatParticipant)?.SetSprite?.TextureOld?.Id, StringComparison.InvariantCultureIgnoreCase)) ?? false))

Merci pour ton aide Je suis un newbie et  je cale là pour aujourd’hui:

Dans

ParticipantView?.Entry?.ChatParticipant?.SetSprite?.TextureOld?.Id

il y a une Id qui doit corespondre à l’icone de stanting car les valeurs sont les même pour l’ally et differente pour les neutres.

I see I should have explained this in more detail.

The Texture Id can not be used to directly infer standing as it only represents a memory address and thus often changes.

Since you want the info from the flag icon, I will expand the memory measurement to include the tooltip text which would appear when hovering the mouse over the flag icon. I will publish that version this week.

I assume using it will probably look similar to this for your use case:

bool IsNeutralOrEnemy(IChatParticipantEntry participantEntry) =>   !(participantEntry?.FlagIcon?.Any(flagIcon =>     new[] { "good standing", "excellent standing" }     .Any(goodStandingText =>        flagIcon?.HintText?.RegexMatchSuccessIgnoreCase(goodStandingText) ?? false)) ?? false);

(The “IChatParticipantEntry” interface is also new)

This function simply checks if there is a flag icon with a tooltip text containing “good standing” or “excellent standing”.

Would that be sufficient to make the decision?

I just published a version which lets you read out the flag icon text: http://forum.botlab.org/thread/sanderling-preview-16-00-18/

Merci pour ta reactivité c’est super.

j’ai test avec

bool IsNeutralOrEnemy(IChatParticipantEntry participantEntry) =>   !(participantEntry?.FlagIcon?.Any(flagIcon =>     new[] { "good standing", "excellent standing" }     .Any(goodStandingText =>        flagIcon?.HintText?.RegexMatchSuccessIgnoreCase(goodStandingText) ?? false)) ?? false);

en ajoutant

    if(null == "good standing","excellent standing");                   {                      Host.Log("dock if NeutralOrEnemy");                      InitiateDockToOrWarpToBookmark(StationBookmark);     }

mais il y a un probleme .

mais il y a un probleme .

When you tell me what the problem is, I might be able to help you.

To integrate the function I showed above with the included mining script you could try this (I have not yet tested this):

var    chatLocal =     Sanderling.MemoryMeasurementParsed?.Value?.WindowChatChannel     ?.FirstOrDefault(windowChat => windowChat?.Caption?.RegexMatchSuccessIgnoreCase("local") ?? false);  if(chatLocal?.ParticipantView?.Entry?.Any(IsNeutralOrEnemy) ?? true)    // will be true if (null == chatLocal)  {          Host.Log("don't like how it looks in local");           InitiateDockToOrWarpToBookmark(StationBookmark); }

Cool aucune erreur. J’ai test, mais ça fonctionne pas, peut-être faut  update plus souvent

J’ai test, mais ça fonctionne pas,

which case was that where you made that observation?

J’ai Test dans une Belt en minant, puis des neutres sont apparus au local et le ship a pas warp out.

c’est pour cela que je pense qu’il faut controler le local plus souvent car il n’y avait rien dans le journal.

J’ai Test dans une Belt en minant, puis des neutres sont apparus au local et le ship a pas warp out.

The code can only have an effect if executed. To check this, you could insert a Statement to create a log entry before the check of the condition.

Also, the example I showed works only when all chat participants fit in the scroll viewport.

c’est pour cela que je pense qu’il faut controler le local plus souvent car il n’y avait rien dans le journal.

How often the check is made depends on the control flow in the script. It needs to fit in with the other parts of the script.

Hello, I would use the script to mine in a pos. I would know how to edit the script to not dock in a station and move that contains the “Ore Hold” to a Personal Hangar Array or in a Container in a Corporation Hangar Array like this **<<Image>> .**And how to not target one asteroid and use 2 or 3 lazer on it. I would use one lazer by asteroid.  I know how to do programe in c++ language but im not familiar with the language of the script and how that work

I would know how to edit the script to not dock in a station

In case you refer to the included mining script, you can replace the following statement with an empty stamenent (a semicolon “;”) to prevent it from docking:

InitiateDockToOrWarpToBookmark(StationBookmark);

You can replace it like this:

; // this is now a comment. InitiateDockToOrWarpToBookmark(StationBookmark);

and move that contains the “Ore Hold” to a Personal Hangar Array or in a Container in a Corporation Hangar Array like this <<Image>> .

For this, I take the “UnloadToHangar” function from the included mining script and adjust it. Instead of using the “ItemHangarEntry” property of the window as a destination, I select the destination entry from the set of entries  on the left by comparing the entry label with a parameter I add to the function.

First I add the parameter used to identify the entry representing the destination container, with a default value that allows us to call it just like before without passing an argument:

void UnloadToHangar(string DestinationContainerName = "Item Hangar")

To get all the entries on the left, I use this expression:

WindowInventory?.LeftTreeListEntry?.SelectMany(entry => new[]{entry}.Concat(entry.EnumerateChildNodeTransitive()))

Then, from this set I select one by comparing the “Text” property of the entries with the new parameter of the “UnloadToHangar” function:

?.FirstOrDefault(entry => string.Equals(entry?.Text, DestinationContainerName, StringComparison.InvariantCultureIgnoreCase))

The function then looks like this:

void UnloadToHangar(string DestinationContainerName = "Item Hangar") {     Host.Log("unload to hangar.");      EnsureWindowInventoryOpenOreHold();      for ( ; ; )     {         var    OreHoldItem = WindowInventory?.SelectedRightInventory?.ListView?.Entry?.FirstOrDefault();         var    DestinationContainer =             WindowInventory?.LeftTreeListEntry?.SelectMany(entry => new[]{entry}.Concat(entry.EnumerateChildNodeTransitive()))             ?.FirstOrDefault(entry => string.Equals(entry?.Text, DestinationContainerName, StringComparison.InvariantCultureIgnoreCase));          if (null == DestinationContainer)            Host.Log("error: Inventory entry labeled '" + DestinationContainerName + "' not found");          if(null == OreHoldItem)             break;    //    0 items in OreHold                  Sanderling.MouseDragAndDrop(OreHoldItem, DestinationContainer);     } }

To let it move the items as you show in the screenshot, call it like this:

UnloadToHangar("Personal Hangar Array");

I know how to do programe in c++ language but im not familiar with the language of the script and how that work

No problem, you can ask any questions about the script language on this forum too. So far, all of them have been answered in a timely manner.

Merci ! Maintenent s’a marche : http://pastebin.com/zHL86PEE

void ModuleToggle(Sanderling.Accumulation.IShipUiModule Module) I would know what this fonction do and what this line do :

foreach (var Module in SetModuleMinerInactive)
            ModuleToggle(Module);
        return InBeltMineStep;

??? Thx

void ModuleToggle(Sanderling.Accumulation.IShipUiModule Module) I would know what this fonction do

The method “ModuleToggle” as defined in the included mining script toggles the activity of the module identified by the parameter. The term “toggle” here means switch between activated and deactivated (the resulting state depends on the previous state)

and what this line do :

foreach (var Module in SetModuleMinerInactive)
            ModuleToggle(Module);
        return InBeltMineStep;

This executes the statement “ModuleToggle(Module);” for each item in “SetModuleMinerInactive” where this item is captured as “Module” and then exits from the current function, returning the value of “InBeltMineStep”.

In that script, “SetModuleMinerInactive” is a global property returning all modules which the bot expects to be mining modules and be inactive.

“InBeltMineStep” in this context refers to the function defined at https://github.com/Arcitectus/Sanderling/blob/932403ffdd7e705ff34528012c3ecf4745f356b8/src/Sanderling/Sanderling.Exe/sample/script/Mine.ore.cs#L219

I know how to do programe in c++ language but im not familiar with the language of the script and how that work

I realized you might not be aware of this, so I am stating this here too:

The scripting language is so far identical to C# script which in turn is very similar to C#. This means that you can instantly find answers to questions about the language all over the web in case you don’t want to wait for a response on here.

I would know how to select the first asteroid and also how to target a other asteroid until the number of mining laser