Yes, it's wrong. The inventory is populated in the order you obtain items, so item_POTION could be placed anywhere in the inventory. inventory_qty[item_POTION] reads inventory slot 0 but ANYTHING could be there.
Viewing post in Yal's Monster Collector Engine comments
First put this in its own script,
function inventory_get_qty(item_id) {
for(var c = 0; c < global.inventory_items; c++){
if(global.inventory_item[c] == item_id){
return global.inventory_qty[c];
}
}
return 0;
}Then you can draw the quantity with,
draw_text(0, 0,tsprintf("POTION %", inventory_get_qty(item_POTION)))