gms_optimize_variables

Usage: gms_optimize_variables ( sync_sprite, sync_imageindex )

Description

Enables or disables the synchronisation of sprite-related variables.
sync_sprite enables or disables the synchronisation of all sprite-related variables. sync_imageindex enables or disables the synchronisation of image_index

This function only affects player & other player objects.

Replies (14)

Last message on 24 Apr 2017

Drakost on 22 Apr 2017, 06:06:11
Is there a prebuilt variable for the other player's sprite or do I have to create one?
Size43 (Administrator) on 24 Apr 2017, 11:45:18
sprite_index will automatically be synced if you've enabled the simple mode.
loganout on 15 Oct 2015, 09:04:17
In my game TOP DOWN, How do I use gms optimize variables (sync_sprite, sync_image index) ...?

The Sprite_Walk the player is not being synchronized. It is no movement.

Does not look at the mouse pointer.
amkgames on 15 Oct 2015, 16:33:42
Nevermind, Here it is:
gms_optimize_variables(1,1);
amkgames on 15 Oct 2015, 16:22:22
I used this in Step Event of my Control object like this:
[script]gms_optimize_variables(1,1);[/script]
amkgames on 15 Oct 2015, 16:23:21
Why those [script] not works...
loganout on 15 Oct 2015, 19:36:28
ERROR:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object GMS:

Push :: Execution Error - Variable Get -7._delay(100565, -2147483648)
at gml_Script_XServer_updateposition (line 135) - ds_map_replace(_p, "#delay", _delay + 1);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_XServer_updateposition (line 135)
called from - gml_Script_XServer_step (line 987) - XServer_updateposition(_player);
called from - gml_Script_gms_step (line 55) - __ret = XServer_step(__current_room);
called from - gml_Object_GMS_StepNormalEvent_1 (line 3) - gms_step();
loganout on 15 Oct 2015, 19:43:20
I'm using this way now:
gms_optimize_variables(sprite_index,image_index)


The sprite has animation. But does not change angle.
Size43 (Administrator) on 17 Oct 2015, 15:29:48
There's no point in replying to random posts of mine to try and get my attention, if I don't reply I simply don't have time to do so :)

You should use the code amkgames suggested:
gms_optimize_variables(1,1);

or if you prefer using the constants instead of numbers:

gms_optimize_variables(true, true);
loganout on 17 Oct 2015, 22:38:27
I tried, but when I add this code in the step returns with error below.
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object GMS:

Push :: Execution Error - Variable Get -7._delay(100559, -2147483648)
at gml_Script_XServer_updateposition (line 135) - ds_map_replace(_p, "#delay", _delay + 1);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_XServer_updateposition (line 135)
called from - gml_Script_XServer_step (line 987) - XServer_updateposition(_player);
called from - gml_Script_gms_step (line 55) - __ret = XServer_step(__current_room);
called from - gml_Object_GMS_StepNormalEvent_1 (line 3) - gms_step();
Size43 (Administrator) on 3 Nov 2015, 19:34:06
I've got a fix coming for this in a future update. It should be done within the next few days!
amkgames on 20 Oct 2015, 10:06:26
That code should be in step event of Control object, I think.
Size43 (Administrator) on 15 Oct 2015, 16:36:36
The script-tag is for linking to scripts, like this: gms_settings.

The code-tag is for a code-block:
show_message("Hello, World!")


Other tags you can use as well:

title


small
i for italic
b for bold

p for paragraph


u for underline

  • list containing li-tags for a list


tt for monospace

[ screenshot ]78[ /screenshot ]

GM:Studio: The gmstudio-tag

GM8 / GM8.1: The gm8-tag

Link to a tutorial
[ article=sessions ]Link to a tutorial[ /article ]
amkgames on 15 Oct 2015, 20:31:22
Wow! Thanks! :)