If they are just as fast as execute_string, then its pointless to use those functions.
EDIT: Typing mistake
Edited by ihato, 21 October 2011 - 03:42 PM.
Posted 21 October 2011 - 02:07 PM
Edited by ihato, 21 October 2011 - 03:42 PM.
Posted 21 October 2011 - 03:00 PM
I want to create a variable with a string
Edited by mads2194, 21 October 2011 - 03:02 PM.
Posted 21 October 2011 - 03:23 PM
Edited by GameGeisha, 21 October 2011 - 03:24 PM.
Posted 21 October 2011 - 03:48 PM
You really shouldn't use variable_*() functions. Though faster than execute_string(), they are considerably slower than just using the identifier. They also tend to reinforce the poor novice habit of equating identifiers with strings.
This is especially true if you intend to continue using GM for longer periods outputs. It is a known fact that variable_*() functions will be thrown out of future versions starting with GM4HTML5 in order to facilitate obfuscated and compiled outputs. Start living without it now.
GameGeisha
Posted 21 October 2011 - 04:21 PM
This still doesn't justify using variable_local_exists(). I've worked with moving platforms that vary in specs without even thinking about using that function. What are you actually doing that warrants using it?
You really shouldn't use variable_*() functions. Though faster than execute_string(), they are considerably slower than just using the identifier. They also tend to reinforce the poor novice habit of equating identifiers with strings.
This is especially true if you intend to continue using GM for longer periods outputs. It is a known fact that variable_*() functions will be thrown out of future versions starting with GM4HTML5 in order to facilitate obfuscated and compiled outputs. Start living without it now.
GameGeisha
I sometimes use variale_local_exists for objects which have instance specific variables, like moving platforms: not all of them move at the same speed or as much
Posted 21 October 2011 - 04:34 PM
This still doesn't justify using variable_local_exists(). I've worked with moving platforms that vary in specs without even thinking about using that function. What are you actually doing that warrants using it?
GameGeisha
Edited by mads2194, 21 October 2011 - 04:35 PM.
Posted 21 October 2011 - 04:48 PM
I check if the speed and length variables have been declared in the instance creation event so that I won`t try to work with undeclared variables and get an error.
Posted 21 October 2011 - 09:03 PM
You don't need variable_local_exists() here, just use inheritance.
This still doesn't justify using variable_local_exists(). I've worked with moving platforms that vary in specs without even thinking about using that function. What are you actually doing that warrants using it?
GameGeisha
I check if the speed and length variables have been declared in the instance creation event so that I won`t try to work with undeclared variables and get an error.
speed = 5; length = 72; event_inherited();3. Create the instance on the fly using instance_create(), then set the speed and length from there:
var inst; inst = instance_create(100, 100, obj_basic_moving_platform); inst.speed = 5; inst.length = 72;
0 members, 0 guests, 0 anonymous users