Help with API change/binding arguements

Godot Version:
Godot 4.2.1

So I don’t really understand how I’m supposed to bind this arguement
no matter the way I wrtite it doesn’t work
I’m trying to get every button in this group get its parent and get the index of the objects I have two out of many methods I tried listed in the ready function I looked at the documentation they changed the API
and I don’t get how to do this specific thing

func _ready():

for button in get_tree().get_nodes_in_group("InventorySlotButtons"):
	button.connect("pressed", _on_ItemButton_pressed.bind([button.get_parent().get_parent().get_name()]))
	#button.pressed.connect(Callable(self, "_on_ItemButton_pressed").bind([button.get_parent().get_parent().get_name]))

func _on_ItemButton_pressed(InventorySlot):
print(“Item Clicked”)
if ImportData.inven_data.has(InventorySlot):
print(“Shet Should Change”)
var icon = “res://Art/Icons/” + ImportData.inven_data[slot][0] + “.png”

You bind with on_ItemButton_pressed.bind(button.get_parent().get_parent().get_name())

Binding with the array argument makes it call as an array, it seems from your code that’s not what you want

Thank you
I did some printing and figured it out this took me way too long

1 Like