A bug(?) thats really pushing my buttons

Godot Version

4.6.1.stable

Question

hello, im currently working on the start of a dialogue system, the dialogue should have dialogue options for the player to reply with for which i just use normal button nodes in a VBoxcontainer that is hidden or visible depending on if its needed for the current dialogue line. and now heres where something funny happens:

when i run the game and interact with my test npc it only shows the text for the 1st dialogue branch (not the first dialogue line) and the debug-output shows that when i went to interact with my npc (not via mouseclick) it immediatly also(?) pressed the 1st dialogue option button twice, which iirc should only be pressed by a mouseclick(?).

i fell like i might just be using the wrong way to access the buttonpress in code? but idk how i should be doing it otherwise i guess? i looked at this blog post for the base of the code: https://gameidea.org/2026/02/03/making-dialogue-system-in-godot/ , but i changed a lot (also relating to the dialogue option buttons) so maybe i just did something wrong, but idk what

my button related code:

func _display_options(step):
	reply_1.text = step.option1.get("text", "")
	reply_2.text = step.option2.get("text", "")
	reply_3.text = step.option3.get("text", "")
	
	options_box.visible = true

	if reply_1.pressed:
		print("button1")
		var one = step.option1.get("jump_to", "")
		_jump_to_id(one)
		options_box.visible = false
		_clear_options()
	elif reply_2.pressed:
		print("button2")
		var two = step.option2.get("jump_to", "")
		_jump_to_id(two)
		options_box.visible = false
		_clear_options()
	elif reply_3.pressed:
		print("button3")
		var three = step.option3.get("jump_to", "")
		_jump_to_id(three)
		options_box.visible = false
		_clear_options()

thank you for anyone willing to look at this and trying to help!!! also if i missed any details or i need to add more info please tell me!

if signal: doesn’t await the signal, it just checks if the Variant is valid (= it isn’t null). This means reply_X.pressed will always be true. You should connect the signals to a function instead.

2 Likes

thank you!!! i connected the signals differently and it finally works!! :smiley:

also i finally understand the signal things a bit better now :slight_smile:

2 Likes