Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

end_of_dialogue_reached signal firing (potentially) incorrectly #27

Open
torbenvanassche opened this issue Oct 21, 2024 · 2 comments
Open

Comments

@torbenvanassche
Copy link

I looked at the code in the dialogue_reader and may have found a potential bug that I don't quite know how to work around. I have a simple setup with a single node for testing and the signal is firing after every next() call.
image

This result makes sense given the _process function saids

if _pending_choice_actions.is_empty():
	response.eod_reached = true
	end_of_dialogue_reached.emit()
break

I print the first line, call next() and the end_of_dialogue_reached is emitted.
I would expect it to only fire after the next line is printed (which also happens)

Am I using this plugin wrong? Could you point out how I can fix this code so I can properly use the signal?

class_name DialoguePrinter extends Printer

@export var dialogue: JSON;
var state: Dictionary = {};
var dialogue_handler: EzDialogue;

func _ready():
	dialogue_handler = EzDialogue.new();
	add_child(dialogue_handler)
	
	dialogue_handler.dialogue_generated.connect(_on_dialogue_generated)
	dialogue_handler.end_of_dialogue_reached.connect(clear)
	dialogue_handler.start_dialogue(dialogue, state);
	print_done.connect(_on_print_done.bind(0))
	
func _on_dialogue_generated(response: DialogueResponse):
	self.show_text(response.text)
	
func _on_print_done(index: int = 0):
	dialogue_handler.next(index)
@torbenvanassche torbenvanassche changed the title end_of_dialogue_reached signal firing incorrectly end_of_dialogue_reached signal firing (potentially) incorrectly Oct 21, 2024
@torbenvanassche
Copy link
Author

Adding that I can work around the issue by just calling next() and checking the string for empty.
Either I am missing something or this is a solution to the problem :)

@real-ezTheDev
Copy link
Owner

Haha thanks for filing this. It is actually very tricky issue I've been messing with. Personally, I've been using empty string AND choice as end signal, but also I've added a new flag called eod_reached in the response that you can use to read as final dialogue.. ill keep this open and continue documenting/fixing so that it's more intuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants