Deji Posted February 1, 2010 Share Posted February 1, 2010 As far as I know, the bit functions in SA simply set 1 of 32 bits for reading at a later state... Like variables, but restricted to 1 and 0. Why? Why did Rockstar make these and not just use variables? Was it for a case where 32 vars wasn't enough and they needed more only to set a true/false var... And as far as I know, they act like Global Variables, so any thread can read them, but these only carry 1 byte, not 4. Is it simply to save a bit of game memory? Link to comment Share on other sites More sharing options...
NTAuthority Posted February 1, 2010 Share Posted February 1, 2010 Why did Rockstar make these and not just use variables? Was it for a case where 32 vars wasn't enough and they needed more only to set a true/false var... And as far as I know, they act like Global Variables, so any thread can read them, but these only carry 1 byte, not 4. Is it simply to save a bit of game memory? They only contain 1/8th byte. Also, most real-world applications use bitmasks, it's only sad to see how most people doing SA scripting don't have any idea about real software development. It's just a waste of memory to use 4 bytes for a single flag (which would be max 128 bytes for 32 flags) when you can have 32 of them in only 4 bytes. In a single case it might not matter too much, but when you're making a huge table of thousands of entries you will notice the huge space differences soon enough. Also, no, they're not just global variables, you can also use a script-local variable for them. PS: Oddly, I was just thinking about the use of bitmasks and 'oh well, those SA scripters would just think "well, we just use a separate var"' an hour ago Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...