OverviewWindowEntryCommonIndications and jammingMe bool flag

Not sure how to access this flag to prioritize ship jamming me first in my targeting function.

overviewWindowEntriesRepresentingJammingMe : ReadingFromGameClient -> List OverviewWindowEntry
overviewWindowEntriesRepresentingJammingMe =
    .overviewWindow
        >> Maybe.map (.commonIndications >> .isJammingme >> List.filter identity
        >> Maybe.withDefault []

I have less issues navigating the parsedui but it’s far from being acquired.

Why is there a List.filter?

I’m not sure. The code I posted does not work.

I’d like to access .commonIndications.isJammingMe and filter out the false bool. Only keep the True bool in the list.

Ok, this part sounds like you have a list. So we work with a list.
The filtering function will depend on which type you use for your list.

That looks like you use a type that matches this constraint:

{ a | commonIndications : { b | isJammingMe : Bool }}

Then you can filter it like this:

filterTheList : List { a | commonIndications : { b | isJammingMe : Bool }} -> List { a | commonIndications : { b | isJammingMe : Bool }}
filterTheList = List.filter (\element -> element.commonIndications.isJammingMe)

You can simplify the syntax by using a concrete type:

filterTheList : List { commonIndications : { isJammingMe : Bool }} -> List { commonIndications : { isJammingMe : Bool }}
filterTheList = List.filter (\element -> element.commonIndications.isJammingMe)

I got it in this way. I think. I deleted my simulation with rats jamming me so I’ll have to try and test in live.

Nope didn’t work. I’ll figure it out

Got it to work! Now it targets whoever is jamming me first

I think it would be nice to add an example to reduce the effort to experiment with this.
For example like this:

let
  filterTheList = List.filter (\element -> element.commonIndications.isJammingMe)
in
filterTheList [ { name = "roid", commonIndications = { isJammingMe = False }}, { name = "rat", commonIndications = { isJammingMe = True }}]

I tried to insert this in the interactive playground, but I see that record access is not yet implemented in Elm Interactive. The classic REPL could be the next best option.
But changing the test data in the list is more cumbersome in the CLI REPL.

I expanded the Elm Interactive to support record access syntax here: Implement record access expression for Elm records · elm-fullstack/elm-fullstack@946657b · GitHub

You can now use the example expression shown above in the Elm Interactive UI at https://botengine.blob.core.windows.net/blob-library/by-name/ElmExplorer.html

To learn how record access works in general, here are some simpler expressions to play around with:

This is about as basic as it gets, just wrapping the record access into a named function (declaration):

let
  getFieldValue = (\record -> record.field)
in
getFieldValue { field = "testing" }

And here is a simpler example of using record access in a List filter:

let
  filterTheList = List.filter (\item -> item.flag)
in
filterTheList [ { flag = True }, { flag = False } ]

You can take any of these and copy them into the Elm Interactive window to experiment with changes.