» Thu Jun 21, 2012 10:38 am
Yep, you can declare variables like...
Int iMyVar
or
Int iMyVar2 = 0
...in the body of the script outside of events/functions, and then those variables will be globally available throughout the script. Unlike using properties for this purpose, such variables cannot be set/get via outside scripts, or used in conditions. But for logic that is purely local to the script, they should work.
(Note: array variables are a little different from the above in that you can't set a default value outside of events. You can do...
String[] aStatsToTrack
...but you cannot do...
String[] aStatsToTrack = new String[10]
...for example, outside of an event or function.)