Hi friends, I am trying since yesterday making some code work that is dependent on a custom signal.I am having some problems making it work, maybe it is the way my setup works.
This is the signal:
add_user_signal("go_to_next_text",[{"name": "current_chapter", "type": TYPE_STRING},{"name": "current_dialog", "type": TYPE_STRING}, {"name": "current_text_finalized", "type": TYPE_INT},{"name": "total_texts", "type": TYPE_INT}])
Then, on the needed part, I connect it, together with the needed arguments that are:
connect("go_to_next_text", self,"go_to_next_text", [chapter, dialog, start_at, dialog_array.size()])
The mentioned function go_to_next_text
:
func go_to_next_text(chapter, dialog, start_at, total_text):
print("FUNC STARTED!", chapter, dialog, start_at, total_text) # testing purpose
var accept = Input.is_action_pressed("ui_accept")
while not accept:
if accept:
emit_signal("go_to_next_text",chapter, dialog, start_at, total_text)
but it looks like the function is never called as I don't get even the print "FUNC STARTED"
I have already read the documentation about signals and even the reddit posts relevant to the theme... but I wasn't able to figure it out what I am doing wrong
Also, I know this is another kind of doubt, I can create another question, but since I am on the theme, is it possible to simplify this process by making a yield(object, "go_to_next_text", array_with_arguments)
and pass the arguments directly on the yield somehow?