[SOLVED] gms_instance_sync returns error

Posted by Jenraux
FIXED: Sorry, didn't realize you needed simple_mode set to true in order for "is_full" to work. Just noticed it in a bug report thread down below.

When I run this code in my NPC object:

gms_instance_sync(id,is_full)

It returns an error about expecting a string.

ERROR!!! :: ###########################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_gms:


string_byte_length argument 1 incorrect type (undefined) expecting a String (YYGS)
at gml_Script_XGms_ve_getBestWayToSend (line 81) - var length = string_byte_length(argument0); ###########################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_XGms_ve_getBestWayToSend (line 81)
called from - gml_Script_XServer_writevariable (line 2) - var _type = XGms_ve_getBestWayToSend(argument3, argument4); called from - gml_Script_XServer_step (line 959) - XServer_writevariable(_b, 5, _name, ds_map_find_value(_s, "*" + _name), ds_map_find_value(_s, ">" + _name)); called from - gml_Script_gms_step (line 59) - __ret = XServer_step(__current_room); called from - gml_Object_obj_gms_StepNormalEvent_1 (line 1) - gms_step()



The object has hundreds of variables, so I presume one of these isn't liked by GMS.

Is there a way of manually syncing just selected variables without syncing everything else? There's really only a need to sync the position, speed and rotation of the object. But it seems like it's trying to sync every variable the object has.

Even an object with no code except:

gms_instance_sync(id,is_full)

In the create event, is returning that same error. Am I missing something?

It also only does it when the "is_full" constant is used, I get no error using "is_onetime" or "is_extended"

Replies (1)

Last message on 18 Nov 2018

Size43 (Administrator) on 18 Nov 2018, 15:09:00
I know you've already solved this, just wanted to add a quick note on this bit: "Is there a way of manually syncing just selected variables without syncing everything else? There"

By default, most built-in player variables are synced (position, sprite, path, etc). For instance synchronization, only x, y, speed and direction are synced.

In both cases, any custom variables that you add need to be set manually using gms_self_set or gms_instance_var_set.