Eve Jetcan Mining

I am looking at the screengrab:

What I see there looks like we should find it in the contextMenus field. I see entries containing the texts Select All and Jettison. Based on the looks in the screenshot, I expect these to end up in the entries of the ContextMenu.

Working with context menus is very common; many bots do this. Since this is such a well-beaten path, we can skip the step of using a full memory sample of the game client. The screengrab seems sufficient for the identification of the elements we want to interact with.

Before we can think about making a bot, we need to find out what this part means:

The bots use mouse and keyboard input to control the game. So the question is, (how) can a human do that using mouse and keyboard?

The usual approach is to observe a human playing the game. Using the screenshot you linked, I can guess what you would see:

  • Right-click on the ore.
  • In the context menu, click on the label Select All.
  • Right-click again on the ore.
  • In the context menu, click on the label Jettison.

Now that we have an idea of how a human would approach this, the last step is programming to implement it.

Here is the part of the code we want to replace: bots/implement/applications/eve-online/eve-online-mining-bot/src/Bot.elm at 6923ed2ed2bed33bf07b2ea5481368f1b63df424 · Viir/bots · GitHub

To open the context menu, we can reuse the code that unloads the ore in the station. This code finds an item in the ore hold and then starts a drag&drop there to drag it to the item hangar. This means that implementation already gets us the UI element that we want to open the context menu on; we need to replace the drag&drop there with a right-click. For choosing the menu entry, we can copy from one of the many places where the bot uses a context menu.

I uploaded the complete code changes here:

The main part is the inventorySelectAllAndJettison function, based on the decideNextActionWhenDocked function from the old version. It encodes the four actions identified above, including the more specific identification of the UI elements:

inventorySelectAllAndJettison : ParsedUserInterface -> DecisionPathNode
inventorySelectAllAndJettison parsedUserInterface =
    case parsedUserInterface |> inventoryWindowSelectedContainerFirstItem of
        Nothing ->
            DescribeBranch "I see no item in the ore hold." (EndDecisionPath Wait)

        Just itemInInventory ->
            DescribeBranch "I see at least one item in the ore hold. Use this to select all and jettison."
                (EndDecisionPath
                    (Act
                        { firstAction = itemInInventory |> clickOnUIElement MouseButtonRight
                        , followingSteps =
                            [ ( "Click menu entry 'select all'."
                              , lastContextMenuOrSubmenu
                                    >> Maybe.andThen (menuEntryContainingTextIgnoringCase "select all")
                                    >> Maybe.map (.uiNode >> clickOnUIElement MouseButtonLeft)
                              )
                            , ( "Open context menu on item in inventory."
                              , inventoryWindowSelectedContainerFirstItem >> Maybe.map (clickOnUIElement MouseButtonRight)
                              )
                            , ( "Click menu entry 'jettison'."
                              , lastContextMenuOrSubmenu
                                    >> Maybe.andThen (menuEntryContainingTextIgnoringCase "jettison")
                                    >> Maybe.map (.uiNode >> clickOnUIElement MouseButtonLeft)
                              )
                            ]
                        }
                    )
                )