I am practicing arrays. I understand the concept of a spreadsheet and cells. The problem I'm having is picking the inventory slot to populate on the inventory screen without assigning a specific slot to each item. I would like the computer to pick the first empty slot. I tried to read the inventory capx tutorial, but they are more focused on how an array works than on how one would use an array in game.
The first action for the item was to compare the array and make sure the item inventory was > or = to 1 so that it would not populate a slot if there was 0 in the array.
The second condition is where I'm having problems. The action for the condition (spawn item at inventory.x and inventory.y) is working.
I tried to set the inventory slot to have a boolean value of filled/ not filled and then have the system action be pick slot by comparison, then toggling the boolean. Item 2 ended up spawning over item one in the same inventory slot.
I tried to set the instance variable on the inventory slot to a number, then use system-> pick by evaluate, but again, item 2 spawned over item 1.
I tried making the boolean instance a condition instead of having the system check, but that ends up populating all of the empty slots and spawning a large number of items.
I was able to get both items to display properly by setting the system pick to the slot IID, but I would like the system to pick the next empty slot, not the same slot each time.
Any suggestions, or is there an example capx I can see the structure for populating slots on?