B
Bladebss
Guest
Hello, i am currently trying to learn GML to make a game.
I have got some stuff down but i have run across this fatal error and i just cant work out whats gone wrong.
Fatal error in
Action number 1
Of key press event for <shift>key
For object obj_inv_shopGUI:
Ds_grid_height argument 1 incorrect type (undefined) expected a number (YYGI32)
At gml_script_s_additem (line 18) -for (i=0; i <ds_grid_height (gridtoaddto); ++i)
######
Stack frame is
Gml_script_s_additem (line 18)
Called from - gml_object_obj_inv_shopGUI_keypress_16(line 4) - script_execute(ds_grid_get(shopinventory,4,s_itemselected));
I cant work out why its doing this as its an argument i set up where argument 0 out of 6 is gridtoaddto
And gridtoaddto = shopinventory in the script so i have this..
s_additem (shopinventory, banana,1,"tasty banana", spr_banana, s_buyitem(), obj_banana)
Shopinventory is a global variable and so is s_itemselected
Shopinventory = ds_grid_create(shopinventorywidth,1);
Shopinventorywidth =6;
So shouldnt the grid hight be getting a number from shopinventory and then adding 1 every time i add an item.
I could take some screens of my code if it helps.
I just cant work out whats gone wrong
I have the same set up for my player inventory but using different global variables and that works fine.
The idea was i could add stuff to the shop inventory on activation, and replace the script for using the item, with one for buying the item, where it adds the item to playerinventory but with the propper script for when its used buy the player.
So in the s_buyitem script brackets i have the same arguments to fill in but i just swaped the buyitem script for the eatbanana script. I omitted the arguments in my example abouve for the buyitem script cus im lazy lol but as the brakets are there i wundered if its running the code ontop and some thing is bugging out.
I have got some stuff down but i have run across this fatal error and i just cant work out whats gone wrong.
Fatal error in
Action number 1
Of key press event for <shift>key
For object obj_inv_shopGUI:
Ds_grid_height argument 1 incorrect type (undefined) expected a number (YYGI32)
At gml_script_s_additem (line 18) -for (i=0; i <ds_grid_height (gridtoaddto); ++i)
######
Stack frame is
Gml_script_s_additem (line 18)
Called from - gml_object_obj_inv_shopGUI_keypress_16(line 4) - script_execute(ds_grid_get(shopinventory,4,s_itemselected));
I cant work out why its doing this as its an argument i set up where argument 0 out of 6 is gridtoaddto
And gridtoaddto = shopinventory in the script so i have this..
s_additem (shopinventory, banana,1,"tasty banana", spr_banana, s_buyitem(), obj_banana)
Shopinventory is a global variable and so is s_itemselected
Shopinventory = ds_grid_create(shopinventorywidth,1);
Shopinventorywidth =6;
So shouldnt the grid hight be getting a number from shopinventory and then adding 1 every time i add an item.
I could take some screens of my code if it helps.
I just cant work out whats gone wrong
I have the same set up for my player inventory but using different global variables and that works fine.
The idea was i could add stuff to the shop inventory on activation, and replace the script for using the item, with one for buying the item, where it adds the item to playerinventory but with the propper script for when its used buy the player.
So in the s_buyitem script brackets i have the same arguments to fill in but i just swaped the buyitem script for the eatbanana script. I omitted the arguments in my example abouve for the buyitem script cus im lazy lol but as the brakets are there i wundered if its running the code ontop and some thing is bugging out.