Mining

how to select the first asteroid

I assume you are still working with the included mining script. Therefore I reference the properties and methods included there for this answer.

You can select an asteroid in the overview by clicking on its overview entry. The property “ListAsteroidOverviewEntry” contains the visible overview entries considered asteroids sorted by distance.
In summary, to select the first asteroid, you can use this statement:

Sanderling.MouseClickLeft(ListAsteroidOverviewEntry?.FirstOrDefault());

and also how to target a other asteroid until the number of mining laser

Assuming you can depend on the configuration of the “Lock target” keyboard shurtcut, you can lock an asteroid by selecting its overview entry by leftclicking on it and then calling Sanderling.KeyboardPressCombined to send the key combination configured for targeting like this:

Sanderling.MouseClickLeft(AsteroidOverviewEntry);Sanderling.KeyboardPressCombined(LockTargetKey);

As an example, if you have configured CTRL as the “Lock target” keyboard shurtcut, you define it in the script like this:

var LockTargetKey = new[]{ VirtualKeyCode.LCONTROL };

To get the number of mining laser, you need to know that in the current version the mining modules are identified by their module tooltips. Call the method “ModuleMeasureAllTooltip” to let the bot measure the tooltips of all currently visible modules. The bot then remembers the module tooltips as long as the modules are visible and not displaced. After that, you can get the number of mining modules from this expression:

(SetModuleMiner?.Count() ?? 0)

I would know if a Mining lazer are use on a asteroid and were is this asteroid and how to UnTarget a asteroid and how many asteroid are targeted and how to desactive a laser. Why the laser are some time desactiveted by the bot for aparently no reason?.

// I find how tu untarget

if a Mining lazer are use on a asteroid

If you are sure nothing else (like a mining drone) could be assigned to the target then you can just use this expression where “Target” is the IShipUiTarget that represents the asteroid:

(0 < Target?.Assigned?.Count())

It will be true if there is a module or drone assigned to the target. Is this sufficient for your use case?

and were is this asteroid

The properties “DistanceMin” and “DistanceMax” on the IShipUiTarget or IOverviewEntry return the minimum and maximum distance to your ship. (The distance displayed on the screen is rounded, so there is an upper and a lower bound)

and how to UnTarget a asteroid

When the representing overview entry is selected, you can UnTarget by using this Statement where “UnLockTargetKey” is an array holding the keys of the configured “Unlock target” keyboard shortcut:
Sanderling.KeyboardPressCombined(UnLockTargetKey);

how many asteroid are targeted

For this, I would try to count how many targets contain the text “Asteroid (” like this:

int TargetRoidCount => Sanderling?.MemoryMeasurementParsed?.Value ?.Target?.Count(target => target?.TextRow?.Any(textRow => textRow?.RegexMatchSuccessIgnoreCase(@"Asteroids*(") ?? false) ?? false) ?? 0;

how to desactive a laser

Toggle the module which represents that laser using the “ModuleToggle” method.

Why the laser are some time desactiveted by the bot for aparently no reason?

I think the reason is “RampActive” sometimes returns false even though the module is active. Then the module is considered as inactive by the mining script so it tries to activate it by toggling it.
I will look into improving this.

Je voudrais savoir comment savoir si un asteroid est verrouiller(target) dans la fenetre Overview

Je voudrais savoir comment savoir si un asteroid est verrouiller(target) dans la fenetre Overview

Now that I look at it, I realize that this is not yet as easy as it should be. I will add the appropriate property on the IOverviewEntry.
In the meantime you can get this information by adding the following methods to your script:

bool ContainsLeftIconWithNameMatchingRegexPattern(Parse.IOverviewEntry overviewEntry, string regexPattern) => overviewEntry?.SetSprite?.Any(Sprite => (Sprite?.Name).RegexMatchSuccessIgnoreCase(regexPattern)) ?? false; bool TargetedByMe(Parse.IOverviewEntry overviewEntry) => ContainsLeftIconWithNameMatchingRegexPattern(overviewEntry, "targetedByMe");

int TargetRoidCount => Sanderling?.MemoryMeasurementParsed?.Value ?.Target?.Count(target => target?.TextRow?.Any(textRow => textRow?.RegexMatchSuccessIgnoreCase(@“Asteroids*(”) ?? false) ?? false) ?? 0;

Ceci me cause quelques problemes, car parfois je verouille un asteroid et la valeur semble ne pas s’actualiser…

Exemple:

Je verouille un asteroid (TargetRoidCount = 1)

Je verouille un autre asteroid (TargetRoidCount = 1)

Je verouille un autre asteroid (TargetRoidCount = 1)

Je verouille un autre asteroid (TargetRoidCount = 2)

Je verouille un autre asteroid (TargetRoidCount = 2)

Je verouille un autre asteroid (TargetRoidCount = 3)

puis une condition le fais arêter.

Aussi j’aimerais savoir comment il y a d’asteroid dans l’overview et quel et la distance d’un asteroid selectionné au hasard aussi dans l’overview(sans avoir a selectionné celui-ci ou le verouiller) et aussi de quel type d’asteroid il s’agit.

Voici mon script : http://pastebin.com/Wnek4G6t (il est encore en test et ne marche pas tout le temps pour les raisons précédemment enumérées)

Le principale du code changer est dans InBeltMineStep()

Aussi j’ai un autre petit probleme quand je perds une cible il y a une erreur dans le log. L’erreur se produit a la ligne 333 lorsque je perds une target.

Encore hiere je ne savais pas du tout ce qu’étais un api. En allant dans l’onglet API Explorer je me suis rendu compte que certaine valeur n’etais pas actualiser par exemple : http://snag.gy/60cvu.jpg

Alors que j’avais désélectionné tout les asteroid rapidement les élements dans Target sont restés là et sont encore alors que je prend mon temps pour t’écrire ce message…

S’est très probable que m’on probleme de variable qui ne s’actualise vienne de là…

Aussi je pense que tu actualise toutes les valeurs pourquoi tu n’actuliserais pas seulement celles utilisés pour faire fonctionner le script? seulement lorsqu’il et en marche et lorsqu’il n’est plus en marche tu les actualises toutes.

int TargetRoidCount => Sanderling?.MemoryMeasurementParsed?.Value ?.Target?.Count(target => target?.TextRow?.Any(textRow => textRow?.RegexMatchSuccessIgnoreCase(@“Asteroids*(”) ?? false) ?? false) ?? 0;

Ceci me cause quelques problemes, car parfois je verouille un asteroid et la valeur semble ne pas s’actualiser…

Exemple:

Je verouille un asteroid (TargetRoidCount = 1)

Je verouille un autre asteroid (TargetRoidCount = 1)

Je verouille un autre asteroid (TargetRoidCount = 1)

Je verouille un autre asteroid (TargetRoidCount = 2)

Je verouille un autre asteroid (TargetRoidCount = 2)

Je verouille un autre asteroid (TargetRoidCount = 3)

puis une condition le fais arêter.

This is how eve online works, locking a target can take time. When you give the commmand to lock a target, it will not necessarily immediately be targeted and shown as locked.

Aussi j’aimerais savoir comment il y a d’asteroid dans l’overview et quel et la distance d’un asteroid selectionné au hasard aussi dans l’overview(sans avoir a selectionné celui-ci ou le verouiller) et aussi de quel type d’asteroid il s’agit.

I did not understand everything in that paragraph. To get the ore type of the asteroid, call the method “OreTypeFromAsteroidName” and pass the “Name” of the IOverviewEntry.

Voici mon script : http://pastebin.com/Wnek4G6t (il est encore en test et ne marche pas tout le temps pour les raisons précédemment enumérées)

Le principale du code changer est dans InBeltMineStep()

Aussi j’ai un autre petit probleme quand je perds une cible il y a une erreur dans le log. L’erreur se produit a la ligne 333 lorsque je perds une target.

I assume you are refering to this statement:

Target = SetTargetAsteroid[t];

This will throw an exception (making the script stop) if SetTargetAsteroid is null or its Length is less than 0 or greater or equal then t.
To make it return null instead of throwing an exception, you can replace the expression on the right with:

SetTargetAsteroid?.ElementAtOrDefault(t)

Encore hiere je ne savais pas du tout ce qu’étais un api. En allant dans l’onglet API Explorer je me suis rendu compte que certaine valeur n’etais pas actualiser par exemple : http://snag.gy/60cvu.jpg

Alors que j’avais désélectionné tout les asteroid rapidement les élements dans Target sont restés là et sont encore alors que je prend mon temps pour t’écrire ce message…

The update should happen when the “begin Time” under “time & origin” changes. In the case of your screenshot, according to the time displayed, the values should be no older than 8 seconds.

I will take a look at this problem.

S’est très probable que m’on probleme de variable qui ne s’actualise vienne de là…

Why do you assume that? Did you let it output the number of targets?

In case you did not know, you can copy the path selected in the measurement from the TextBox under “selection” (this section is collapsed in your screenshot and therefore not visible).

Aussi je pense que tu actualise toutes les valeurs pourquoi tu n’actuliserais pas seulement celles utilisés pour faire fonctionner le script? seulement lorsqu’il et en marche et lorsqu’il n’est plus en marche tu les actualises toutes.

I am not yet sure if it will be worth the effort to implement this additional discrimination.

Pourquoi sa ne marche pas !?! Le probleme est que la valeur TargetRoidCount reste parfois plus petite que le nombre de module alors que s’est faux car les cibles sont clairement verouiller et sont présente dans le haut à droite du jeux et que le nombre de module est suppérieur que la nombre de modules

int selectionTarget; // Position de la cible choisie dans l'owerviewint TargetRoidCount =>Sanderling?.MemoryMeasurementParsed?.Value?.Target?.Count(target => target?.TextRow?.Any(textRow => textRow?.RegexMatchSuccessIgnoreCase(@"Asteroids*(") ?? false) ?? false) ?? 0;;Sanderling.Parse.IShipUiTarget Target = null;bool NotHaveModule = true;Func<object> InBeltMineStep(){    if (DefenseEnter)    {        Host.Log("enter defense.");        return DefenseStep;    }            var    AsteroidOverviewEntry = ListAsteroidOverviewEntry?.FirstOrDefault();        if(null == AsteroidOverviewEntry)    {        Host.Log("no asteroid available");        return null;    }        if(OreHoldFilledForOffload)        return null;            if(!(0 < SetModuleMinerInactive?.Length))        return InBeltMineStep;                Target = null;        EnsureWindowInventoryOpenOreHold();    EnsureOverviewTypeSelectionLoaded();    while(DronesInSpaceCount <=  0)        DroneLaunch();        var    SetTargetAsteroidInRange = SetTargetAsteroid?.Where(target => target?.DistanceMax <= MiningRange)?.ToArray();            if(!(AsteroidOverviewEntry.DistanceMax < MiningRange))        {            Host.Log("out of range, approaching");                ClickMenuEntryOnMenuRoot(AsteroidOverviewEntry, "approach");        }    /*        N'a aucune raison d'entrer dans cette condition lorsque toutes les cibles sont ciblées         alors que par exemple pour le Retriver(2 modules d'extraction) il y retourne alors        qu'il a deja ciblé 3 cible(dont une de trop)    */    if(TargetRoidCount < SetModuleMiner?.Count()) // Si il y a moin de cible que le nombre de module de minage    {        for(int i = TargetRoidCount; i<SetModuleMiner?.Count(); ++i){    // Selectionne des cibles        selectionTarget = genNbr.Next(0,3);        while(TargetedByMe(ListAsteroidOverviewEntry[selectionTarget])) // Tant que dans l'overview a la position de selectionTarget est deja veroullé choisie une autre cible...            selectionTarget = genNbr.Next(0,3); // Méthode un peu "fafa" pour choisir une cible...                    if(!(TargetedByMe(ListAsteroidOverviewEntry[selectionTarget])) && (TargetRoidCount < SetModuleMiner?.Count())) // Si elle n'est pas cibler et si il y a moin de cible que de module d'extraction            {                ClickMenuEntryOnMenuRoot(ListAsteroidOverviewEntry[selectionTarget], "^lock");    // Verouille...                Host.Log("locking");                Host.Delay(10000);    /// Attend 10 secondes                Host.Log(TargetRoidCount); // Affiche le nombre de cibles verouillés dans le log                /*                    Souvent le nombre ne change pas!?!...                */            }        }    }    Host.Log("targeted asteroids in range: " + SetTargetAsteroidInRange?.Length);        if(0 < SetTargetAsteroidInRange?.Length)    {        var TargetAsteroidInputFocus    =            SetTargetAsteroidInRange?.FirstOrDefault(target => target?.IsSelected ?? false);        if(null == TargetAsteroidInputFocus)//            Sanderling.MouseClickLeft(SetTargetAsteroid?.FirstOrDefault());    int t = 0;        foreach (var Module in SetModuleMinerInactive)        {            for(t = 0; (t < TargetRoidCount) && NotHaveModule; ++t){ // Vérifie pour chaque module si elle a un module d'assigné                Target = SetTargetAsteroid?.ElementAtOrDefault(t);// Target l'asteroid                if((Target?.Assigned?.Count() == 0))// Si elle n'a pas un module change la valeur de NotHaveModule pour arreter la boucle                    NotHaveModule = false;            }            if(Target?.Assigned?.Count() == 0){    // Re vérifie si ele a un module                Sanderling.MouseClickLeft(Target);    //Click dessu                Host.Log(Target.DistanceMax + ": Target.DistanceMax" + MiningRange + " : MiningRange");                ModuleToggle(Module);    // Active un module sur la cible                return InBeltMineStep;            }            NotHaveModule = true;                    }        return InBeltMineStep;    }        Host.Log("next asteroid: " + AsteroidOverviewEntry?.Name + " , Distance: " + AsteroidOverviewEntry?.DistanceMax);    return InBeltMineStep;}

Pourquoi sa ne marche pas !?! Le probleme est que la valeur TargetRoidCount reste parfois plus petite que le nombre de module alors que s’est faux car les cibles sont clairement verouiller et sont présente dans le haut à droite du jeux

This looks like there has been a misunderstanding. TargetRoidCount should reflect the number of Targets which are asteroids. This number is independend of the number of ship modules.

So as long as the TargetRoidCount equals the number of asteroid targets you can see on the screen, it works like I would expect it.

Keep in mind that TargetRoidCount as suggested earlier is calculated from the last MemoryMeasurement taken.To tell Sanderling that the last measurement is not valid anymore use this statement:

Sanderling.InvalidateMeasurement();

et que le nombre de module est suppérieur que la nombre de modules

Does it mean that “module” is different from “modules”? So far, when you wrote of “module” or “modules” I thought that you were refering to module of the ship in both cases.

Does it mean that “module” is different from “modules”? So far, when you wrote of “module” or “modules” I thought that you were refering to module of the ship in both cases.
S’est une erreur de frappes,  je voulais dire que le nombre de cible était suppérieur au nombre de modules!
J’ai fais ça, même probleme. J’ai mis un point d’arrêt(dans l’image) et j’y suis retouré pleusieurs fois et cela m’a toujours donné la même erreur : http://snag.gy/fwxBl.jpg
int selectionTarget; // Position de la cible choisie dans l'owerview int TargetRoidCount =>Sanderling?.MemoryMeasurementParsed?.Value?.Target?.Count(target => target?.TextRow?.Any(textRow => textRow?.RegexMatchSuccessIgnoreCase(@"Asteroids*(") ?? false) ?? false) ?? 0;; Sanderling.Parse.IShipUiTarget Target = null; bool NotHaveModule = true;   Func<object> InBeltMineStep() {     if (DefenseEnter)     {         Host.Log("enter defense.");         return DefenseStep;     }              var    AsteroidOverviewEntry = ListAsteroidOverviewEntry?.FirstOrDefault();          if(null == AsteroidOverviewEntry)     {         Host.Log("no asteroid available");         return null;     }          if(OreHoldFilledForOffload)         return null;              if(!(0 < SetModuleMinerInactive?.Length))         return InBeltMineStep;          EnsureWindowInventoryOpenOreHold();      EnsureOverviewTypeSelectionLoaded();      while(DronesInSpaceCount <=  0)     {         DroneLaunch();         Host.Delay(1111);     }          var    SetTargetAsteroidInRange = SetTargetAsteroid?.Where(target => target?.DistanceMax <= MiningRange)?.ToArray();              if(!(AsteroidOverviewEntry.DistanceMax < MiningRange))         {             Host.Log("out of range, approaching");                 ClickMenuEntryOnMenuRoot(AsteroidOverviewEntry, "approach");         }     /*         N'a aucune raison d'entrer dans cette condition lorsque toutes les cibles sont ciblées          alors que par exemple pour le Retriver(2 modules d'extraction) il y retourne alors         qu'il a deja ciblé 3 cible(dont une de trop)     */     Sanderling.InvalidateMeasurement();     Host.Delay(1111);     if(TargetRoidCount < SetModuleMiner?.Count()) // Si il y a moin de cible que le nombre de modules de minage     {         for(int i = TargetRoidCount; i<SetModuleMiner?.Count(); ++i){    // Selectionne des cibles         selectionTarget = genNbr.Next(0,2);         while(TargetedByMe(ListAsteroidOverviewEntry[selectionTarget])) // Tant que dans l'overview a la position de selectionTarget est deja veroullé choisie une autre cible...             {                 selectionTarget = genNbr.Next(0,2); // Méthode un peu "fafa" pour choisir une cible...                 Sanderling.InvalidateMeasurement();                 Host.Delay(1111);                 Host.Log("Nombre de target et de : " + TargetRoidCount);             }             if(!(TargetedByMe(ListAsteroidOverviewEntry[selectionTarget])) && (TargetRoidCount < SetModuleMiner?.Count())) // Si elle n'est pas cibler et si il y a moin de cible que de modules d'extraction             {                 ClickMenuEntryOnMenuRoot(ListAsteroidOverviewEntry[selectionTarget], "^lock");    // Verouille...                 Host.Log("locking");                 Host.Delay(3333);                 Sanderling.InvalidateMeasurement();                 Host.Delay(1111);                 Host.Log("Nombre de target et de : " + TargetRoidCount);                 /*                     Souvent le nombre ne change pas!?!...                 */             }         }     }      Host.Log("Nombre de target et de : " + TargetRoidCount);          if(0 < SetTargetAsteroidInRange?.Length)     {         var TargetAsteroidInputFocus    =             SetTargetAsteroidInRange?.FirstOrDefault(target => target?.IsSelected ?? false);          if(null == TargetAsteroidInputFocus)//             Sanderling.MouseClickLeft(SetTargetAsteroid?.FirstOrDefault());          foreach (var Module in SetModuleMinerInactive)         {             NotHaveModule = true;             Sanderling.InvalidateMeasurement();             Host.Delay(1111);             for(int t = 0; (t < TargetRoidCount) && NotHaveModule; ++t){ // Vérifie pour chaque module si elle a un module d'assigné                 Target = SetTargetAsteroid?.ElementAtOrDefault(t);// Target l'asteroid                 if((Target?.Assigned?.Count() == 0))// Si elle n'a pas un module change la valeur de NotHaveModule pour arreter la boucle                     NotHaveModule = false;             }             Sanderling.InvalidateMeasurement();             Host.Delay(1111);             if(Target?.Assigned?.Count() == 0){    // Re vérifie si ele a un module                 Sanderling.MouseClickLeft(Target);    //Click dessu                 Host.Log(Target.DistanceMax + ": Target.DistanceMax" + MiningRange + " : MiningRange");                 ModuleToggle(Module);    // Active un module sur la cible                 return InBeltMineStep;             }         }         return InBeltMineStep;     }          Host.Log("next asteroid: " + AsteroidOverviewEntry?.Name + " , Distance: " + AsteroidOverviewEntry?.DistanceMax);      return InBeltMineStep; }

Désoler pour la grosseur de l’écriture et la couleur, mais je n’arrive pas à le modiffier…

J’ai fais ça, même probleme. J’ai mis un point d’arrêt(dans l’image) et j’y suis retouré pleusieurs fois et cela m’a toujours donné la même erreur :http://snag.gy/fwxBl.jpg

Ok, looking at that screenshot it is pretty obvious.

The approach to identify an Asteroid I suggested you to try was simply not suited for the labeling as found in game. That function is actually looking for the text “Asteroid (” to appear in any row, but that is not the case for all the targets in your screenshot.

I don’t understand why you are writing so much script code to test this function. Would it not be sufficient to use this statement?:

Host.Log("TargetRoidCount: " + TargetRoidCount);

The next thing I suggest you try is a modified version which first concatenates the rows into one string before using the regex pattern like this:

int TargetRoidCount =>     Sanderling?.MemoryMeasurementParsed?.Value     ?.Target?.Count(target => string.Join(" ", (target?.TextRow).EmptyIfNull())?.RegexMatchSuccessIgnoreCase(@"Asteroids*(") ?? false) ?? 0;

Désoler pour la grosseur de l’écriture et la couleur, mais je n’arrive pas à le modiffier…

The coloring in the C# code is good, that makes it easier to read. Can you tell me how you did that?

And for the general modifying, I will take a look at additional formatting options for the editor.

The coloring in the C# code is good, that makes it easier to read. Can you tell me how you did that?

J’ai fais un ctrl-c, ctrl-v de sanderling vers cette fenetre pour écrire

Exemple :

Host.Log("Nbr tragets : "+ TargetRoidCount);

1 Like