Code: Select all
<Globals>
(block Nil
(setq gPirateBarXP 0)
(setq gPirateStationXP 0)
(setq gPirateBarRank 0)
(setq gPirateStationRank 0)
(setq gPirateStationFailure 0)
)
</Globals>
Under what circumstances are globals reset?
Code: Select all
<Globals>
(block Nil
(setq gPirateBarXP 0)
(setq gPirateStationXP 0)
(setq gPirateBarRank 0)
(setq gPirateStationRank 0)
(setq gPirateStationFailure 0)
)
</Globals>
Indeed.george moromisato wrote:You should not rely on the value of any global across sessions. You should only store data by using the appropriate functions to store data in objects or static classes.
If globals are only reset when you exit the program, this opens up some nasty bugs (as I have discovered in my Pirate mod). Early missions become a problem as an early death will always result in my re-starting the game without exiting. This will result in the rank from Korolov (I believe), among others, being saved. This means that you could start the game with harder missions than usual, this means less money from that source or, if you happen to be blacklisted (which is how I discovered this in my mod), part of the game being blocked (and no money from that source).Today, globals are reset when you exit the program (but don't rely on that behavior).