9
« on: January 12, 2026, 10:39:32 AM »
The flag array is just a global, and having more than 16 just means making it an actual array so the memory works out. For the original leaked games, that's defined in game.sh but doesn't use any array syntax. Perhaps SC's global handler couldn't do that... but it does allow enum blocks inside of global. Wow. For us commonfolk, it's all in main.sc's local block which is very confusingly named.
The difference being, SC's global block uses a "name number" syntax and needs to initialize any non-zero values on startup, while our local block (which isn't local if it's script 0) is much more flexible: "name", "name = value", "[arrayName size]", and "[arrayName size] = [values]" are all allowed, but we can't say a given global must be this index.
So if you look at the original LSL1, 3, and 5 code's game.sh, you get stuff like this: gameFlags 111 ; bit flags start at 111 and end at 118.
endGameFlags 118 ; This gives a maximum of 128 (8*16) flags.Followed by an enumeration of flag names, split into groups of sixteen. LSL3 helpfully adds the running global number in a comment to the first of each group.
That is, global111 is gameFlags, while global112 to 117 aren't named at all and can only be accessed as [gameFlags i]. This is effectively identical to having [gFlags 8] in an SCI Companion game.
And as such my own game has this in main.sc: [gFlags 14] ;Start of bit set. Room for 14x16 = 224 flags.... which is way more than I need right now.
There's no further setup needed.
So if your flags break the game when you use one too big, you might want to check if your flags global is big enough to fit that many, as you may be clobbering the next global in the list.