Functions Reference
GameMaker Studio · GML · Currency & store
gmda_getInventory
Fetches the player's permanent inventory (items owned in this game).
Asynchronous (result via event)
Signature
gmda_getInventory() -> realWhat it does
GETs /currency/inventory with the session headers. The queued inventory_loaded event carries response, a struct whose items array lists what the player owns, each entry describing an item (its id, where it came from, when it was acquired and any metadata). Returns 1 once dispatched, or 0 when there is no active session.
Parameters
This function takes no parameters.
How to call it
Call gmda_getInventory(), then read the inventory_loaded event with gmda_pollEvent() in your Step loop. A common pattern is to call it right after the session_started event to unlock owned content.
Result event: inventory_loaded { success, response }
Example
gmda_getInventory();
// in the Step event, drain the queue:
var e = gmda_pollEvent();
while (!is_undefined(e)) {
if (e.event == "inventory_loaded" && e.success) {
var items = e.response.items;
for (var i = 0; i < array_length(items); i++) {
show_debug_message("owns: " + string(items[i].item_id));
}
}
e = gmda_pollEvent();
}Use cases
- Unlock cosmetics or content the player already owns when the game starts.
- Render an inventory screen of acquired items.