...
If you run in to problems with the save/load cycle, it's often useful to inspect savegame files - you'll be able to see exactly (well, sort of) which global variables are being stored and whether they are broken or not.
Games are saved in the savegame folder with an extension of ".gam".
...
As you can see, each player gets a [globals_X]
section in the file, where X
is is the player number (zero-referenced). It's in this section that your global variables are stored, and as you can see it's a real mess!
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
[globals_0] lastHitTime=0 me=0 selectedPlayer=0 difficulty=0 mapName=Sk-Startup baseType=0 alliancesType=0 powerType=1000 maxPlayers=2 scavengers=false mapWidth=64 mapHeight=128 DORDER_ATTACK=3 DORDER_MOVE=2 DORDER_SCOUT=28 ... |
I highly recommend storing your constants as properties of a function to avoid cluttering up this section of the file!
Arrays containing primitive values look like this:
...
But as soon as you start dealing with objects or nested arrays, it becomes a real mess:
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
statusX=@Invalid()
statusY=@Invalid()
statusTime=@Invalid() |
If stuff is breaking, it's likely because it's been persisted as @Invalid()
in the scriptstate.ini
file.
Timers and queued functions
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
[triggers_11] player=1 function=adapt object=-1 frame=60002 type=0 ms=60000 [triggers_12] player=1 function=debugTrucks object=-1 frame=49002 type=0 ms=49000 |
It's important to note that only the player
and type
properties of objects passed in to setTimer() and queue() functions are persisted in the scriptstate.ini
file.