unreal-engine5unreal-umgverse

Why does DefaultValue:float := 100.0 return an error?


I'm currently coding in Unreal Engine For Fortnite and I was wondering what the issue with my code is.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }

CustomHP := class(creative_device):

    @editable
    Button:button_device = button_device{}  

    OnBegin<override>()<suspends> : void =
        Button.InteractedWithEvent.Subscribe(HandleButtonInteraction)

    HandleButtonInteraction(Agent : agent) : void =
        if (InPlayer := player[Agent], PlayerUI := GetPlayerUI[InPlayer]):
            MyUI : slider_regular = slider_regular {DefaultValue:float := 100.0, DefaultMinValue:float := 0.0, DefaultMaxValue:float := 100.0, DefaultStepSize:float := 1.0}
            PlayerUI.AddWidget(MyUI)

The Error returned by compiling is:

C:/Users/BraveGamerTV/Documents/Fortnite Projects/MyProject/Plugins/MyProject/Content/CustomHP.verse(17,66, 17,71) : Script error 3577: Unexpected expression
C:/Users/BraveGamerTV/Documents/Fortnite Projects/MyProject/Plugins/MyProject/Content/CustomHP.verse(17,98, 17,103) : Script error 3577: Unexpected expression
C:/Users/BraveGamerTV/Documents/Fortnite Projects/MyProject/Plugins/MyProject/Content/CustomHP.verse(17,128, 17,133) : Script error 3577: Unexpected expression
C:/Users/BraveGamerTV/Documents/Fortnite Projects/MyProject/Plugins/MyProject/Content/CustomHP.verse(17,160, 17,165) : Script error 3577: Unexpected expression

Solution

  • I believe you can remove the ":float" of each value to this:

    {DefaultValue := 100.0, DefaultMinValue := 0.0, DefaultMaxValue := 100.0, DefaultStepSize := 1.0}.

    New to this this language so I am not sure, but recommend to try!

    What is the code suppose to do?