Apr 11 2010, 03:25 PM Post #1 | |
Coding like a Rockstar! Posts: 1,468 From: ??? Joined: 28-May 09 | Arrays In San Andreas (and LCS and VCS, but I doubt many really mod that), we have a great new coding ability. Arrays are basically just variables, but they're indexed so we can get through them easily. An example of how the indexing in an array works for a local variable: 0@
Here we can see the array has 8 indexes, as shown by the number to the left. Each index is a variable with another value stored in them. Just like normal variables, they can store the same things inside them, but that is because they are just normal variables. The above list is the same as:
0@ does not contain the values of arrays inside itself, but is the starting point to other variables. Each variable is limited to 4 bytes, so you can only store one 4 byte value in each. All the values above are 4 bytes. There are a few types of arrays. The simplest ones are for global variables: SANNY $var[0] $var[1] $var[2] However these are technically not arrays (as far as I know). Sanny builder just adds them to replace groups of variables, thus making things easier for us to understand. And supported by global and locals: SANNY 0@(11@,10i) $var(2@,40i) The format is as goes: CODE {var}({index},{max}{type}) The {var} is our starting variable, which can be used to go forwards or backwards between variables. The {index} is which offset we want to use. If the variable was 4, the variable would be 4@, as long as the starting var was 0@. The {max} is a number to indicate the maximum amount of indexes that can be used. The {type} indicates what kind of data we are storing to the variables, which lets the game decide how many variables each index should use: CODE f :: float - 4 bytes i :: integer - 4 bytes s :: short string - 8 bytes (or 1 byte per character) v :: long string - 16+ bytes (or 1 byte per character) However, the {type} is pretty pointless for differentiating between integers and floats, since they take up the same size. So you can use either. Sanny actually just adds the f and i as shortcuts to make things simpler, so you don't have to type 0x8. Either way, they compile as 0x8 - Which tells the game we are using a float OR integer array. I'll add more info later... -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |