Major - Creative Play - Crashing every time I test my code.

I’m currently recreating Wordle just for the sake of proof-of-concept stuff. But every time I try and test it my Fortnite times out and loses connection and won’t execute my Verse code. I have a button I press that brings up a text box for me to write my guess in and when I click confirm after putting in a 5 letter word (which is a check to begin comparing the guess to the answer) the script just stops and I freeze and eventually get kicked to the lobby.

UEFN Log: (4.5 MB)

My code is below, this specific block is what it cannot get past.

var Canvas:?canvas = false
var Text:string = ""
var Answer:string = ""

var AllowConfirmation:logic = true
var RandomWord:int = 0

Button:button_device := button_device{}

    Print("Wordle Started")
    if (PlayerUI := GetPlayerUI[Player]):
        if (TmpCanvas := Canvas?):
            set Canvas = false
            NewCanvas := MakeCanvas()
            PlayerUI.AddWidget(NewCanvas, player_ui_slot{ InputMode := ui_input_mode.All })
            set Canvas = option{NewCanvas}

MakeCanvas():canvas =
    VisualText:button_loud=button_loud{ DefaultText := "WORDLE" }
    VisualText2:button_quiet=button_quiet{ DefaultText := "LOWERCASE ONLY" }
    EnterGuess:editable_text_box=editable_text_box{ DefaultText := "TYPE HERE"}

    ConfirmButton:button_regular=button_regular{ DefaultText := "CONFIRM" }

    NewCanvas := canvas:
        Slots := array:
                Anchors := anchors{ Maximum:= vector2{X:=1.0, Y:=1.0} }
                Offsets := margin{ Top:=100.0, Left:=100.0, Right:=100.0, Bottom := 100.0 }
                Widget := stack_box:
                    Orientation := orientation.Vertical
                    Slots := array:
                            Widget := VisualText
                            Widget := VisualText2
                            Widget := EnterGuess
                            Widget := ConfirmButton
    return NewCanvas

    if (UserInput := editable_text_base[Message.Source]):
        set Text = UserInput.GetText()
        # if (TmpPlayerUI := GetPlayerUI[Message.Player], TmpCanvas := Canvas?):
        #     TmpPlayerUI.RemoveWidget(TmpCanvas)
        #     set Canvas = false
        for (LetterNumber -> Letter : Text):

    if (ConfirmText := text_button_base[Message.Source]):
        if (Text.Length <> 5):
            ConfirmText.SetText("CONFIRM (ENTER A 5 LETTER WORD)")
        else if (Text.Length = 5):
            spawn {CheckAnswer()}
    # LETTER 1
    if (Text[0] <> Answer[0] or Answer[1] or Answer[2] or Answer[3] or Answer[4]):
        Print("1st Letter is Incorrect")
    else if (Text[0] = Answer[0]):
        Print("1st Letter is Correct")
        Print("1st Letter is Correct, but in the Wrong Place")
    # LETTER 2    
    if (Text[1] <> Answer[0] or Answer[1] or Answer[2] or Answer[3] or Answer[4]):
        Print("2nd Letter is Incorrect")
    else if (Text[1] = Answer[1]):
        Print("2nd Letter is Correct")
        Print("2nd Letter is Correct, but in the Wrong Place")

    # LETTER 3
    if (Text[2] <> Answer[0] or Answer[1] or Answer[2] or Answer[3] or Answer[4]):
        Print("3rd Letter is Incorrect")
    else if (Text[2] = Answer[2]):
        Print("3rd Letter is Correct")
        Print("3rd Letter is Correct, but in the Wrong Place")

    # LETTER 4
    if (Text[3] <> Answer[0] or Answer[1] or Answer[2] or Answer[3] or Answer[4]):
        Print("4th Letter is Incorrect")
    else if (Text[3] = Answer[3]):
        Print("4th Letter is Correct")
        Print("4th Letter is Correct, but in the Wrong Place")

    # LETTER 5
    if (Text[4] <> Answer[0] or Answer[1] or Answer[2] or Answer[3] or Answer[4]):
        Print("5th Letter is Incorrect")
    else if (Text[4] = Answer[4]):
        Print("5th Letter is Correct")
        Print("5th Letter is Correct, but in the Wrong Place")

    RandomNum:int = GetRandomInt(1, 262)
    set RandomWord = RandomNum

    if (RandomWord = 1):
        set Answer = "about"
    else if (RandomWord = 2):
        set Answer = "above" 
    else if (RandomWord = 3):
        set Answer = "abuse"
    else if (RandomWord = 4):
        set Answer = "admit"
    else if (RandomWord = 5):
        set Answer = "adopt"
    else if (RandomWord = 6):
        set Answer = "adult"
    else if (RandomWord = 7):
        set Answer = "after"
    else if (RandomWord = 8):
        set Answer = "agent"
    else if (RandomWord = 9):
        set Answer = "agree"
    else if (RandomWord = 10):
        set Answer = "allow"
    else if (RandomWord = 11):
        set Answer = "along"
    else if (RandomWord = 12):
        set Answer = "alter"
    else if (RandomWord = 13):
        set Answer = "among"
    else if (RandomWord = 14):
        set Answer = "anger"
    else if (RandomWord = 15):
        set Answer = "apple"
    else if (RandomWord = 16):
        set Answer = "apply"
    else if (RandomWord = 17):
        set Answer = "argue"
    else if (RandomWord = 18):
        set Answer = "arise"
    else if (RandomWord = 19):
        set Answer = "avoid"
    else if (RandomWord = 20):
        set Answer = "award"

Thank you for reporting this, I found the problem and it will be fixed in a future release.

This issue was not fixed in the most recent update unfortunately. 23.10

The fix didn’t make it into 23.10, but it should be fixed in 23.20. Sorry that I wasn’t clear about the fix version originally!

1 Like

Hey Andrew, in the meantime while I wait for the fix to come would you happen to have a workaround for how I can avoid this but still use UI. That would be awesome.

Unfortunately, I can’t think of a practical way to work around it. Indexing into a string was broken, and I’m not aware of any way to consume the input string you get from the UI widget that doesn’t index individual characters.

While this is an issue that’s definitely good to report. I stall out and crash every time I use UI. Whether or not I’m indexing into a string. And I don’t understand why. I have been unable to use UI, period. It has yet to work for me in any way I’ve tried. I continuously crash when I click on any of the widgets I made that subscribe to a function. I thought maybe it was because I spawn a function within the function it subscribes to. Or maybe because I sleep within that spawned function. Maybe it’s because I use colons and not {} to define the function scope. I’m not sure and nothing seems to fix my issue.

Realizing the thing that is fixed in the later update is the indexing and not the crash makes me a little frustrated because I really want to be able to use the UI, and I just haven’t been able to. I have several scripts of just UI code for different things I’m creating and just have to accept that I can’t test them right now or even know if they work until this gets fixed.

I can understand why you’re frustrated.

I couldn’t find anything obviously relevant in the server crash reports other than this string indexing crash that should be fixed now. I was also able to take the code you posted earlier in the thread and run it on a 23.20 build without seeing any crashes. It’s possible that we separately fixed a bug with the UI stuff, or that the string bug was the root cause despite the being triggered by something in the UI system rather than user code.

Yeah idk, on my Droopy Flops game I get the same crash. And there’s definitely no text in there so I’m not indexing any strings. But when I click the start game ui widget in the menu I made I stall out and crash the same way. But I’ll just see if either/both work next update and if there are the same issues I’ll just post another report with new logs and such.