0 votes

Any time i enter something into this LineEdit the output label calls the ("help") if statement even if it does not equal ("help"). It was working properly earlier and i did not change a lot besides adding a color variable for changing the color if it's invalid/valid.

func _on_devConsole_text_entered(new_text): #ConsoleEntered
enteredCommand = $devConsole.text
consoleOutput.text = ("Invalid Command: " + enteredCommand + ", type 'help 1' for a list of commands!")
consoleOutput.visible = true
consoleOutput.add_color_override("font_color", invalidColor)

if enteredCommand == ("help") or ("help1"): #Help
    consoleOutput.text = (enteredCommand + ": " + helpCmdOutput1)
    consoleOutput.visible = true
    consoleOutput.add_color_override("font_color", validColor)
in Engine by (12 points)

1 Answer

0 votes

you shouldn't write :

if enteredCommand == ("help") or ("help1"): #Help

instead you should write this

if enteredCommand == ("help") or enteredCommand == ("help1"):

because or keyword doesn't work in programming like it does in english sadly :D

by (298 points)
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.