• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker (Solved) Global wont update if in different script

Evanski

Raccoon Lord
Forum Staff
Moderator
Code:
switch(Command) //do we have a command or error
{
    case ("CMD_OVERFLOW") : show_debug_message("To many commands in one line") break;
    case ("CMD_ERROR")    : show_debug_message("'"+input_string+"'"+"is not recognized as an internal or external command or operable program.") break;
    case (1)              : script_execute(scr_do_con);
}

/* if this is here the global updates and it works fine
//destroy grid
ds_grid_destroy(cmd_list);
global.con_input = true;
*/
if i put
Code:
global.con_input = true;
any where in the script below it wont work

Code:
var grid = cmd_list;

//loop through grid looking for which command is 1
for (var i = 0; i < cmd_list_size; i++)
{
    grid_place = (grid[# 1, i]);
    if (grid_place == true)
    {
        //save what command it is
        value = ds_grid_get(grid,0,i);
        //show_message(string(value));
    }
}

//get the asset name of the command, lower case value because case sensitive
value = string_lower(value);
var command = asset_get_index("scr_cmd_"+value);

//if it exists do it else panic
if (command != -1)
{
    script_execute(command);
}else{
    show_message(value);
    show_message(command);
    ds_grid_destroy(cmd_list);
    game_end();
}
Both scripts run, both have there code work fine
the only thing that wont work is setting global.con_input = true
in a different place, what am I doing wrong?
 

Evanski

Raccoon Lord
Forum Staff
Moderator
I had it all fire from a key_pressed event, so it was firing 1.5 times (once then a half assed one from the first) long story short I added a fail safe for checking the key press once but not for if its slipped through and ran the script
 
Top