0 votes

Currently I'm taking an input from the LineEdit node and using an 'if' statement for the response, but after the first 'if' statement the new input isn't being registered? I was wondering if getting multiple inputs from the same LineEdit is possible.

Here is the code:

func _on_input_text_entered(new_text: String):      
if new_text == "forage":
    text = "You decide to forage for supplies."
    yield(get_tree().create_timer(2.0), "timeout")
    var value = test.randi_range(1,1)
    if value == 1:
        text = berry_text
        # NEW INPUT HERE
        if new_text == "yes":
            text = berry_accept
        if new_text == "no":
            text = berry_decline

Right now nothing happens when I try to input 'yes' or 'no' into the LineEdit after the text. I'm on version 3.3.2 if that helps.

Godot version 3.3.2
in Engine by (12 points)

1 Answer

+1 vote

Yes LineEdit can take multiple inputs.
If you reread the code then you will find that all the code will work only if the new_text is forage. If the new_text is yes or no then that code will not even be executed.

by (940 points)

Oh ok, I think I understand. Thanks for the help!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.