Text box trying to get an Area's name (I'm creating a dialog system)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SereneMango

Basically Interactable (the emitter code) is for more than one area (the current scene I’m working with has 3). What I want is, when the KinematicBody (the player) is in a certain Area, that one Area will send its name to the Text Box.

I’m having an issue with signals. I get this error when the KinematicBody enters one Area (and also when the scene is loaded, curiously):

E 0:00:05.732 emit_signal: Error calling method from signal 'body_entered': 'Control(Textbox.gd)::get_dialog': Method expected 1 arguments, but called with 2..
<C++ Source> core/object.cpp:1228 @ emit_signal()

Here are the codes for the emitter and the receiver, respectively:


func _ready():
  var textbox = get_node("../textbox")
  self.connect("body_entered", textbox, "get_dialog", [self])


func get_dialog(area):
  var speaking = "res://Test/Text/_%D.json" % area
  var file = File.new()
  file.open(speaking, file.READ)
  dialog = parse_json(file.get_as_text())
:bust_in_silhouette: Reply From: SereneMango

Nevermind, I got help from a couple of Discord servers:

A signal may send at least one implicit argument. This case, body_entered, has one: “body”. So I’d have to include it on get_dialog first (func get_dialog(_body, area):slight_smile:

PS: I noticed a typo on Textbox’s 2nd line. Should be %s instead of _%