signal output_finished
# Called when the node enters the scene tree for the first time.
func _ready():
textbox_name.clear()
textbox_dialogue.clear()
textbox_name.add_text(event_queue[event_queue.size() - 1]["name"])
var text = event_queue[event_queue.size() - 1]["text"]
show_text(text)
yield(self, "output_finished")
event_queue.pop_back()
func show_text(text: String, rate: float = 0.1):
textbox_dialogue.visible_characters = 0
textbox_dialogue.text = text
while textbox_dialogue.visible_characters < len(text):
textbox_dialogue.visible_characters += 1
yield(get_tree().create_timer(rate), "timeout")
emit_signal("output_finished")
I put your code in the _ready() method just because I don’t know where else you have it, but you can put it wherever obviously
Yes it works! you just need to swap the yield line with the event queue line.
I am triggering my next line using the space key. I want the first pressing of my space key to write all the text instead of typewriting it, and the second pressing of the space key to write the next line. i tried working with some variables, in the while and input function, but i could’t make it happen. Do you have any ideas?