• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

DoConv Error for Inventory Array

B

Bluedevil9981

Guest
This has been bugging me for quite some time now! It really should be working as far as I can tell.

It all starts with scr_set_inv that goes like tis:
///scr_set_inventory(num,sprite,name,type,damage,desc,rarity,ex1,ex2,req)

//---COLORS---
col_trash=c_gray;
col_common=c_white;
col_uncommon=c_lime;
col_rare= c_blue;
col_epic=c_purple;
col_legendary=c_orange;

//Don't remove this one!
inv_create_item(0,spr_no_item,"",0,0,0,0,0,0,"")
///////////////////////
inv_create_item(1,spr_1_000,"Rusted Iron Shortsword","Shortsword","1-4 Damage","It might be useful in a pinch.",col_trash,"","","1");
inv_create_item(2,spr_1_001,"Rusted Iron Broadsword","Broadsword","1-7 Damage","You're better off throwing it at the target.",col_trash,"","","1");
inv_create_item(3,spr_1_002,"Rusted Iron Battleaxe","Battleaxe","1-7 Damage","",col_trash,"","","1");
inv_create_item(4,spr_1_003,"Rusted Iron Dagger","Dagger","1-3 Damage","",col_trash,"","","1");
inv_create_item(5,spr_1_004,"Rusted Iron Hammer","Hammer","1-6 Damage","",col_trash,"","","1");
inv_create_item(6,spr_1_005,"Rusted Iron Spear","Spear","1-7 Damage","",col_trash,"","","1");

then to inv_create_item:
///inv_create_item(number,sprite,name,type,damage min-max,descrip,global.colRarity,extra1,extra2,"level req")

sprite[argument0]=argument1;
text[argument0]=argument2;

global.item[0,argument0] = argument1; //sprite
global.item[1,argument0] = argument2; //name
global.item[2,argument0] = argument3; //type
global.item[3,argument0] = argument4; //damage
global.item[4,argument0] = argument5; //descrip
global.item[5,argument0] = argument6; //rarity
global.item[6,argument0] = argument7; //extra1
global.item[7,argument0] = argument8; //extra2
global.item[8,argument0] = string("Requires Level "+string(argument9)); //level req

And then finally to the draw_gui of my inventory controller:
scr_draw_inv();
if (blhover) {
scr_draw_hover(
global.item[0,pitem],
global.item[1,pitem],
global.item[2,pitem],
global.item[3,pitem],
global.item[4,pitem],
global.item[5,pitem],
global.item[6,pitem],
global.item[7,pitem],
global.item[8,pitem]
);
}

Absolutely nowhere in this chunk of code can I spot where this error is coming from!
DoConv :1: illegal array use
at gml_Object_obj_inventory_DrawGUI_1 (line 12) - global.item[8,pitem]
############################################################################################



I checked the global.item[8,x] over and over and no change seems to help. Any ideas?
 
B

Bluedevil9981

Guest
Hi Paolo, I have the error log in the last spoiler up there ;)
 

BLang

Member
Not really sure what the problem here is, but you can definitely write
Code:
global.item[8,argument0] = string("Requires Level "+string(argument9));
as
Code:
global.item[8,argument0] = "Requires Level "+string(argument9);
But I highly doubt that has anything to do with the error. Are you withholding parts of the scripts? There might be something in there that causes it. Right now, the only thing that looks odd is that you're initializing 7 items in the first script, but in the later scripts, you're referencing 9 different items? Not really sure, again, it's really hard to tell what's wrong with the info you provided. If there's anything else that manipulates the array in any way, please post it.

Apart from that, did you try cleaning the compiler cache?
 
Top