Here is a set of basic drone management function that I want to share. Maybe you can poke around and tailor it to your needs or just learn from it.
This function will recall drones if a specific drone type is matched.
For example to return your mining drone it could be used like this:
returnDronesTypeToBay context.readingFromGameClient "mining"
Or for your hobgoblins
returnDronesTypeToBay context.readingFromGameClient "hobgoblin"
returnDronesTypeToBay : ReadingFromGameClient -> String -> Maybe DecisionPathNode
returnDronesTypeToBay readingFromGameClient droneTypeName =
readingFromGameClient.dronesWindow
|> Maybe.andThen
(\dronesWindow ->
case dronesWindow.droneGroupInLocalSpace of
Just droneGroupInLocalSpace ->
let
dronesInLocalSpaceQuantity =
droneGroupInLocalSpace.header.quantityFromTitle |> Maybe.withDefault 0
returningDrones =
droneGroupInLocalSpace.drones
|> List.filter (.uiNode >> .uiNode >> EveOnline.ParseUserInterface.getAllContainedDisplayTexts >> List.any (String.toLower >> String.contains "returning"))
droneType =
droneGroupInLocalSpace.drones
|> List.filter (.uiNode >> .uiNode >> EveOnline.ParseUserInterface.getAllContainedDisplayTexts >> List.any (String.toLower >> String.contains droneTypeName))
in
if dronesInLocalSpaceQuantity < 1 then
Nothing
else if (returningDrones |> List.length) > 0 then
Just
waitForProgressInGame
else if (droneType |> List.length) > 0 then
Just
(describeBranch ("I see there are " ++ droneTypeName ++ " drones in local space. Return those to bay.")
(useContextMenuCascade
( "drones group", droneGroupInLocalSpace.header.uiNode )
(useMenuEntryWithTextContaining "Return to drone bay" menuCascadeCompleted)
readingFromGameClient
)
)
else
Nothing
_ ->
Nothing
)
This function will deploy a group that contain a certain name. Be careful if many of them share the used string it will use the first group.
This will deploy a group with string “Mining” in it.
launchAndEngageGroupNameDrones context.readingFromGameClient "Mining"
This will deploy a group with string “Combat” in it.
launchAndEngageGroupNameDrones context.readingFromGameClient "Combat"
launchAndEngageGroupNameDrones : ReadingFromGameClient -> String -> Maybe DecisionPathNode
launchAndEngageGroupNameDrones readingFromGameClient groupName =
readingFromGameClient.dronesWindow
|> Maybe.andThen
(\dronesWindow ->
case ( dronesWindow.droneGroupInBay, dronesWindow.droneGroupInLocalSpace ) of
( Just droneGroupInBay, Just droneGroupInLocalSpace ) ->
let
idlingDrones =
droneGroupInLocalSpace.drones
|> List.filter (.uiNode >> .uiNode >> EveOnline.ParseUserInterface.getAllContainedDisplayTexts >> List.any (String.toLower >> String.contains "idle"))
dronesInBayQuantity =
droneGroupInBay.header.quantityFromTitle |> Maybe.withDefault 0
dronesInLocalSpaceQuantity =
droneGroupInLocalSpace.header.quantityFromTitle |> Maybe.withDefault 0
droneGroupExpectedDisplayText =
groupName
in
if 1 < (idlingDrones |> List.length) then
Just
(endDecisionPath
(actWithoutFurtherReadings
( "Engaging " ++ groupName ++ " drones."
, [ EffectOnWindow.KeyDown EffectOnWindow.vkey_F
, EffectOnWindow.KeyUp EffectOnWindow.vkey_F
]
)
)
)
else if 0 < dronesInBayQuantity && dronesInLocalSpaceQuantity < 1 then
Just
(describeBranch
("Launch "
++ groupName
++ " drones"
)
(case getDescendantWithDisplayTextContain droneGroupExpectedDisplayText dronesWindow.uiNode of
Nothing ->
describeBranch
("Did not find the node with display text '" ++ droneGroupExpectedDisplayText ++ "'")
askForHelpToGetUnstuck
Just droneGroupUiNode ->
useContextMenuCascade
( "drones group", droneGroupUiNode )
(useMenuEntryWithTextContaining "Launch drones" menuCascadeCompleted)
readingFromGameClient
)
)
else
Nothing
_ ->
Nothing
)
Here are some support functions to make them work.
getDescendantWithDisplayTextContain : String -> UIElement -> Maybe UIElement
getDescendantWithDisplayTextContain displayText parent =
parent
|> EveOnline.ParseUserInterface.listDescendantsWithDisplayRegion
|> List.filter (.uiNode >> EveOnline.ParseUserInterface.getDisplayText >> Maybe.map (String.contains displayText) >> Maybe.withDefault False)
|> List.head
getDescendantWithDisplayText : String -> UIElement -> Maybe UIElement
getDescendantWithDisplayText displayText parent =
parent
|> EveOnline.ParseUserInterface.listDescendantsWithDisplayRegion
|> List.filter (.uiNode >> EveOnline.ParseUserInterface.getDisplayText >> (==) (Just displayText))
|> List.head
The possibilities are limitless with botengine. The more advanced versions of these functions will recall any drones who take damage and relaunch, choose the perfect group of drones to launch for the target distance and type etc…
I have learned a lot so far on how to automate my gameplay the way I want it too.
Quick edit: I don’t think these are compatible with the latest version of botengine. Maybe someone can pitch in but I did not take the time to update my scripts yet.