M
Mihaugoku
Guest
I might just be dumb again, but i'm having trouble with reading values from a ds_list.
Currently experimenting with a simple inventory system i thought of, and the part that i can't figure out is how the ds_list_find_index() function handles finding no free space when "picking up" an item.
The code in "scr_pickup" is very simple, but sadly the "var val2" part doesn't work:
Also tried using:
What i'm trying to do is make a message appear like "Inventory full!" when the player has all slots taken up.
What i wanna know is how to make the ds_list_find_index() read a "no value" situation.
EDIT//
Waited for an hour, managed to find out the answer on my own.......
Currently experimenting with a simple inventory system i thought of, and the part that i can't figure out is how the ds_list_find_index() function handles finding no free space when "picking up" an item.
The code in "scr_pickup" is very simple, but sadly the "var val2" part doesn't work:
Code:
for(i=0; i<10; i++) {
var val = ds_list_find_value(global.inv,i)
if val = 0 {
ds_list_set(global.inv,i,global.item_list)
instance_destroy()
break;
}
var val2 = ds_list_find_index(global.inv,0)
if val2 = undefined {
obj_blu.inv_full = true
}
}
Code:
if is_undefined(val2) {
What i wanna know is how to make the ds_list_find_index() read a "no value" situation.
EDIT//
Waited for an hour, managed to find out the answer on my own.......
Last edited: