L
Laurent
Guest
Hey guys what's up
So the idea is that the player click on a square in the interface, so he can assign a number to that specific square.
There are different squares, and in each of them there is an instance of the object "num_btn_obj"
When you click on a square, the game has to save the unique instance id of that square, so the number chosen by the player goes only in that specific square.
This is the code in the click event of the object
The "ask_input_obj" draw a question for the user asking for the number to put in the square.
This object also has a "press enter" event with this code in it
everythings works until i try giving a number and press ENTER
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Key Press Event for <Enter> Key
for object ask_input_obj:
Pop :: Execution Error - Variable references invalid object (-4).<unknown variable>
at gml_Object_ask_input_obj_KeyPressed_ENTER_1 (line 1) - number_id.num = 1;
############################################################################################
Do you guys have any clue? Thanks in advance
Laurent
So the idea is that the player click on a square in the interface, so he can assign a number to that specific square.
There are different squares, and in each of them there is an instance of the object "num_btn_obj"
When you click on a square, the game has to save the unique instance id of that square, so the number chosen by the player goes only in that specific square.
This is the code in the click event of the object
///Create ask_input_obj
with (ask_input_obj) {instance_destroy()};
instance_create(0,0,ask_input_obj);
number_id = instance_place(mouse_x,mouse_y,num_btn_obj);
number_id is a global variable that temporarily store the id of the clicked square.with (ask_input_obj) {instance_destroy()};
instance_create(0,0,ask_input_obj);
number_id = instance_place(mouse_x,mouse_y,num_btn_obj);
The "ask_input_obj" draw a question for the user asking for the number to put in the square.
This object also has a "press enter" event with this code in it
number_id.num = 1;
instance_destroy();
To semplify things and testing purposes i assigned 1 to the "num" variable in the button object, regardless of the player input.instance_destroy();
everythings works until i try giving a number and press ENTER
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Key Press Event for <Enter> Key
for object ask_input_obj:
Pop :: Execution Error - Variable references invalid object (-4).<unknown variable>
at gml_Object_ask_input_obj_KeyPressed_ENTER_1 (line 1) - number_id.num = 1;
############################################################################################
Do you guys have any clue? Thanks in advance
Laurent