I'm trying to use a variable between two rooms to track weather or not the player uses an elevator so that when the 2nd room loads, the ags knows the player used the elevator and runs an elevator opening animation. I tried to declare the variable in the global script but the room script could not recognize it. What am I doing wrong ?
Variables declared in the global script are initially local to the global script, that is, they're not global to the game.
To make them accessible via the other room scripts, you have to export the variables in the global script after declaration and then import them on top of a room script (if you want them accessible by all the rooms, just import them in the script header), For example:
Global Script:
int blah, haha;
export blah, haha;
Room Script:
import int blah, haha;
alternatively, you could use a GlobalInt but I'd also prefer gilbot's version since GlobalInts are limited
If you do what Gilbot said but its better to do this as it allows all rooms to access that variable.....
Global Script:
int elevator;
export elevator;
Script header:
import int elevator;
Quote(if you want them accessible by all the rooms, just import them in the script header)
I do believe he already said that. :P