A Random Creator
Member
Hey everyone, I feel that I'm pretty experienced with arrays so when I seen this error I thought it would be a simple fix but I can't find the issue!
Here is my error:
Here is the script where the error occurs:
So what this script is suppose to do is go through the array "_InventoryCraftS" and check if the map "_InventoryCraftList" values equal it. It is used to create a crafting menu sorta like Minecraft. It's kind of hard to explain so if you want more information then just ask. _InventoryCraftS is declared in this script:
_InventoryCraftList is a map that has 9 slots each one that will contain 0-9, so will _InventoryCraftS. I really don't know how else to explain it. If you need more info then please tell me. thanks!
Here is my error:
Code:
Push :: Execution Error - Variable Index [10,0] out of range [10,-1] - -5._InventoryCraftS(100151,320000)
at gml_Script_InventoryCraft (line 7) - if(_InventoryCraftS[t,v] = ds_map_find_value(_InventoryCraftList,v)) { } else { tBroke = 1 }
Code:
///InventoryCraft()
tGotItem = 0 t=1 tBroke = 0
for(t=0;t<=array_height_2d(_InventoryCraftS);t+=1) {
for(v=0;v<=9;v+=1) {
if(_InventoryCraftS[t,v] = ds_map_find_value(_InventoryCraftList,v)) { } else { tBroke = 1 }
}
if(tBroke = 0) {
InventoryGiveItem(t,1)
for(z=1;z<=9;z+=1) {
ds_map_replace(_InventoryCraftList,z,0)
}
tGotItem = 1
}
}
if(tGotItem = 0) {
for(m=1;m<=9;m+=1) {
if(ds_map_find_value(_InventoryCraftList,m) != 0) { InventoryGiveItem(9,1) }
ds_map_replace(_InventoryCraftList,m,0)
}
}
Code:
///InventorySetCraft(Item ID, Slot: 1,2,3,4,5,6,7,8,9)
tID = argument0
_InventoryCraftS[tID,1] = argument1
_InventoryCraftS[tID,2] = argument2
_InventoryCraftS[tID,3] = argument3
_InventoryCraftS[tID,4] = argument4
_InventoryCraftS[tID,5] = argument5
_InventoryCraftS[tID,6] = argument6
_InventoryCraftS[tID,7] = argument7
_InventoryCraftS[tID,8] = argument8
_InventoryCraftS[tID,9] = argument9