How to connect Dialogic

Godot Version4

4.4.1

Question

This is my code for a script I want to connect to Dialogic so it can receive signals from it:

func _ready() → void:
await Dialogic.ready
if not Dialogic.signal_event.is_connected(_on_dialogic_signal):
Dialogic.signal_event.connect(_on_dialogic_signal)
self.global_position = Vector2(-1909,245)
print(“Dialogic listener connected”)

I’ve tried to connect Dialogic signals, but I never get the confirmation message. What might be missing?

Have you read the Dialogic Documentation? If not, I recommend you start there.

If you’ve done that and are stills stuck, I recommend checking out the Dialogic Readme, which lists both a Discord and a support forum for the plugin.

Getting support for plugins here is typically hit or mess - usually miss.

1 Like

In this case, your await probably waits for a signal that has already been emitted.

I’m not sure if you need this await at all, but if you do, then try changing it to this:

if not Dialogic.is_node_ready():
	await Dialogic.ready
1 Like

Update: I tracked the error to this section of event_signal.gd, a script that comes as part of Dialogic

Error calling from signal ‘signal_event’ to callable: ‘Sprite2D(strawby_walk.gd)::_on_dialogic_signal’: Method expected 2 arguments, but called with 1.

This is the section below

func _execute() -> void:
	if argument_type == ArgumentTypes.DICTIONARY:
		var result: Variant = JSON.parse_string(argument)
		if result != null:
			var dict := result as Dictionary
			dict.make_read_only()
			dialogic.emit_signal('signal_event', dict)
		else:
			push_error("[Dialogic] Encountered invalid dictionary in signal event.")
	else:
		dialogic.emit_signal('signal_event', argument)
	finish()

And this is where the error seems to be, according to the error message.

dialogic.emit_signal('signal_event', argument)

Any idea what’s going on?

Yeah.

strawby_walk.gd which looks like it’s attached to a Sprite2D is calling dialogic.emit_signal() with only one argument, and it requires two. You cannot have default/optional arguments with signals. You’re only using one. If you have nothing to pass, just pass null - or in this case, and empty Dictionary {}.

How would I implement that?

That would be a question for the people who made the plugin. I don’t know. Try the contact info I posted above.

1 Like