Mining script fails to warp out on damage due to right click menu issues

Hi,

The issue I’m having is similar to the one here:

The solution outlined in that post, which was for the script to make use of the overview for this purpose does seem to work when hostiles are detected in local, however when shields are below 70% the script attempts to initiate docking via the right click menu.

As I am in nullsec/sov space the menus are sorted as follows:

Right Click → Structures → [“Citadel”, “Engineering Complex”, “Refinery”] → StationName → Dock

I’ve had a look at the source code, but I’ve never programmed Elm before and its a bit hard to figure out where to make the change to properly navigate these menus.

Could someone please advise or make the change? :slight_smile:

What do you want to change? What is the issue with the menu?

No worries, no need to understand Elm at this stage. When you begin investigating, you use the app’s status text to find the part of the decision tree that the app used in this step.
You can use the graphical user interface in devtools to go back in time and pick the step/event where you want to bots behavior to change:
user interface to inspect an app session and travel back in time

When you have selected the event in the timeline, you see the status text in the event details view on the right. If the app was sending inputs to the game client in response to the selected event, these inputs appear under the “Event Response” heading.

So the first step is to identify the app event(s) of interest and decide what input the bot should send in this case. When we know what output you want from the program, someone with experience in Elm can do the programming part.

Using the app’s status text, you can find the corresponding nodes in the bot program code’s decision tree.
Here is an example: When you used App f339178a0a, and in the status text, you see "All known mining modules are active."
Searching for this part of the status text in the program code then leads you to this line:

This correlation is an indication that this part of the program code was used to build the event response. If you are not 100% sure, you can simulate a run with a modified program code to test this hypothesis.

Thanks very much for the detail.

I will look into this, I’ve identified the region of code I wish to change, but I’m not 100% sure on how to do this. I’m trying to change things so that the bot is able to dock at Upwell structures.

See below for the example menu structure:

I’ve tried to figure out how to edit the below to get it to navigate this new menu structure, but I’ve not had success.

dockToStationOrStructureUsingSurroundingsButtonMenu { prioritizeStructures, describeChoice, chooseEntry } =
    useContextMenuCascadeOnListSurroundingsButton
        (useMenuEntryWithTextContainingFirstOf
            ([ "stations", "structures" ]
                |> (if prioritizeStructures then
                        List.reverse

                    else
                        identity
                   )
            )
            (useMenuEntryInLastContextMenuInCascade { describeChoice = describeChoice, chooseEntry = chooseEntry }
                (useMenuEntryWithTextContaining "dock" menuCascadeCompleted)
            )
        )

Are you able to advise?

The goal would be for it to select:

  1. Structures
  2. One of: Citadel, Engineering Complex, Refinery
  3. An item at random
  4. Dock

The first thing I notice here is that in your case, you don’t need all the customizability that is offered by the function you found in the program code. So the first step is to remove the entire first argument to simplify the function.

For the random stage, I copy the useRandomMenuEntry that is already used in other places.

Here is the final function for your path through the menus:

dockToStructureUsingSurroundingsButtonMenu : ReadingFromGameClient -> DecisionPathNode
dockToStructureUsingSurroundingsButtonMenu =
    useContextMenuCascadeOnListSurroundingsButton
        (useMenuEntryWithTextContaining "structures"
            (useMenuEntryWithTextContainingFirstOf [ "Citadel", "Engineering Complex", "Refinery" ]
                (useRandomMenuEntry
                    (useMenuEntryWithTextContaining "dock"
                        menuCascadeCompleted
                    )
                )
            )
        )