I am a bit new to ELM/botting in general, and I was just wondering, would it be possible to set up a second mining bot, that mines via jetcan mining?
I have been mining alot of Talassonite recently in the Triglavian Conduits, and was wondering if it could be possible to set it up to mine untill the ore hold is full, then select all and jettison the ore?
I could then scoop all the ore on an alt character that is providing bonuses with a Mobile Tractor Unit.
Sure, why not.
To set this up, no need to think about Elm or botting so far. What is needed is find out how a human can achieve this. When we know this, the botting part is simple.
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?
Logic wise, it will follow the same rules as the current mining bot, the only difference would be once the ore hold reaches capacity instead of returning to station, it would take the following steps;
Right click on the ore and choose select all
Right click again and choose the option to Jettison
Continue to mine
Below is a screengrab of where the select all and jettison options are in the menu.
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.
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)
)
]
}
)
)