Hello!

I watched HeartBeast's awesome video on rpg dialogue boxes and it was great - but he left out how to make the dialogue scene end when the conversation is over!

Here's my code and my nodes- does anyone think it's possible to write a way for the box to go away?

extends RichTextLabel

var dialog = ["Heading out, eh?", "Remember to keep six feet apart from everyone."]
var page = 0

func _ready():
	set_bbcode(dialog[page])
	set_visible_characters(0)
	set_process_input(true)

func _input(event):
	if Input.is_mouse_button_pressed(1):
		if get_visible_characters() > get_total_character_count():
			if page < dialog.size()-1:
				page += 1
				set_bbcode(dialog[page])
				set_visible_characters(0)
			elif page == dialog.size():
				$Node2D.hide()
		else:
			set_visible_characters(get_total_character_count())

func _on_Timer_timeout():
	set_visible_characters(get_visible_characters()+1)

Doesn't this code do that already?

elif page == dialog.size():
$Node2D.hide()
else:
set_visible_characters(get_total_character_count())

Is Node2D the node you want to hide?

Also, you can specify code on the forums if you indent before each line of code. You also might need to have a blank line before and after the code.

I've edited the OP. Just highlighted relevant part of the texted and from the formatting menu pressed code.

@Dschoonmaker That code SHOULD do something (I found it in the comments section of the youtube video), but when the scene runs, the dialog box still doesn't close on the last click/when all the dialog has been said...

I'd like the richtextlabel and texturerect to hide, but even if I put those into that line of code, they don't dissapear either...

Are you sure your if/elif/else checks are passing?

Might want to set up some print statements to print something in the godot output so you know what is actually going on. Also you can try setting pu some breakpoints to step through the code.

3 years later