dialogic
dialogic copied to clipboard
Suggestion: Add a timeline_changed signal
I'm implementing a dictionary so that I know how often each timeline has been played.
I'm currently using signals from timeline_start and timeline_end in order to do this. It works well enough, except when I use the 'change timeline' command.
Change timeline doesn't signal timeline_start or timeline_end.
So, for instance, if I start timeline A, and partway through timeline A use a 'change timeline' to go to timeline B, here's what happens (not 100% on exact order, but should be close enough)
Dialog box for Timeline A opens SIGNAL: timeline_start("Timeline A") Text continues for timeline A "Change timeline" happens to start timeline B Text continues for timeline B Timeline B ends SIGNAL: timeline_end("Timeline A") Dialog box closes
This means that using signals, I can't tell whether or not timeline B was seen or not. It would be nice to have a timeline_changed(timeline_name) signal to specify that timeline B got loaded.
I agree that this would be useful. Not sure if a feature like this will make it into any 1.x release, tho. For 2.0 we might need to reasses how it works.
In 1.x I believe you could alternatively listen for the event_start
signal and parse the event data. This is a convoluted thing, and should be easier, but in the meantime, maybe it helps.
It could look something like this:
# wherever you add your dialog
var dialog = Dialogic.start('mytimeline')
dialog.connect('event_start', self, '_on_dialogicnode_event_start')
func _on_dialogicnode_event_start(event_data:Dictionary):
if event_data['event_id'] == "dialogic_020": # id unique to the change timeline event
print("Changed to timeline ", event_data["change_timeline"], ".")
Such a signal is now in 2.x.