• 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!

Windows Wierd variable change, can't find why it does change...

RangerX

Member
Ok this one is wierd. There's something probably stupid that I am missing.
When I enter the tutorial level in the game, the variable called "global.Francais" changes to "true". This is really wierd because I didn't ask for that (lol) and I can't find the object causing this.

I thought it was a simple matter so here's what I did:

- I opened the properties window of all the objects that are in that tutorial room, clicked on "show information" and had a search for "global.Francais". I found no place where the variable is updated.

- I did put a breakpoint when a press Enter makes you change for that room. Then I pressed "step in" button until I reach the point where the variable becomes "true". Turns out it appears as true in the debugger while a certain script is read for like the third time. Which is really wierd because that script is read at many places and it doesn't actually update that variable.



Now I am out of ideas. Why in the hell the variable "global.Francais" appears to change at that precise moment ??

:(
 

RangerX

Member
Of course I use it. The image is right when the variable changes and its while the script "keyname()" is read.
The problem is, global.Francais is NOT updated within that script...


EDIT:
SnowWaffle, this is a great idea. I will look into that right now.

EDIT 2:
Second argument doesn't set the global.variable. Besides, this script is used in alot of place and it works fine. I also have to put the second argument in order to return the right language.
 
Last edited:

Sam

Member
Thats what I was getting to. Anything you put here as the second argument will cause global.Francais to be TRUE. Anything other than -1 or 0 will cause it to be true... an id of an instance, a key...
 

RangerX

Member
Here's the script. Its to have "better" names to appear for keys in my tutorial. Looks like its the script I am doing wrong? That would be REALLY wierd as I did not change it since a long time and it was working just fine until now...

Code:
{
keyboard_key=argument0; 
global.Francais=argument1;

    if(argument1==false)
    then
    {
        switch (argument0)
        {
        case vk_nokey: return ("......"); break;    //keycode representing that no key is press
        case vk_left: return ("ArrowL"); break; //keycode for left arrow key
        case vk_right: return ("ArrowR"); break; //keycode for right arrow key
        case vk_up: return ("ArrowU"); break; //keycode for up arrow key
        case vk_down: return ("ArrowD"); break; //keycode for down arrow key
        case vk_enter: return ("Enter"); break; //enter key
        case vk_escape: return ("Escape"); break; //escape key
        case vk_space: return ("SpcBar"); break; //space key
        case vk_shift: return ("Shift"); break; //shift key
        case vk_control: return ("Cntrl"); break; //control key
        case vk_alt: return ("Alt"); break; //alt key
        case vk_backspace: return ("Bckspc"); break; //backspace key
        case vk_tab: return ("Tab"); break; //tab key
        case vk_home: return ("Home"); break; //home key
        case vk_end: return ("End"); break; //end key
        case vk_delete: return ("Del"); break; //delete key
        case vk_insert: return ("Ins"); break; //insert key
        case vk_pageup: return ("PageU"); break; //pageup key
        case vk_pagedown: return ("PageD"); break; //pagedown key
        case vk_pause: return ("Pause"); break; //pause/break key
        case vk_printscreen: return ("Prtscr"); break; //printscreen/sysrq key
        case vk_f1: return ("F1"); break; //keycodes for the function keys F1 to F12
        case vk_f2: return ("F2"); break;
        case vk_f3: return ("F3"); break;
        case vk_f4: return ("F4"); break;
        case vk_f5: return ("F5"); break;
        case vk_f6: return ("F6"); break;
        case vk_f7: return ("F7"); break;
        case vk_f8: return ("F8"); break;
        case vk_f9: return ("F9"); break;
        case vk_f10: return ("F10"); break;
        case vk_f11: return ("F11"); break;
        case vk_f12: return ("F12"); break;
        case vk_numpad0: return ("Npad0"); break; //number keys on the numeric keypad
        case vk_numpad1: return ("Npad1"); break;
        case vk_numpad2: return ("Npad2"); break;
        case vk_numpad3: return ("Npad3"); break;
        case vk_numpad4: return ("Npad4"); break;
        case vk_numpad5: return ("Npad5"); break;
        case vk_numpad6: return ("Npad6"); break;
        case vk_numpad7: return ("Npad7"); break;
        case vk_numpad8: return ("Npad8"); break;
        case vk_numpad9: return ("Npad9"); break;
        case vk_multiply: return ("Multi"); break; //multiply key on the numeric keypad
        case vk_divide: return ("Div"); break; //divide key on the numeric keypad
        case vk_add: return ("Add"); break; //add key on the numeric keypad
        case vk_subtract: return ("Subtrk"); break; //subtract key on the numeric keypad
        case vk_decimal: return ("Deci"); break; //decimal dot keys on the numeric keypad
        default: return (string(chr(argument0))); break;
        }
    }
    else
    {
        switch (argument0)
        {
        case vk_nokey: return ("......"); break;    //keycode representing that no key is press
        case vk_left: return ("FlechG"); break; //keycode for left arrow key
        case vk_right: return ("FlechD"); break; //keycode for right arrow key
        case vk_up: return ("FlechH"); break; //keycode for up arrow key
        case vk_down: return ("FlechB"); break; //keycode for down arrow key
        case vk_enter: return ("Entrer"); break; //enter key
        case vk_escape: return ("Échap"); break; //escape key
        case vk_space: return ("SpcBar"); break; //space key
        case vk_shift: return ("Shift"); break; //shift key
        case vk_control: return ("Cntrl"); break; //control key
        case vk_alt: return ("Alt"); break; //alt key
        case vk_backspace: return ("RtrArr"); break; //backspace key (retour arriere)
        case vk_tab: return ("Tab"); break; //tab key
        case vk_home: return ("Home"); break; //home key
        case vk_end: return ("Fin"); break; //end key
        case vk_delete: return ("Suppr"); break; //delete key
        case vk_insert: return ("Inser"); break; //insert key
        case vk_pageup: return ("PageH"); break; //pageup key
        case vk_pagedown: return ("PageB"); break; //pagedown key
        case vk_pause: return ("Pause"); break; //pause/break key
        case vk_printscreen: return ("Prtscr"); break; //printscreen/sysrq key
        case vk_f1: return ("F1"); break; //keycodes for the function keys F1 to F12
        case vk_f2: return ("F2"); break;
        case vk_f3: return ("F3"); break;
        case vk_f4: return ("F4"); break;
        case vk_f5: return ("F5"); break;
        case vk_f6: return ("F6"); break;
        case vk_f7: return ("F7"); break;
        case vk_f8: return ("F8"); break;
        case vk_f9: return ("F9"); break;
        case vk_f10: return ("F10"); break;
        case vk_f11: return ("F11"); break;
        case vk_f12: return ("F12"); break;
        case vk_numpad0: return ("Npad0"); break; //number keys on the numeric keypad
        case vk_numpad1: return ("Npad1"); break;
        case vk_numpad2: return ("Npad2"); break;
        case vk_numpad3: return ("Npad3"); break;
        case vk_numpad4: return ("Npad4"); break;
        case vk_numpad5: return ("Npad5"); break;
        case vk_numpad6: return ("Npad6"); break;
        case vk_numpad7: return ("Npad7"); break;
        case vk_numpad8: return ("Npad8"); break;
        case vk_numpad9: return ("Npad9"); break;
        case vk_multiply: return ("Multi"); break; //multiply key on the numeric keypad
        case vk_divide: return ("Divi"); break; //divide key on the numeric keypad
        case vk_add: return ("Additi"); break; //add key on the numeric keypad
        case vk_subtract: return ("Soustr"); break; //subtract key on the numeric keypad
        case vk_decimal: return ("Decim"); break; //decimal dot keys on the numeric keypad
        default: return (string(chr(argument0))); break;
        } 
    }
}

Ok, I changed this:

Code:
keyboard_key=argument0;
global.Francais=argument1;
for this:

Code:
keyboard_key=argument0;
argument1=global.Francais;
This makes sense now and obviously works perfectly. But WHY WAS IT WORKING BEFORE?
**X-files music**
 
Last edited:
P

p055ible

Guest
Have you by any chance added this in the Room Creation code?

Edit: by this I mean global.Francais=true;
 
You keep saying global.Francais isn't updated in the script, but it is right at the beginning..
Code:
global.Francais = argument1;
That updates the variable to whatever your 2nd argument is.
 

RangerX

Member
If you look up there, I had fix my issue. My script works as intended now and I even found out why I never fell on this before.
 
Top