Global variables are Static, but I would like it to be Dynamic. How can I?
I have in GlobalScript a variable:
int count=3;
I have in Room1 this function:
function hHotspot1_AnyClick(){
count++;
Display("conta %d", count);
player.ChangeRoom(secondroom);
}
I have in Room2 this function:
function hHotspot1_AnyClick(){
count++;
Display("conta %d", count);
player.ChangeRoom(firstroom);
}
So, in first room:
'count' is 4.
In second room:
'count' is 4
But I would like it to be:
in first room 'count' is 4 and then in second room 'count' is 5. How can I?
What you want is to import/export your variable, search the manual and/or the forums on how to do that. Hope this helps!
Did you put
int count=3;
in the header (GlobalScript.ash)?
If you do that, what you get is a separate variable for each room.
Unless you need an array or custom struct variable, just check out the Global Variables pane in the project tree.
Alternatively, like dkh said, you can do this:
// header
import int count;
// main script
int count = 3;
export count;
(Also nothing of this has anything to do with dynamic vs. static, fyi.)