Working with squadronsUI and things

First. I have to thank to @Viir for helping me alot. With newest parseSquadronsUI. I have some funtion request / need to correct it:
Before enterAnomaly, using Dscan on a matching site,
if there are “No Scan Results” in Dscan results then
warp to that Anomaly site
Else ignore that Anomaly site

launchFighterTospace : ReadingFromGameClient -> Maybe DecisionPathNode
launchFighterTospace parsedUserInterface =
    parsedUserInterface.shipUI
        |> maybeNothingFromCanNotSeeIt
        |> Maybe.andThen
            (\shipUI  ->
                case  shipUI.squadronsUI of
                    Just squadronsUI ->
                        let
                            readyfighters =
                                squadronsUI.squadrons
                                    |> List.filter (.actionLabel >> EveOnline.ParseUserInterface.getAllContainedDisplayTexts >> List.any (String.toLower >> String.contains "ready"))
                        in
                        if 0 < (readyfighters |> List.length) then
                            Just
                                (describeBranch "I see there are fighters in bay. Launch it"
                                    (endDecisionPath
                                                (actWithoutFurtherReadings            
                                                    ( " by using SHIFT + D Key"
                                                    , [ VolatileHostInterface.KeyDown Common.EffectOnWindow.VK_SHIFT
                                                    ,   VolatileHostInterface.KeyDown Common.EffectOnWindow.VK_R
                                                      , VolatileHostInterface.KeyUp Common.EffectOnWindow.VK_R
                                                      , VolatileHostInterface.KeyUp Common.EffectOnWindow.VK_SHIFT
                                                      ]
                                                    )

                                            )
                                        )
                                )

                        else
                            Nothing
                    _ ->
                        Nothing  
            )

returnFighterToBay : ReadingFromGameClient -> Maybe DecisionPathNode
returnFighterToBay parsedUserInterface =
    parsedUserInterface.shipUI
        |> maybeNothingFromCanNotSeeIt
        |> Maybe.andThen
            (\shipUI  ->
                case  shipUI.squadronsUI of
                    Just squadronsUI ->
                        let
                            readyfighters =
                                squadronsUI.squadrons
                                    |> List.filter (.actionLabel >> EveOnline.ParseUserInterface.getAllContainedDisplayTexts >> List.any (String.toLower >> String.contains "ready"))
                        in
                        if 0 < (readyfighters |> List.length) then
                            Nothing

                        else
                            Just
                                (describeBranch "I see there are fighters in local space. Return those to bay."
                                    (endDecisionPath
                                                (actWithoutFurtherReadings            
                                                    ( " by using SHIFT + R Key"
                                                    , [ VolatileHostInterface.KeyDown Common.EffectOnWindow.VK_SHIFT
                                                    ,   VolatileHostInterface.KeyDown Common.EffectOnWindow.VK_R
                                                      , VolatileHostInterface.KeyUp Common.EffectOnWindow.VK_R
                                                      , VolatileHostInterface.KeyUp Common.EffectOnWindow.VK_SHIFT
                                                      ]
                                                    )

                                            )
                                        )
                                )
                    _ ->
                        Nothing  
            )

And fighter’s module to active on target

fightersModulesToActivateOnTarget : SeeUndockingComplete -> List SquadronAbilityIcon
fightersModulesToActivateOnTarget =
    .shipUI >> .squadrons >> .abilities

And then in combat funtion:

  • Replace return/launchAndEngageDrones with fighers.

  • Replace shipUIModulesToActivateOnTarget with fightersModulesToActivateOnTarget

  • Repalce ensureShipIsOrbiting with ensureShipIsAligning

    ensureShipIsAligning: ShipUI → ReadingFromGameClient → Maybe DecisionPathNode
    ensureShipIsAligning shipUI readingFromGameClient =
    if (shipUI.indication |> maybeVisibleAndThen .maneuverType) == CanSee EveOnline.ParseUserInterface.ManeuverAlign || (shipUI.indication |> maybeVisibleAndThen .maneuverType) == CanSee EveOnline.ParseUserInterface.ManeuverApproach then
    Nothing

    else
        useContextMenuCascadeOnListSurroundingsButton
            (useMenuEntryWithTextContainingFirstOf [ "locations" ]
                (useMenuEntryWithTextContainingFirstOf [ "Safe", "top" ]
                    (useMenuEntryWithTextContainingFirstOf [ "Top", "Safe" ]
                        (useMenuEntryWithTextContainingFirstOf [ "Align to", "Approach" ] MenuCascadeCompleted)
                    )
                )
            )
    

I got curious about your function.

I hope you don’t mind if I add my observations here.

I opened that function in the editor to have a look.
I did not find any description of your VK_R function:

So I replaced it with something that exists, to let the static analysis focus on other parts of the function.

Then, I get this error message:

image

TYPE MISMATCH - This function cannot handle the argument sent through the (|>) pipe:

812|     parsedUserInterface.shipUI
813|         |> maybeNothingFromCanNotSeeIt
814|#>#        |> Maybe.andThen
815|#>#            (\shipUI ->
816|#>#                case shipUI.squadronsUI of
817|#>#                    Just squadronsUI ->
818|#>#                        let
819|#>#                            readyfighters =
820|#>#                                squadronsUI.squadrons
821|#>#                                    |> List.filter (.actionLabel >> EveOnline.ParseUserInterface.getAllContainedDisplayTexts >> List.any (String.toLower >> String.contains "ready"))
822|#>#                        in
823|#>#                        if 0 < (readyfighters |> List.length) then
824|#>#                            Just
825|#>#                                (describeBranch "I see there are fighters in bay. Launch it"
826|#>#                                    (endDecisionPath
827|#>#                                        (actWithoutFurtherReadings
828|#>#                                            ( " by using SHIFT + D Key"
829|#>#                                            , [ VolatileHostInterface.KeyDown Common.EffectOnWindow.VK_SHIFT
830|#>#                                              , VolatileHostInterface.KeyDown (Common.EffectOnWindow.VirtualKeyCodeFromInt 123456789)
831|#>#                                              , VolatileHostInterface.KeyUp (Common.EffectOnWindow.VirtualKeyCodeFromInt 123456789)
832|#>#                                              , VolatileHostInterface.KeyUp Common.EffectOnWindow.VK_SHIFT
833|#>#                                              ]
834|#>#                                            )
835|#>#                                        )
836|#>#                                    )
837|#>#                                )
838|#>#
839|#>#                        else
840|#>#                            Nothing
841|#>#
842|#>#                    _ ->
843|#>#                        Nothing
844|             )

The argument is:

    Maybe #ShipUI#

But (|>) is piping it to a function that expects:

    Maybe
        { capacitor : EveOnline.ParseUserInterface.ShipUICapacitor
        , hitpointsPercent : EveOnline.ParseUserInterface.Hitpoints
        , indication :
              MaybeVisible EveOnline.ParseUserInterface.ShipUIIndication
        , moduleButtons : List ShipUIModuleButton
        , moduleButtonsRows :
              { bottom : List ShipUIModuleButton
              , middle : List ShipUIModuleButton
              , top : List ShipUIModuleButton
              }
        , offensiveBuffButtonNames : List String
        , squadronsUI :
              #Maybe
                  { b
                      | squadrons :
                            List
                                { a
                                    | actionLabel :
                                          EveOnline.MemoryReading.UITreeNode
                                }
                  }#
        , uiNode : EveOnline.ParseUserInterface.UITreeNodeWithDisplayRegion
        }

Seeing that, I wonder if we can make the example projects easier to work with by consolidating Maybe and MaybeVisible into one type?

@BrianCorner what do you think? Would it make your work easier if the examples used the same type in both cases?

I dont know bro. Im actually not a developer/coder at all, i tried alot last few days but i cant code :frowning: . My idea is just:

Replace launch and return drones funtions with launch and return fighters.
ảnh
And replace shipUIModulesToActivateOnTarget with bottom row module of fighters. ( each module on one target ) and may be if you can make Top Row Modules active on same target as bottom module until ammo number reduce to 0 will be great
ảnh

Hello I would like to know if you succeeded
has programmed the bot carrière?
If so, are you willing to share it?