Hi! As the title says I want to figure out if a global variable (global.cats) exists without having to put every global in the entire game into a ds_map and checking against it.
for more context.
im currently doing it like this
set_command_variable_name_argument is the global variable we are checking to see if it exists
set_command_value_1_argument is just a value for easy understanding lets just say this is 6
now im getting these values from a string, (im getting user input so I can change code as the game is running)
I realize I shouldn't be using compatibility functions for this (im not sure why as this works fine if someone could elaborate why thanks)
anyways I want to be able to continue what im doing but with out having every global need to be in a list or specially set up
I'd like to just check if the game has it existing and be able to change it
Thanks!
for more context.
im currently doing it like this
GML:
//If variable name actually exists
if (variable_global_exists(set_command_variable_name_argument))
{
variable_global_set(set_command_variable_name_argument, set_command_value_1_argument);
}
set_command_value_1_argument is just a value for easy understanding lets just say this is 6
now im getting these values from a string, (im getting user input so I can change code as the game is running)
I realize I shouldn't be using compatibility functions for this (im not sure why as this works fine if someone could elaborate why thanks)
anyways I want to be able to continue what im doing but with out having every global need to be in a list or specially set up
I'd like to just check if the game has it existing and be able to change it
Thanks!
Last edited: