P
Prometheus1998_
Guest
I'm trying to code a 3-dimensional grid structure for Game Maker Studio version 1.4.1804, and I've hit a bit of a snag. Every time I test the code to add a value to the data structure, it gives me this:
Here's the script that encounters the error:
Here's the "ds_3d_axisError" script as well, which exists solely to check if the coordinate inputs aren't numbers:
Every time I run it, the "ds_3d_axisError" script tells me the inputs are fine... and then the error message in the spoiler tags pops up. Does anyone have any idea what's going on here?
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object obj_test:
ds_grid_add argument 1 incorrect type (undefined) expecting a Number (YYGI32)
at P�K� (line 14) - ds_grid_add(grid,real(tx),real(ty),val);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_ds_3d_add (line 14)
called from - gml_Object_obj_test_CreateEvent_1 (line 5) - ds_3d_add(test,1,1,1,2);
called from - gml_Object_obj_camera_Key_SPACE_1 (line 2) - instance_create(self.x,self.y,obj_test);
FATAL ERROR in
action number 1
of Create Event
for object obj_test:
ds_grid_add argument 1 incorrect type (undefined) expecting a Number (YYGI32)
at P�K� (line 14) - ds_grid_add(grid,real(tx),real(ty),val);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_ds_3d_add (line 14)
called from - gml_Object_obj_test_CreateEvent_1 (line 5) - ds_3d_add(test,1,1,1,2);
called from - gml_Object_obj_camera_Key_SPACE_1 (line 2) - instance_create(self.x,self.y,obj_test);
Here's the script that encounters the error:
Code:
///ds_3d_add(id,val,x,y,z)
//Initialize the values
var ds_3d = argument0;
var val = argument1;
var tx = real(argument2);
var ty = real(argument3);
var tz = real(argument4);
//Check data type
ds_3d_axisError(argument2,argument3,argument4);
//Add value to 3d grid
var grid = ds_map_find_value(ds_3d,real(tz));
ds_grid_add(grid,real(tx),real(ty),val);
Code:
//Check if all inputs are type real; if not, crash the game.
if (is_real(argument0) && is_real(argument1) && is_real(argument2)){
show_message("All good on input types; proceeding...");
return false;
}
else{
show_message("Only use numbers for grid coordinates.");
game_end();
}