Why is this command not working?

i wanted to add a console interface similar to the source engine into my game so i can do some nifty stuff but it just tells me this:

and that basically means that it failed to compare the input value with 0 or 1 (boolean)

func _on_line_edit_text_submitted(new_text: String) -> void:
	var command:String
	var value:String
	var totale = new_text.split(" ", false, 1)
	command = totale[0]
	if len(totale) > 1:
		value = totale[1]
	$Console/LineEdit.text = ""
	if command not in cloptions.keys():
		$Console/Label.text = $Console/Label.text + "\n" + "] " + new_text
		$Console/Label.text = $Console/Label.text + "\nunrecognized cvar!"
	else:
		$Console/Label.text = $Console/Label.text + "\n" + "] " + new_text
		if command == "cl_viewbob_amp":
			vb_amp = int(value)
			cloptions["cl_viewbob_amp"] = int(value)
			$Console/Label.text = $Console/Label.text + "\ncvar " + "'" + command + "' has been set to: " + str(value)
		else:
			if int(value) != 0 or 1:
				cloptions[command] = cloptionsdefault[command]
				$Console/Label.text = $Console/Label.text + "\nfailed to allocate cvar into client options!"
			else:
				cloptions[command] = int(value)
				$Console/Label.text = $Console/Label.text + "\ncvar " + "'" + command + "' has been set to: " + str(value)

feel free to call me an idiot and recommend improvements! thanks

I assume you wanted to test:

if int(value) != 0 or int(value) != 1:

instead of checking if 1 is true

2 Likes

this doesn’t compare int(value) to 1, it checks the truethiness of 1 itself, you must always express what is being compared

if int(value) != 0 or int(value) != 1:
2 Likes

if int(value) < 0 or int(value) > 1:

might be the fix