1. How many global variables can I use ?
2. In version 2.7 can I give them specific names ?
1.) Manual -> Reference -> System limits:
500 script GlobalInts (indexes 0 to 499)
50 script GlobalStrings (0 to 49)
And of course you can have self-defined variables (4KB's worth inside a function, not sure about global ones).
Global ("static"):
// global script
int MyVariable; // defined outside of any functions -> accessible to whole global script
export MyVariable; // export so it can be used everywhere
// main script header
import int MyVariable; // import in script header so it can be used in all scripts
// some script
MyVariable = 5;
Local ("dynamic"):
// global/room script
function DoStuff() {
int myvariable; // -> defined inside function: local variable, only accessible in here
//...
myvariable = 5;
}
2.) Not directly and you won't be able to use these names in dialog scripts, but you could set up an enum like this:
// main script header
enum MyGlobalIntNames {
eGlobalSolvedFirstPuzzle = 77 ,
// ^ arbitrary name, but I like to prefix "eGlobal" so the autocomplete pops them all up when I need them
//...
eGlobalHasShoes = 78;
};
and use these names in your script like this:
// some script
SetGlobalInt(eGlobalSolvedFirstPuzzle, 1);
// instead of "SetGlobalInt(77, 1);"
Also, I think you can name the graphical variables that are used in the interaction editor. To access them from the script, use the Get/SetGraphicalVariable functions.
But they're not supported very much so I suggest doing it the other way.