i have a code problem godot 4.21 gd script

Version

Godot 4.2.1

Error Code

E 0:00:21:0066   player.gd:69 @ _unhandled_key_input(): Error calling from signal 'BUL_create_bulletin' to callable: 'Node(bulletin_controller.gd)::create_bulletin': Method expected 2 arguments, but called with 1.
  <C++ Source>   core/object/object.cpp:1140 @ emit_signalp()
  <Stack Trace>  player.gd:69 @ _unhandled_key_input()

Question

help this code is for ui open and close and is not working, here the code:

if event.is_action_pressed("open_crafting_menu"):
		EventSystem.BUL_create_bulletin.emit(BulletinConfig.Keys.CraftingMenu)

thx

Hi,

The error is saying that the BUL_create_bulletin signal has two parameters, but you’re emitting it with only one (BulletinConfig.Keys.CraftingMenu). You should then add the missing parameters.

For instance, if a signal is defined as follows:

signal some_signal(a: int, b: int)

You must call it with two fitting parameters, like this:

some_signal.emit(5, 13)
1 Like

thanks, sorry dont understand good english and in google translate is not so good.
i new in godot and i was not where i create this line in the gd script?
sorry

I suppose you should check the class EventSystem where you most likely define all signals. Find the one called BUL_create_bulletin and verify what parameters it expects. Then change the line where you use this signal:

EventSystem.BUL_create_bulletin.emit(BulletinConfig.Keys.CraftingMenu)

to something like

EventSystem.BUL_create_bulletin.emit(BulletinConfig.Keys.CraftingMenu, second_parameter)

1 Like

okay guys i have understand and its works!

bigbig THANKS for the best Support very helpfull!!!

1 Like