Hello !
I'm facing a strange anomaly while making some item interaction stuffs.
I do have worked all items and they work perfectly, now, i'm making some kind of interaction with NPC's (trading)
Problem is
function trade_npc:on_interaction_item(item)
print("Interacting, no item has been choosen yet")
if item == "green_chuchu_counter" then
print("Green Chuchu (Counter) is being shown to this NPC")
end
end
on_interaction_item is called, problem is, I'm using the item green_chuchu_counter item, but
print("Green Chuchu (Counter) is being shown to this NPC")
is not called, I tested without the "" on the condition, doesn't work eigher.
Trying to get the item through print(item) prints a userdata, so it doesn't help a lot
Any help would be welcome
The item parameter is of type item, not string.
PS: when you are facing a userdata, use sol.main.get_type() to know the more precise Solarus type.
Hmmm, there are nothing wrong, the type is 'item'. I tried without the "" but nothing happen, the condition is never triggered.
doing item_used:get_name() displays the correct item name though
Edit : I might have doe something wrong, brb
Okay I figured out where the problem was, thanks