Divinik
Member
So I have an inventory system in the game I'm programming, and I want to be able to list only a certain category selected.
The grid is set up as follows:
0 = Item Name
1 = Item Amount
2 = Item Description
3 = Item Sprite
4 = Item Script
5 = Item Type
6 = Item Icon
The code to display the full inventory is as follows:
How would I make it so that the list only displays a certain Item Type (section 5 on the ds grid)?
Here is an image for visualization:
The grid is set up as follows:
0 = Item Name
1 = Item Amount
2 = Item Description
3 = Item Sprite
4 = Item Script
5 = Item Type
6 = Item Icon
The code to display the full inventory is as follows:
Code:
for(i = 0; i < global.inventoryEndAt; ++i)
{
for(j = 0; j < global.inventoryWidth; ++j)
{
inventoryOnScreen = i;
if tab = 0
{
if j = 0 and ds_grid_get(myItems,1,i+global.scrolledAmount) > 1{draw_text(itemLeftStart,itemTopStart + (i*24), ds_grid_get(myItems,0,i+global.scrolledAmount) +string(" x")+string(ds_grid_get(myItems,1,i+global.scrolledAmount)));}
else {if j = 0 and ds_grid_get(myItems,1,i+global.scrolledAmount) = 1{draw_text(itemLeftStart,itemTopStart + (i*24), ds_grid_get(myItems,0,i+global.scrolledAmount));}}
if j = 6 and ds_grid_get(myItems,1,i+global.scrolledAmount) >0 {draw_sprite(ds_grid_get(myItems,j,i+global.scrolledAmount),0,bbox_left+40,itemTopStart + (i*24)+10)}
}
if tab = 1
{
}
}
}
Here is an image for visualization: