Skip to content

Inventory

Francisco Dias edited this page Sep 19, 2024 · 18 revisions

Inventory

The Inventory module contains functions, constants and structures that allow you to use the Steam Inventory Service.

Warning

The Steamworks SDK limits the number of items that can be read from one stack to 65535. This is a limitation of the SDK rather than of the extension: the data type used for the m_unQuantity member of SteamItemDetails_t is uint16, which can hold a maximum value of 65535.

Since the limitation is per stack, you can work around it by transferring any amount over 65535 to a new stack using the function steam_inventory_transfer_item_quantity and add the necessary logic to your game that keeps track of the excess amount on the second stack. For example, an amount of 100000 would be divided over two stacks as follows: the first stack holds 65535, the other the remaining 34465.

Pricing and Consumables

These functions are provided for handling pricing, purchases and consumables:

Inventory Management (Async Result)

These asynchronous functions will return an inventory result handle that can be used to get additional information (see section below):

Inventory Result Information

These functions can be called with the inventory result handle (from previous section) to get additional information:

Dynamic Properties

This set of functions can be used to author items dynamic properties:

Constants

These are the constants used by this API:

Structures

These are the structures used by this API:



Back To Top

steam_inventory_consume_item

This function consumes items from a user's inventory. If the quantity of the given item goes to zero, it is permanently removed.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around ConsumeItem.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_consume_item(item_id, quantity)
Argument Type Description
item_id Int64 The steam_inventory_item_id to consume.
quantity Real The number of items in that stack to consume.



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

steam_inventory_consume_item(player.apple, 1);

The code sample above will try to consume one item (apple, steam_inventory_item_id), and trigger an async event with the task result.




Back To Top

steam_inventory_get_item_price

After a successful call to steam_inventory_request_prices, you can call this method to get the pricing for a specific item definition.

Tip

A wrapper around GetItemPrice.


Syntax:

steam_inventory_get_item_price(item)
Argument Type Description
item Real The steam_inventory_item_def to get the price of.



Returns:

Int64


Example:

var _price = steam_inventory_get_item_price(item);

The code sample above will return you the price for the specified item definition. For a more detailed example on using the function check steam_inventory_request_prices.




Back To Top

steam_inventory_get_items_with_prices

After a successful call to steam_inventory_request_prices, you can call this method to get all the prices for applicable item definitions.

Tip

A wrapper around GetItemsWithPrices.


Syntax:

steam_inventory_get_items_with_prices(item_def, price, base_price)
Argument Type Description
item_def Real The steam_inventory_item_def representing the item type
price Int64 The price of the item definition
base_price Int64 The base price of the item definition ✴️ WINDOWS ONLY



Returns:

Array of Struct


Example:

var _array = steam_inventory_get_items_with_prices(inv_result);
if(array_length(_array) > 0)
{
    var _item_def = _array[0].item_def;
    var _price = _array[0].price;
    var base_price = _array[0].base_price;
    show_debug_message("Found at one item that costs: " + string(_price));
}

The code above will get items with prices and if the returning array size is greater than zero (meaning there is at least one item with a configured price) it prints to the console the item's price.




Back To Top

steam_inventory_request_eligible_promo_item_defs

This function requests the list of "eligible" promo items that can be manually granted to the given user.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_request_eligible_promo_item_defs(user_id)
Argument Type Description
user_id Int64 The user ID of the user to request the eligible promo items for.



Returns:

Boolean


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_request_eligible_promo_item_defs"
user_id Int64 The user's unique identifier
item_def_count Real The number of items
item_def_json String A JSON array of items identifiers (must be parsed using json_parse or json_decode)
is_cached_data Boolean Whether the data was retrieved from the cache and not from the server

Example:

steam_inventory_request_eligible_promo_item_defs(user_id);

For more information on this function call please refer to the official manual.




Back To Top

steam_inventory_request_prices

This function requests prices for all item definitions that can be purchased in the user's local currency.

Tip

A wrapper around RequestPrices.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_request_prices()



Returns:

Boolean


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_request_prices"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
currency String The string representing the user's local currency code.

Example:

steam_inventory_request_prices();

The code above will request for price information. The result for this task can be caught inside the Steam Async Event with the following code:

// Early exit if event type doesn't match
if (async_load[? "event_type"] != "inventory_request_prices") exit;

// Early exit if handle doesn't match
if (async_load[? "success"])
{
    show_debug_message("The currency being used is: " + async_load[? "currency"]);

    _var price = steam_inventory_get_item_price(global.swordId);
}

The code above matches the event type and if so shows the currency being used. It also gets the price for a specific item using the steam_inventory_get_item_price function.




Back To Top

steam_inventory_start_purchase

This function starts the purchase process for the user, given a "shopping cart" of item definitions that the user would like to buy. The user will be prompted in the Steam Overlay to complete the purchase in their local currency, funding their Steam Wallet if necessary, etc.

Tip

A wrapper around StartPurchase.


Syntax:

steam_inventory_start_purchase(array)
Argument Type Description
array Array of InventoryItemCreationData An array of structs representing items to be purchased (see InventoryItemCreationData)



Returns:

N/A


Example:

var _arrayCreate = [
              {item_def: item1, quantity: 3},
              {item_def: item2, quantity: 5},
       ];

steam_inventory_start_purchase();

The code above will initialize a purchase intent that will be finalized in the Steam Overlay.




Back To Top

steam_inventory_add_promo_item

This function takes an Item Definition and grants the user the promo item. Item Definitions are integer numbers ranging from 1 to 999999999. Values below the range are invalid and values above the range are reserved.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around AddPromoItem.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_add_promo_item(item_def)
Argument Type Description
item_def Int64 The steam_inventory_item_def to grant the player (number between 1 and 999999999)



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

steam_inventory_add_promo_item(item);

The above code will grant the user with a specific item. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.




Back To Top

steam_inventory_add_promo_items

This function takes an array of Item Definitions and grants the user multiple items. Item Definitions are integer numbers ranging from 1 to 999999999. Values below the range are invalid and values above the range are reserved.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around AddPromoItems.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_add_promo_items(item_defs)
Argument Type Description
item_defs Array An array of steam_inventory_item_def to grant the user with.



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

steam_inventory_add_promo_items([item1, item2, item3]);

The above code will grant the user with an multiple items specified in an array format. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.




Back To Top

steam_inventory_exchange_items

This function grants one item in exchange for a set of other items.

The API currently takes an array of items to generate but at this time the size of that array must be 1 and the quantity of the new item must be 1.

Note

Any items that can be granted MUST have an exchange attribute in their itemdef.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around ExchangeItems.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_exchange_items(create_arr, destroy_arr)
Argument Type Description
create_arr Array of InventoryItemCreationData An array of structs representing items to be created (must be of size 1 and the item quantity must also be 1)
destroy_arr Array of InventoryItemConsumptionData An array of structs representing items to be consumed



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

var _arrayDestroy = [
    { item_id: player.cursed_sword, quantity: 1 },
    { item_id: player.apple, quantity: 7 },
];

var _arrayCreate = [
    { item_def: global.holy_sword, quantity: 1 },
];

steam_inventory_exchange_items(_arrayCreate, _arrayDestroy);

Given the provided items to be destroyed and the items to be create the code above will perform an exchange removing the current items (arrayDestroy) from the inventory and adding the new (arrayCreate) in their place. The result for this task can be caught inside the Steam Async Event with the following code:

// Early exit if event type doesn't match
if (async_load[? "event_type"] != "inventory_result_ready") exit;

// Early exit if handle doesn't match
if (async_load[? "handle"] != handle) exit;

// Early exit if handle doesn't match
if (async_load[? "success"])
{
    show_debug_message("Exchange was a success");
}
else
{
    show_debug_message("Exchange failed");
}

// Don't forget to clean the ununsed handle
steam_inventory_result_destroy(handle);
handle = undefined;

The code above matches the event type and checks if the handle ID matches the one that initialized the request and if so we print a debug message with the success of the task. In the end we also use a call to steam_inventory_result_destroy to make sure we dispose and free all the used memory.




Back To Top

steam_inventory_generate_items

This function generates specific items for the current user.

Note

This is only usable by Steam accounts that belong to the publisher group for your game.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around GenerateItems.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_generate_items(create_arr)
Argument Type Description
create_arr Array of InventoryItemCreationData An array of structs representing items to be created



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
The InventoryResultStatus status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

var _arrayCreate = [
    {item_def: item1, quantity: 3},
    {item_def: item2, quantity: 5},
];

steam_inventory_generate_items(_arrayCreate);

The code above will grant the specific items to the current user. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.




Back To Top

steam_inventory_get_all_items

This function starts retrieving all items in the current user's inventory.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around GetAllItems.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_get_all_items()



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
The InventoryResultStatus status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

✴️ OPTIONAL

The asynchronous event presented below is only triggered when the result is newer/fresher than the last known result. It will not trigger if the inventory hasn't changed, or if results from two overlapping calls are reversed in flight and the earlier result is already known to be stale/out-of-date. The regular callback will still be triggered immediately afterwards; this is an additional notification for your convenience.

Key Type Description
event_type String The string value "inventory_full_update"
success Boolean Whether the async action succeeded
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

handle = steam_inventory_get_all_items();

The code above will start a query for all the items in current users inventory. The result for this task can be caught inside the Steam Async Event with the following code:

// Early exit if event type doesn't match
if (async_load[? "event_type"] != "inventory_result_ready") exit;

// Early exit if handle doesn't match
if (async_load[? "handle"] != handle) exit;

// Early exit if handle doesn't match
if (async_load[? "success"])
{
    var _items = steam_inventory_result_get_items(handle);

    for (var i = 0; i < array_length(_items); i++)
    {
        var _item = _items[i];
        // access item data for each entry
        //
        // _item.item_id
        // _item.item_def
        // _item.quantity
        // _item.flags
    }
}

// Don't forget to clean the ununsed handle
steam_inventory_result_destroy(handle);
handle = undefined;

The code above matches the event type and checks if the handle ID matches the one that initialized the request and if so gets the items from the result using the function steam_inventory_result_get_items and loops through them. In the end we also use a call to steam_inventory_result_destroy to make sure we dispose and free all the used memory.




Back To Top

steam_inventory_get_items_by_id

This function requests information about a subset of the current user's inventory.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around GetItemsByID.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_get_items_by_id(item_ids)
Argument Type Description
item_ids Any {array} An array of steam_inventory_item_id of items to get information of.



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

handle = steam_inventory_get_items_by_id([item1, item2]);

Similar to steam_inventory_get_all_items but you can specify an array of items to query information instead of querying all of them. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.




Back To Top

steam_inventory_submit_update_properties

Submits the transaction request to modify dynamic properties on items for the current user. See StartUpdateProperties.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around SubmitUpdateProperties.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_submit_update_properties(handle)
Argument Type Description
handle Real The update handle corresponding to the transaction request



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

var _handle = steam_inventory_start_update_properties();
steam_inventory_set_property_bool(_handle, item_id, "invisible", true);
steam_inventory_set_property_float(_handle, item_id, "power", 123.54);
steam_inventory_set_property_int(_handle, item_id, "uses", 5);
steam_inventory_set_property_string(_handle, item_id, "name", "Big Sword");
// ...
steam_inventory_remove_property(_handle, item_id, "invisible");
// ...
steam_inventory_submit_update_properties(_handle);

The code above provides a simple sample on how to set/removed some properties. Starting with a steam_inventory_start_update_properties then multiple calls to set/remove property functions:

Finishing with the submission of the update using the function call steam_inventory_submit_update_properties. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.




Back To Top

steam_inventory_transfer_item_quantity

Transfer items between stacks within a user's inventory.

This can be used to stack, split, and move items. The source and destination items must have the same itemdef id. To move items onto a destination stack specify the source, the quantity to move, and the destination item id. To split an existing stack, pass steam_item_instance_id_invalid into dest_item_id. A new item stack will be generated with the requested quantity.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around TransferItemQuantity.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_transfer_item_quantity(source_item_id, quantity, dest_item_id)
Argument Type Description
source_item_id Int64 The source steam_inventory_item_id to transfer from
quantity Real The quantity of the item that will be transferred
dest_item_id Int64 The destination steam_inventory_item_id to transfer to or steam_item_instance_id_invalid to create a new stack



Returns:

Real


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

handle = steam_inventory_transfer_item_quantity(global.apples[0], 2, global.apples[1]);

The above code will trigger a transfer between two item stacks owned by the user the amount to be transferred in the example, this will move 2 apples from stack 0 to stack 1. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.




Back To Top

steam_inventory_trigger_item_drop

This function triggers an item drop if the user has played a long enough period of time. This period can be customized in two places:

  • At the application level within Inventory Service: Playtime Item Grants. This will automatically apply to all "playtimegenerator" items that do not specify any overrides.
  • In an individual "playtimegenerator" item definition. The settings would take precedence over any application-level settings.

Only item definitions which are marked as "playtime item generators" can be spawned.

Warning

You must call steam_inventory_result_destroy on the returned async result ID when you are done with it.

Tip

A wrapper around TriggerItemDrop.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_inventory_trigger_item_drop(item_def)
Argument Type Description
item_def Real This must refer to an item definition of the type "playtimegenerator". See the inventory schema for more details.



Returns:

Boolean


Triggers:

Steam Async Event

Key Type Description
event_type String The string value "inventory_result_ready"
success Boolean Whether the async action succeeded
result InventoryResultStatus The status code as returned by steam_inventory_result_get_status
handle Real The associated async result ID, which can be used to tell apart what result this event is for.

Example:

handle = steam_inventory_trigger_item_drop(item_def);

For more information on this function call please refer to the official manual. For an example on how to use the Steam Async Event to read the callback response, refer to the function steam_inventory_get_all_items.




Back To Top

steam_inventory_result_destroy

Destroys a result handle and frees all associated memory. This handle is returned by the following functions:

Note

This function can be called using an inventory result handle after the corresponding async event has been triggered.

Tip

A wrapper around DestroyResult.


Syntax:

steam_inventory_result_destroy(inv_result)
Argument Type Description
inv_result Real The inventory result handle to destroy



Returns:

Boolean


Example:

// Early exit if event type doesn't match
if (async_load[? "event_type"] != "inventory_result_ready") exit;

// Early exit if handle doesn't match
if (async_load[? "handle"] != handle) exit;

// Early exit if handle doesn't match
if (async_load[? "success"])
{
    show_debug_message("Exchange was a success");
}
else
{
    show_debug_message("Exchange failed");
}

// Don't forget to clean the unused handle
steam_inventory_result_destroy(handle);
handle = undefined;

In the code above we have an example of a asynchronous callback that generates a result handle by the end of which we execute a call to steam_inventory_result_destroy to make sure we dispose and free all the used memory.




Back To Top

steam_inventory_result_get_item_property

This function gets the dynamic properties from an item in an inventory result set. Property names are always composed of ASCII letters, numbers, and/or underscores.

Note

This function can be called using an inventory result handle after the corresponding async event has been triggered.

Tip

A wrapper around GetResultItemProperty.


Syntax:

steam_inventory_result_get_item_property(inv_result, item_index, prop_name)
Argument Type Description
inv_result Real The inventory result handle
item_index Real Position of the item in the result set
prop_name String The property name to get the value for



Returns:

String


Example:

handle = steam_inventory_get_all_items();

The code above will start a query for all the items in the current user's inventory. The result for this task can be caught inside the Steam Async Event with the following code:

// Early exit if event type doesn't match
if (async_load[? "event_type"] != "inventory_result_ready") exit;

// Early exit if handle doesn't match
if (async_load[? "handle"] != handle) exit;

// Early exit if handle doesn't match
if (async_load[? "success"])
{
    var _items = steam_inventory_result_get_items(handle);

    var _status = steam_inventory_result_get_status(handle);
    var _timestamp = steam_inventory_result_get_unix_timestamp(handle);

    for (var i = 0; i < array_length(_items); i++)
    {
        // It's also possible to get properties from each item using
        // prop1 = steam_inventory_result_get_item_property(handle, i, "property_name1");
        // prop2 = steam_inventory_result_get_item_property(handle, i, "property_name2");
    }
}

// Don't forget to clean the unused handle
steam_inventory_result_destroy(handle);
handle = undefined;

The code above matches the event type and checks if the handle ID matches the one that initialized the request and if so gets the items from the result using the function steam_inventory_result_get_items and loops through them to get the item properties we want. In the end we also use a call to steam_inventory_result_destroy to make sure we dispose and free all the used memory.




Back To Top

steam_inventory_result_get_items

This function gets the items associated with an inventory result handle.

Note

This function can be called using an inventory result handle after the corresponding async event has been triggered.

Tip

A wrapper around GetResultItems.


Syntax:

steam_inventory_result_get_items(inv_result)
Argument Type Description
inv_result Real The inventory result handle



Returns:

Array of ResultItem


Example:

var _array = steam_inventory_result_get_items(inv_result);
for(var i = 0 ; i < array_length(_array) ; i++)
{
     var _struct = _array[i];
     var _item_id = _struct.item_id;
     var _item_def = _struct.item_def;
     var _quantity = _struct.quantity;
}

For a more detailed implementation sample please refer to the steam_inventory_get_all_items function.




Back To Top

steam_inventory_result_get_status

This function returns the status code of a result.

Note

This function can be called using an inventory result handle after the corresponding async event has been triggered.

Tip

A wrapper around GetResultStatus.


Syntax:

steam_inventory_result_get_status(inv_result)
Argument Type Description
inv_result Real The inventory result handle



Returns:

InventoryResultStatus


Example:

if(steam_inventory_result_get_status(inv_result) != steam_inventory_result_status_ok)
     exit;

For a more detailed implementation sample please refer to the steam_inventory_result_get_item_property function.




Back To Top

steam_inventory_result_get_unix_timestamp

This function returns a Unix timestamp for the server time at which the result was generated.

Note

This function can be called using an inventory result handle after the corresponding async event has been triggered.

Tip

A wrapper around GetResultTimestamp.


Syntax:

steam_inventory_result_get_unix_timestamp(inv_result)
Argument Type Description
inv_result Real The inventory result handle



Returns:

Int64


Example:

var _timestamp = steam_inventory_result_get_unix_timestamp(inv_result);

For a more detailed implementation sample please refer to the steam_inventory_result_get_item_property function.




Back To Top

steam_inventory_start_update_properties

This function starts a transaction request to update dynamic properties on items for the current user. It returns a steam_inventory_update_handle that can be used with the following functions:

Tip

A wrapper around StartUpdateProperties.


Syntax:

steam_inventory_start_update_properties()



Returns:

Int64


Example:

handle = steam_inventory_start_update_properties();
steam_inventory_set_property_bool(handle, item_id, "invisible", true);
steam_inventory_set_property_float(handle, item_id, "power", 123.54);
steam_inventory_set_property_int(handle, item_id, "uses", 5);
steam_inventory_set_property_string(handle, item_id, "name", "Big Sword");
steam_inventory_submit_update_properties(handle);

The code above provides a simple sample on how to set/removed some properties. Starting with a steam_inventory_start_update_properties then multiple calls to set/remove property functions:

Finishing with the submission of the update using the function call steam_inventory_submit_update_properties.




Back To Top

steam_inventory_remove_property

This function removes a dynamic property of the given item.

Tip

A wrapper around RemoveProperty.


Syntax:

steam_inventory_remove_property(handle, item_id, prop_name)
Argument Type Description
handle Real The update handle returned by steam_inventory_start_update_properties
item_id Int64 The steam_inventory_item_id of the item being modified
prop_name String The dynamic property being removed



Returns:

Boolean


Example:

var _handler = steam_inventory_start_update_properties();
steam_inventory_set_property_bool(_handler, item_id, "invisible", true);
steam_inventory_set_property_float(_handler, item_id, "power", 123.54);
steam_inventory_set_property_int(_handler, item_id, "uses", 5);
steam_inventory_set_property_string(_handler, item_id, "name", "Big Sword");
// ...
steam_inventory_remove_property(_handler, item_id, "invisible");
// ...
steam_inventory_submit_update_properties(_handler);

The code above provides a simple sample on how to set/remove some properties. Starting with a steam_inventory_start_update_properties then multiple calls to set/remove property functions:

Finishing with the submission of the update using the function call steam_inventory_submit_update_properties.




Back To Top

steam_inventory_set_property_bool

This function sets a dynamic property for the boolean given item.

Tip

A wrapper around SetProperty.


Syntax:

steam_inventory_set_property_bool(handle, prop_name, val)
Argument Type Description
handle Real The update handle corresponding to the transaction request
prop_name String The dynamic property being added or updated.
val Boolean value being set.



Returns:

Boolean


Example:

handle = steam_inventory_start_update_properties();
steam_inventory_set_property_bool(handle, item_id, "invisible", true);
steam_inventory_set_property_float(handle, item_id, "power", 123.54);
steam_inventory_set_property_int(handle, item_id, "uses", 5);
steam_inventory_set_property_string(handle, item_id, "name", "Big Sword");
// ...
steam_inventory_remove_property(handle, item_id, "invisible");
// ...
steam_inventory_submit_update_properties(handle);

The code above provides a simple sample on how to set/removed some properties. Starting with a steam_inventory_start_update_properties then multiple calls to set/remove property functions:

Finishing with the submission of the update using the function call steam_inventory_submit_update_properties.




Back To Top

steam_inventory_set_property_float

This function sets a dynamic property for the float given item.

Tip

A wrapper around SetProperty.


Syntax:

steam_inventory_set_property_float(handle, prop_name, val)
Argument Type Description
handle Real The update handle corresponding to the transaction request
prop_name String The dynamic property being added or updated.
val Real value being set.



Returns:

Boolean


Example:

handle = steam_inventory_start_update_properties();
steam_inventory_set_property_bool(handle, item_id, "invisible", true);
steam_inventory_set_property_float(handle, item_id, "power", 123.54);
steam_inventory_set_property_int(handle, item_id, "uses", 5);
steam_inventory_set_property_string(handle, item_id, "name", "Big Sword");
// ...
steam_inventory_remove_property(handle, item_id, "invisible");
// ...
steam_inventory_submit_update_properties(handle);

The code above provides a simple sample on how to set/removed some properties. Starting with a steam_inventory_start_update_properties then multiple calls to set/remove property functions:

Finishing with the submission of the update using the function call steam_inventory_submit_update_properties.




Back To Top

steam_inventory_set_property_int

This function sets a dynamic property for the int given item.

Tip

A wrapper around SetProperty.


Syntax:

steam_inventory_set_property_int(handle, prop_name, val)
Argument Type Description
handle Real The update handle corresponding to the transaction request
prop_name String The dynamic property being added or updated.
val Real value being set.



Returns:

Boolean


Example:

handle = steam_inventory_start_update_properties();
steam_inventory_set_property_bool(handle, item_id, "invisible", true);
steam_inventory_set_property_float(handle, item_id, "power", 123.54);
steam_inventory_set_property_int(handle, item_id, "uses", 5);
steam_inventory_set_property_string(handle, item_id, "name", "Big Sword");
// ...
steam_inventory_remove_property(handle, item_id, "invisible");
// ...
steam_inventory_submit_update_properties(handle);

The code above provides a simple sample on how to set/removed some properties. Starting with a steam_inventory_start_update_properties then multiple calls to set/remove property functions:

Finishing with the submission of the update using the function call steam_inventory_submit_update_properties.




Back To Top

steam_inventory_set_property_string

This function sets a dynamic property for the string given item.

Tip

A wrapper around SetProperty.


Syntax:

steam_inventory_set_property_string(handle, prop_name, val)
Argument Type Description
handle Real The update handle corresponding to the transaction request
prop_name String The dynamic property being added or updated.
val String value being set.



Returns:

Boolean


Example:

var _handle = steam_inventory_start_update_properties();
steam_inventory_set_property_bool(_handle, item_id, "invisible", true);
steam_inventory_set_property_float(_handle, item_id, "power", 123.54);
steam_inventory_set_property_int(_handle, item_id, "uses", 5);
steam_inventory_set_property_string(_handle, item_id, "name", "Big Sword");
// ...
steam_inventory_remove_property(_handle, item_id, "invisible");
// ...
steam_inventory_submit_update_properties(_handle);

The code above provides a simple sample on how to set/removed some properties. Starting with a steam_inventory_start_update_properties then multiple calls to set/remove property functions:

Finishing with the submission of the update using the function call steam_inventory_submit_update_properties.




Back To Top

InventoryResultStatus

These constants represent the status of an inventory result async event.

These constants are referenced by the following functions:


Member Description
steam_inventory_result_status_pending Pending
steam_inventory_result_status_ok Ok
steam_inventory_result_status_expired Expired
steam_inventory_result_status_invalid Invalid
steam_inventory_result_status_fail Fail
steam_inventory_result_status_invalid_param Iinvalid
steam_inventory_result_status_service_unavailable Unavailable
steam_inventory_result_status_limit_exceeded Exceeded


Back To Top

InventoryItemConsumptionData

This struct contains items consumption data. It contains the following details about an item consumption:

This struct is referenced by the following functions:


Member Type Description
item_id Int64 A steam_inventory_item_id of an item to be consumed
quantity Real How much of the said item is to be consumed


Back To Top

InventoryItemCreationData

This struct contains Inventory item creation data. It contains the following details about an item creation/purchase:

This struct is referenced by the following functions:


Member Type Description
item_def Int64 A steam_inventory_item_def representing the item type
quantity Real Number of items of type to be created


Back To Top

ResultItem

This struct is referenced by the following functions:


Member Type Description
item_id Real A representing the item instance
item_def Real A representing the item type
quantity Int64 How many of the said item there is in the slot
flags Int64 This is a bit-masked collection of ESteamItemFlags

Clone this wiki locally