C
clooms
Guest
Hello, and thank you for reading this.
I'm searching for any help to understand this problem
I have some issues with an array I made in a "Oconsole" object to be consulted from others objects events.
I initiated it this way (Object: Oconsole | Event Create)
_______________________
for(var i=0;i<7;i++)
{
for(var j=0;j<7;j++)
{ ship_array[i,j] = 0 }
}
ship_array[3,3]=1
ship_array[3,4]=1
_______________________
Whene I try to check some values inside this array from an other object I got an error
Here is the code that check the value: (Object OShip | Event Create)
_______________________
if instance_exists(Oconsole)
{
if Oconsole.ship_array [3,3] == 1
{ instance_create_layer(x,y+64,"instances",Oship_couloir) }
}
_______________________
Here is the error message I got from it:
_______________________
############################################################################################
ERROR in
action number 1
of Create Event
for object OShip:
Push :: Execution Error - Variable Index [3] out of range [0] - 6.ship_array(100061,3)
at gml_Object_OShip_Create_0 (line 30) - if Oconsole.ship_array [3,3] == 1 ############################################################################################ gml_Object_OShip_Create0 (line 30)
________________________
The weird thing about this is that I can check any value from this array since I do it from the original object ( the Oconsole object).
I have tryed to draw all the values in game to see if it works. And it does.
Here is the code and the result:
________________________
for ( i=0; i<7 ;i++)
{
for (j=0; j<7; j++)
{draw_text(x-250+(i*16),y-100+(j*16),ship_array[i,j])}
}
_______________________
I can't figure how the value from the same array can be out of range from one object and not from an other.
Well I am out of solutions and I tryed many many things to make it work.
If you have any idea I would be so glad to read it.
Thank you again for reading it all.
I'm searching for any help to understand this problem
I have some issues with an array I made in a "Oconsole" object to be consulted from others objects events.
I initiated it this way (Object: Oconsole | Event Create)
_______________________
for(var i=0;i<7;i++)
{
for(var j=0;j<7;j++)
{ ship_array[i,j] = 0 }
}
ship_array[3,3]=1
ship_array[3,4]=1
_______________________
Whene I try to check some values inside this array from an other object I got an error
Here is the code that check the value: (Object OShip | Event Create)
_______________________
if instance_exists(Oconsole)
{
if Oconsole.ship_array [3,3] == 1
{ instance_create_layer(x,y+64,"instances",Oship_couloir) }
}
_______________________
Here is the error message I got from it:
_______________________
############################################################################################
ERROR in
action number 1
of Create Event
for object OShip:
Push :: Execution Error - Variable Index [3] out of range [0] - 6.ship_array(100061,3)
at gml_Object_OShip_Create_0 (line 30) - if Oconsole.ship_array [3,3] == 1 ############################################################################################ gml_Object_OShip_Create0 (line 30)
________________________
The weird thing about this is that I can check any value from this array since I do it from the original object ( the Oconsole object).
I have tryed to draw all the values in game to see if it works. And it does.
Here is the code and the result:
________________________
for ( i=0; i<7 ;i++)
{
for (j=0; j<7; j++)
{draw_text(x-250+(i*16),y-100+(j*16),ship_array[i,j])}
}
_______________________
I can't figure how the value from the same array can be out of range from one object and not from an other.
Well I am out of solutions and I tryed many many things to make it work.
If you have any idea I would be so glad to read it.
Thank you again for reading it all.