Gamesalive
Member
Hi GMC,
This is my first thread so I hope this works!
I am working on a survival game and am currently working on the inventory and crafting system. However I noticed that I seem to be getting this in my output window:
Grid 0, index out of bounds writing [-1,0] - size is [1,8]
Grid 0, index out of bounds writing [-1,1] - size is [1,8]
Grid 0, index out of bounds writing [-1,2] - size is [1,8]
Grid 0, index out of bounds writing [-1,3] - size is [1,8]
Grid 0, index out of bounds writing [-1,4] - size is [1,8]
Grid 0, index out of bounds writing [-1,5] - size is [1,8]
Grid 0, index out of bounds writing [-1,6] - size is [1,8]
Grid 0, index out of bounds writing [-1,7] - size is [1,8]
Grid 0, index out of bounds writing [-1,0] - size is [2,8]
Grid 0, index out of bounds writing [-1,1] - size is [2,8]
Grid 0, index out of bounds writing [-1,2] - size is [2,8]
Grid 0, index out of bounds writing [-1,3] - size is [2,8]
Grid 0, index out of bounds writing [-1,4] - size is [2,8]
Grid 0, index out of bounds writing [-1,5] - size is [2,8]
Grid 0, index out of bounds writing [-1,6] - size is [2,8]
Grid 0, index out of bounds writing [-1,7] - size is [2,8]
Grid 1, index out of bounds writing [0,15] - size is [1,15]
Grid 1, index out of bounds writing [1,15] - size is [2,15]
Grid 2, index out of bounds writing [-1,0] - size is [1,4]
Grid 2, index out of bounds writing [-1,1] - size is [1,4]
Grid 2, index out of bounds writing [-1,2] - size is [1,4]
Grid 2, index out of bounds writing [-1,3] - size is [1,4]
I have mucked around with it for a few hours now and I can seem to work out how to fix it. I have several similar scripts for initiating things such as items and recipes. I think the problem may be in the for loops but i can't work out what it is:
/// @description creates a new item and adds it to the itemData grid
/// @param name
/// @param description
/// @param holdSprite
/// @param dropSprite
/// @param invSprite
/// @param stackLimit
/// @param type
/// @param durability
/// @param effect
/// @param knockback
/// @param minedmg
/// @param chopdmg
/// @param attackdmg
/// @param clip
/// @param ammoSprite
/// @param ammoSpeed
//variables
var i, stats;
for (i=0; i<stat.allStats; i +=1)
{
stats = argument;
}
//add the items name to itemList and resizes the itemData grid
ds_list_add(global.itemList,stats[stat.name]);
var iid;
iid = ds_list_size(global.itemList)-1;
ds_grid_resize(global.itemData,ds_list_size(global.itemList),stat.allStats-1);
//input all arguments into the itemData grid
for (i=0; i<stat.allStats; i+=1)
{
ds_grid_set(global.itemData,iid,i,stats);
}
*stat.allstats is an enumerator.
Any help is very much appreciated and thanks in advance!
This is my first thread so I hope this works!
I am working on a survival game and am currently working on the inventory and crafting system. However I noticed that I seem to be getting this in my output window:
Grid 0, index out of bounds writing [-1,0] - size is [1,8]
Grid 0, index out of bounds writing [-1,1] - size is [1,8]
Grid 0, index out of bounds writing [-1,2] - size is [1,8]
Grid 0, index out of bounds writing [-1,3] - size is [1,8]
Grid 0, index out of bounds writing [-1,4] - size is [1,8]
Grid 0, index out of bounds writing [-1,5] - size is [1,8]
Grid 0, index out of bounds writing [-1,6] - size is [1,8]
Grid 0, index out of bounds writing [-1,7] - size is [1,8]
Grid 0, index out of bounds writing [-1,0] - size is [2,8]
Grid 0, index out of bounds writing [-1,1] - size is [2,8]
Grid 0, index out of bounds writing [-1,2] - size is [2,8]
Grid 0, index out of bounds writing [-1,3] - size is [2,8]
Grid 0, index out of bounds writing [-1,4] - size is [2,8]
Grid 0, index out of bounds writing [-1,5] - size is [2,8]
Grid 0, index out of bounds writing [-1,6] - size is [2,8]
Grid 0, index out of bounds writing [-1,7] - size is [2,8]
Grid 1, index out of bounds writing [0,15] - size is [1,15]
Grid 1, index out of bounds writing [1,15] - size is [2,15]
Grid 2, index out of bounds writing [-1,0] - size is [1,4]
Grid 2, index out of bounds writing [-1,1] - size is [1,4]
Grid 2, index out of bounds writing [-1,2] - size is [1,4]
Grid 2, index out of bounds writing [-1,3] - size is [1,4]
I have mucked around with it for a few hours now and I can seem to work out how to fix it. I have several similar scripts for initiating things such as items and recipes. I think the problem may be in the for loops but i can't work out what it is:
/// @description creates a new item and adds it to the itemData grid
/// @param name
/// @param description
/// @param holdSprite
/// @param dropSprite
/// @param invSprite
/// @param stackLimit
/// @param type
/// @param durability
/// @param effect
/// @param knockback
/// @param minedmg
/// @param chopdmg
/// @param attackdmg
/// @param clip
/// @param ammoSprite
/// @param ammoSpeed
//variables
var i, stats;
for (i=0; i<stat.allStats; i +=1)
{
stats = argument;
}
//add the items name to itemList and resizes the itemData grid
ds_list_add(global.itemList,stats[stat.name]);
var iid;
iid = ds_list_size(global.itemList)-1;
ds_grid_resize(global.itemData,ds_list_size(global.itemList),stat.allStats-1);
//input all arguments into the itemData grid
for (i=0; i<stat.allStats; i+=1)
{
ds_grid_set(global.itemData,iid,i,stats);
}
*stat.allstats is an enumerator.
Any help is very much appreciated and thanks in advance!