X
XirmiX
Guest
The "with" statement is supposed to take an instance/object and make changes to that instance/object as if it's written within that instance/object, but the object that executes the statement can be called within the statement through "other", right? Well, I have had this work well until now, where the object that executes the with statement is a networking one without any textures or anything and from within networking event. And I know that the issue is with the "other." parts and it getting an "unknown object" because if I change this code in the networking event:
To this...
...the error for that line of code goes away and moves onto creating an error for the next line that is still in the with statement, which is the same type of error. The two types of code would do the exact same thing, but one gives an error, the other doesn't. Any ideas as to why this might be? Can with statements with "other." not be done from within networking events? And to confirm yes, the variables from the networking event of the connection object ARE set to something, I even have set the values to display in the console log. And yes, the variables have already been set for the object instance that is called within the "with" statement and yes, an instance is being selected here.
This is the error that occurs for when both lines are in the with() statement btw:
Here's the error that occurs after one of the lines is taken away from the with statement and set straight in the networking event of the collision object:
Code:
var turret_type = buffer_read(buffer, buffer_u8); //turret type
var hull_type = buffer_read(buffer, buffer_u8); //hull type
tank_instance = instance_create(instance_spawn_current.x, instance_spawn_current.y, obj_hull);
with(tank_instance){
buffer_hull_receive = other.hull_type;
buffer_turret_receive = other.turret_type;
}
Code:
var turret_type = buffer_read(buffer, buffer_u8); //turret type
var hull_type = buffer_read(buffer, buffer_u8); //hull type
tank_instance = instance_create(instance_spawn_current.x, instance_spawn_current.y, obj_hull);
tank_instance.buffer_hull_receive = hull_type;
with(tank_instance){
buffer_turret_receive = other.turret_type;
}
This is the error that occurs for when both lines are in the with() statement btw:
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Async Event: Networking
for object obj_connection:
Variable <unknown_object>.<unknown variable>(100014, -2147483648) not set before reading it.
at gml_Object_obj_connection_NetworkingEvent_1 (line 109) - buffer_hull_receive = other.hull_type;
############################################################################################
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Async Event: Networking
for object obj_connection:
Variable <unknown_object>.<unknown variable>(100102, -2147483648) not set before reading it.
at gml_Object_obj_connection_NetworkingEvent_1 (line 112) - buffer_turret_receive = other.turret_type;
############################################################################################