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 (18)
Last message on 29 Jun 2020
Ganick
on
29 Jun 2020, 04:44:29
Hey I sent you a friend request on discord, im ganick (speaking to size43)
I noticed that when I did gms_optimize_variables ( false, false ), the "other player" still wants to be in sync with the original player object in terms of image index.
Heres a link of it happening
https://imgur.com/a/Vtasx9t
What I am trying to do-
I want the "other player" to instantly start moving its image_index and NOT wait for the original player to start moving its image_index.
(Im using image_index+=1 with image_speed=0 in my animations, because built in image_speed can frameskip, and im making a fighting gamge)
Ganick
on
29 Jun 2020, 07:12:55
Never mind, I got it fixed. Not sure what the issue was but I just scrapped the both player objects and gave it another shot. Works now :)
my simple mode is active and dont sync image_index then i did that:
gms_optimize_variables(1,1)
and when other player joined the room happened that error:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object GMS:
Push :: Execution Error - Variable Get -7._delay(100563, -2147483648)
at gml_Script_XServer_updateposition
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_XServer_updateposition (line 0)
gml_Script_XServer_step
gml_Script_gms_step
gml_Object_GMS_Step_0
Size43
(Administrator)
on
3 Mar 2018, 11:55:12
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.
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.
Nevermind, Here it is:
gms_optimize_variables(1,1);
I used this in Step Event of my Control object like this:
[script]gms_optimize_variables(1,1);[/script]
Why those [script] not works...
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();
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);
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!
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 ]