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)
asked Dec 14, 2019 in Engine by c1m50c (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

answered Dec 14, 2019 by Xtremezero (288 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 How to use this Q&A? before posting your first questions.