GameMaker load_csv(); file paths for included files?

Radr

Member
I feel like I'm missing something very obvious and easy here but I've been trying to figure this out for a couple of hours now and can't take it anymore.

I'm using the load_csv function to import a .csv file that I have in my Included Files folder.

obj_LootTableDatabase is going to hold all the item loot tables in the game. Better items will be on higher loot tables. For now I'm trying to get loot table 1 working.

Create event:
Code:
lootTable1  = load_csv("loot_table_1.csv");
Draw event:
Code:
/// @description Draw Loot Table On Screen
var ww, hh, xx, yy
ww = ds_grid_width(lootTable1);
hh = ds_grid_height(lootTable1);
xx = 32;
yy = 32;

for (var i = 0; i < ww; i++;){
    for (var j = 0; j < hh; j++;){
        draw_set_color(c_black);
        draw_text(xx, yy, string(ds_grid_get(lootTable1,i,j)));
        yy += 32;
    }
    yy = 32;
    xx += 128;
}
I put the object in an empty room at the start of the game to test and make sure it's reading the file correctly, so all I'm doing here is reading the .csv into a ds_grid (lootTable1), and then drawing the values on the screen, which works just fine.

Here's the problem - I'm going to have several drop tables, as well as other Included Files, so I will obviously want to structure my Included Files folder with sub-directories.

But the second I move "loot_table_1.csv" inside of a sub-folder called "loot_tables", it throws me an error when I run:

ERROR!!! :: ############################################################################################
ERROR in
action number 1
of Draw Event
for object obj_LootTableDatabase:


Data structure with index does not exist.
at gml_Object_obj_LootTableDatabase_Draw_0 (line 2) - ww = ds_grid_width(lootTable1);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_LootTableDatabase_Draw_0 (line 2)

So Data structure with index does not exist. It's obviously suddenly not reading the .csv file, thus not returning a ds grid (in fact, it's returning -1). Which means it can't find it, which means (I assume) I need to specify the sub-directory in load_csv?

I've been trying everything:
Code:
lootTable1 = load_csv("loot_tables\loot_table_1");
lootTable1 = load_csv("\loot_tables\loot_table_1");
lootTable1 = load_csv("datafiles\loot_tables\loot_table_1");
lootTable1 = load_csv("\datafiles\loot_tables\loot_table_1");
lootTable1 = load_csv(working_directory+"loot_tables\loot_table_1");
lootTable1 = load_csv(working_directory+"datafiles\loot_tables\loot_table_1");
I've tried all kinds of combinations like that, but I just can't figure this one out.

Any pointers at all where I'm going wrong here would be great!
 
Top