Gimly
(Gimly)
November 9, 2020, 12:46am
1
Hi there, I’m transforming part of a program to move ore from the fleet hangar to the Ore hangar, the fleet hangar is constantly selected instead of the Ore hold but I’m running into difficulties locating the Ore hold
oreHoldFromInventoryWindow : EveOnline.ParseUserInterface.InventoryWindow → Maybe UIElement
oreHoldFromInventoryWindow =
.leftTreeEntries
List.filter (.text >> String.toLower >> String.contains “ore hold”)
List.head
Maybe.map .uiNode
Sadly enough reusing this didn’t seem to work. I think I need to dig further in the tree but I don’t know how. Could you please help.
Viir
(Michael Rätzel)
November 9, 2020, 7:18pm
2
One way is to look at the definition of the type you are using:
type alias InventoryWindow =
{ uiNode : UITreeNodeWithDisplayRegion
, leftTreeEntries : List InventoryWindowLeftTreeEntry
, subCaptionLabelText : Maybe String
, selectedContainerCapacityGauge : Maybe (Result String InventoryWindowCapacityGauge)
, selectedContainerInventory : Maybe Inventory
, buttonToSwitchToListView : Maybe UITreeNodeWithDisplayRegion
}
type alias InventoryWindowLeftTreeEntry =
{ uiNode : UITreeNodeWithDisplayRegion
, toggleBtn : Maybe UITreeNodeWithDisplayRegion
, text : String
, children : List InventoryWindowLeftTreeEntryChild
}
Here we see that for the InventoryWindowLeftTreeEntry
you have two ways of navigating to the children and descendants:
uiNode
: This one contains the whole subtree of this element.
children
: This one is specifically for the children that are entries in the inventory tree view.
Another way is using the expander buttons in the visual explorer in the alternate UI for EVE Online:
1 Like
Gimly
(Gimly)
November 10, 2020, 1:25am
3
perfect thank you, much appreciated!
kiwibros
(kiwibros)
December 21, 2020, 4:05pm
5
I’m struggling to find the same “ore hold”. What am I doing wrong here?
oreHoldFromInventoryWindow : EveOnline.ParseUserInterface.InventoryWindow → Maybe UIElement
oreHoldFromInventoryWindow =
.leftTreeEntries
>> List.filter( .children >> .text >> String.toLower >> String.contains “ore hold”)
>> List.head
>> Maybe.map .uiNode
Viir
(Michael Rätzel)
December 21, 2020, 8:57pm
6
Getting .text
from the value out of .children
does not work:
.children
gets you an instance of List
. But the .text
function needs a record as an argument, so it does not work with a List
value.
I have changed your code to make it compile:
oreHoldFromInventoryWindow : EveOnline.ParseUserInterface.InventoryWindow -> Maybe UIElement
oreHoldFromInventoryWindow =
.leftTreeEntries
>> List.concatMap (.children >> List.map EveOnline.ParseUserInterface.unwrapInventoryWindowLeftTreeEntryChild)
>> List.filter (.text >> String.toLower >> String.contains "ore hold")
>> List.head
>> Maybe.map .uiNode
The line with List.concatMap
produces a list that contains all children of the nodes on the root level. The function above assumes that the ore hold is on the second level of the tree.