Return value (boolean): true if an item picker is currently active.
Spawns an item picker menu allowing the hero to choose an item s/he owns to give to that NPC.
The NPC can then handle that chosen item however it wants.
Example usage for a simple case:
functionbartender:on_interaction()bartender:prompt_item(function(item)ifitemanditem:get_name()=="whiskey"then-- TODO: success!elseifitemthen-- A different item was givenelse-- item == nil, the user cancelled the actionendend)end
callback (function): Called when the item picker ends. It's in the form fn(item) where item is the item the player chose, or nil if the action was cancelled.
filter (function, optional): All game items are looped through and passed to this function. The function is like fn(item) and returns true if the given item should be in the menu.
Only key items are shown by default.
Items must also be owned by the hero (eg item:get_variant() > 0).
If you really need to display all game items owned by the hero (most likely not what you want), you can pass function() return true end into the filter parameter.
Returns whether this item is considered a key item.
A key item is typically a unique, single-use item that advances the hero's quest in some way.
A key item cannot be equipped from the game's inventory screen even if item:is_assignable() == true.
Return value (boolean): true if this item is a key item.
Sets whether this item is considered a key item.
key_item (boolean, optional): true if this item is a key item (no value means true).
Event called whenever the command an item is assigned to is pressed.
command (string): Name of the item command that was pressed. Either item_1 or item_2.
Event called whenever the command an item is assigned to is released.
command (string): Name of the item command that was released. Either item_1 or item_2.