Best practice or template to interface with the inventory? #104
-
I'm looking for a basic example on how to interface with inventory. Like for example using a potion by clicking on it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! I should probably update the examples to demonstrate this, as it is a pretty common mechanic. Another way of doing this could be to get all the selected items with |
Beta Was this translation helpful? Give feedback.
Hi!
Connecting to the
inventory_item_acitivated
signal should do the trick. It's defined for theCtrlInventory
,CtrlInventoryGrid
andCtrlInventoryStacked
classes and gets emitted when an item is double-clicked in the inventory.I should probably update the examples to demonstrate this, as it is a pretty common mechanic.
Another way of doing this could be to get all the selected items with
get_selected_inventory_items()
and do something with them when clicking a button or pressing a key.