It seems that gobal ints can't be arrays. Is that true? That would be a pity.
Technically speaking, the GlobalInts are an array of 500 ints.
If you want a global array, just use the usual method:
// header
import int gi[1000];
// script
int gi[1000];
export gi;
Note that the import line is the same as the declaration with "import" in front while export needs just the name.
Like the global vars pane? I don't think so. However, you should be able to make it globally available by exporting it from the global script.
[Edit]: Beat by Khris.
~Trent
Yeah, I used the import-export commands now, but I would have prefered to do that via the global variables pane. Importing and exporting 17 variables (at once) is a bit annoying.
But thanks anyway..
You can do:
import int bla[10], String text;
// and
export bla, text;
Where in the script do you declare and export the Global Int Array?
Quote from: MiteWiseacreLives! on Tue 30/10/2012 18:23:01
Where in the script do you declare and export the Global Int Array?
Usually you declare array normally in script source (*.asc file) like
int MyGlobalArr[100];
Then export it in the same place:
export MyGlobalArr;
Then re-declare it as
import in the script's header (*.ash file) like
import int MyGlobalArr[100];
If you do that in GlobalScript, both GlobalScript and all room scripts will be able to use it.
...now, I feel a little silly, since I practically repeated what Khris said above in this topic... 3 years ago.
Could it be your question was about something different, MiteWiseacreLives?
no, this helps to clarify.. was unable to find clear instructions on this.
So would I import the array in the GlobalScript.ash? ( I've not used this script before)
then i can refer to the int's in any room script?
Sorry if these questions seem simple.
Quote from: MiteWiseacreLives! on Tue 30/10/2012 20:18:59
So would I import the array in the GlobalScript.ash? ( I've not used this script before)
You declare them as import - yes. Formally speaking, variables are
exported from GlobalScript and
imported to room scripts, but to do so you
declare them as import in GlobalScript.ash. GlobalScript
.ash (the script header) - is what is "visible" in room scripts, while GlobalScript
.asc is not.
Quote from: MiteWiseacreLives! on Tue 30/10/2012 20:18:59
then i can refer to the int's in any room script?
yes, exactly.