Consume an item instance from the user's inventory
useItemInstance(item_instance_id, callback)



This function should ONLY be used if your game does not have a server for consuming item instances. If your game has a server component, please use the server-side version.

Consuming user item instances

You can consume a limited-use item instance by using the useItemInstance method. This function takes the item instance ID (retrieved using the requestUserItemList function) and a callback function to be called when the operation is completed.

item_instance_idIntegerThe item instance ID to be consumed
callbackFunctionA callback function to be called with the results of the operation

The callback function is passed a single object with the following fields:

successBooleanA flag indicating whether or not the operation was successful
idIntegerThe ID of the item instance that was consumed

Example: Consume an item from the player's inventory

kongregate.mtx.useItemInstance(12345, onUseResult);

function onUseResult(result) {
  console.log("Item use result successful: " + result.success);