Good job! .. BUT
ds grids are not the same as arrays. Their syntax is different. I'm actually surprised that is not throwing you an error.
You can basically get rid of this line:
----------------------------------------------------------------------------------------------
inventory_array =
ds_grid_create(7,5);
----------------------------------------------------------------------------------------------
.. and then you would be using inventory_array as a
2D Array
However, if you want to keep that line and actually use it as a grid..
Then inserting items into it would look like
this:
----------------------------------------------------------------------------------------------
ds_grid_set( inventory_grid , 0, 0, "training sword");
ds_grid_set( inventory_grid , 0, 1, 10);
ds_grid_set( inventory_grid , 0, 2, "sword");
----------------------------------------------------------------------------------------------
or this ( accesor version )
----------------------------------------------------------------------------------------------
inventory_grid[# 0,0] = "training sword";
inventory_grid[# 0,1] = 10;
inventory_grid[# 0,2] = "sword";
----------------------------------------------------------------------------------------------
Hope that helps.
This might actually be a good time to show you how using scripts might make things easier.
You
don't need one right now, but it's good to start thinking about how they can help you organize things.
SCRIPT scr_inventory_insert:
----------------------------------------------------------------------------------------------
///scr_inventory_insert( item, value, category)
var insert_position =
array_height_2d( inventory_array );
inventory_array[ insert_position ,0] =
argument0;
inventory_array[ insert_position ,1] =
argument1;
inventory_array[ insert_position ,2] =
argument2;
----------------------------------------------------------------------------------------------
If you use your own script similar to that you could replace the code you posted with:
----------------------------------------------------------------------------------------------
scr_inventory_insert( "training sword", 10, "sword" );
scr_inventory_insert( "dagger", 8 "sword" );
scr_inventory_insert( "purple shield", 20, "shield" );
scr_inventory_insert( "standard shield", 10, "shield" );
----------------------------------------------------------------------------------------------