find_node returns weird name?
I don't think find_node works the way I expect, so I wonder if someone can point out where I am mistaken:
Here's the code:
for i in range(1,total_items): print("item = ",i) var match = 0 var slot_match = "slot%s" % [i] print("search = ",slot_match) if (find_node(slot_match)): print("found a match!") match = 1 if ! (match == 1): print("making a new child: slot",i) var slot = slot_class.new() get_node("inventory").add_child(slot) slot.set_name("slot%s" % slot.number) print("new slot name: ",slot.get_name())
Here's the output:
item = 1 search = slot1 making a new child: slot1 new slot name: slot1 slot_name = slot1 item = 1 search = slot1 making a new child: slot1 new slot name: @slot1@4 slot_name = @slot1@4
It looks to me that it creates the first node, but when I search for it, it
can't find it. But when I try to set the name to be "slot1", it creates it with a new name because slot1 is already taken.
Any help would be appreciated, thanks!