Change Mining Crystals

I would really like my bot to be able to swap mining crystals depending on the locked asteroid type. Is there a setting or method to do this?

Welcome @Ricod306!

The method to do this is to find out how you can do the swapping manually using keyboard or mouse commands. When you know how to do it with a keyboard or mouse, you can let the bot send the same inputs to the game client.

For example, if you want the bot to press the F1 key, you can use this expression:

    ( "Press the F1 key"
    , [ EffectOnWindow.KeyDown EffectOnWindow.vkey_F1
        , EffectOnWindow.KeyUp EffectOnWindow.vkey_F1

How do I get the bot to read on screen text and in which elm file do I edit it?

To make it read the screen text you can use this one: FrontendWeb.Main

In the decision tree root the reading from the game client is reachable via context.readingFromGameClient:

To read the targets, use the targets field in the reading from the game client.

You can make all your changes in the BotEngineApp.elm file.

Thank Michael for all you helped so far but I am still stuck.

See I am not very familiar with ELM coding and only with C++. I have downloaded the BotEgningeApp.elm and started editing and found the line of code where the bot activates the modules. I have decided that this is where I want to scan the locked target and change the crystal accordingly before activating.

Here is some pseudocode what I would want to happen.

  1. Lock new target
  2. Check for active modules and deactivate first
  3. Scan target string
  4. Compare target string to tooltip string of mining module
  5. If same activate module
  6. else opencascademenu of mining module
  7. move mouse to same text containing targets string (here we select the crystal)
  8. then click the text that is the same as target
  9. then activate module for mining

Translating to Elm is the easy part. Before we can start translating to a language like C++ or Elm, we need to clarify some more fundamental questions.
What is the shape of the tree for your new part?
So far, I see a list with nine items. Which parts describe the effects that you want to send to the game client?

Here is a guess for pseudo-code for your new function:

if (we have not any locked target)
  Lock new target
  if (there is an active ship module)
     deactivate that ship module
     if (there is a ship module with a tooltip text matching the text from the active target)
        activate that module
        Use context menu cascade: On one of the mining modules. Select menu entry containing one of the display strings in the selected target.

(I used indentation to separate the tree nodes)

Does this work for your scenario?

(Using pseudo-code is only one way to describe the behavior. For cases where people do not already have programming experience, we would use a simpler approach more based on examples.)

Yes this is exactly what I have in mind and after it has used cascade menu to change the crystal it activates the module. If this is a mandatory setting in the mining bot I am sure the demand for it will go up as currently a T2 Venture is only 0.3m^3/s slower than a T2 Procurer if the crystals cannot be changed.

Here you can see your pseudo-code translated to Elm: Translate function from Enrico Du Bruyn to Elm · Viir/bots@f6e5c70 · GitHub

Sorry for my late reply but studies have been keeping me busy! I’ll have a look soon and then I’ll let you know how it goes but thank you so much, you do actually deliver a great service!!

No worries, we have time :+1: