Sims 2 Variables
This section will record all the different variables and attributes you will likely come across. You will most often be using these through the Expression primitive [prim 0x0002]. These tables are your reference to go with that wizard. However you will also find these in various other OpCodes, some without wizards. In those cases, the numeric value before the title name is the number which represents that type of variable to be placed in an appropriate Operand.
Special Variables
There are two special variables which many instructions can only operate on. You will will especially get very used to saving the previous value of the Stack Object in order to put something else in there, then putting back the original value afterwards.
My
Stack Object
General Variable Reference
Variables | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
0x02: My [semi] attribute
This is just as the attributes above, but this time the Text List (STR#) resource defining the attributes is a semi-global instead of a private string resource.
0x05: Stack Object’s [semi] attribute
See 0x02: My [semi] attribute
0x12: My person data
This gives you access to various attributes of a Sim.
hex | dec | Person Data attribute | Details |
---|---|---|---|
0x0000 | 0 | Sitting? | |
0x0001 | 1 | Money Amount over Head | |
... | |||
0x0008 | 8 | Current Outfit | This is the current outfit type, e.g. 0 = Casual. This is not which outfit of that type they are wearing. It does not change if you change outfit within the type. |
0x001B | 27 | tick counter | |
0x0028 | 40 | route goal | |
0x0050 | 80 | ci: Current Interaction Object ID | |
0x0052 | 82 | Fatness [0-1000] | Three ranges, 0 being fat, 1000 being fit. Can be seen as part of your Sims "Personality" page in the game. |
0x0067 | 103 | ci: Current Running Object ID | |
0x006B | 107 | School Object GUID 1 | These two form the upper and lower portions of the GUID for the object that is the School attended by the Sim. Setting these to Temp[0] and Temp[1] and then using the Set to Next [prim 0x001F] with Object of type GUID in temp 0/1 will give you a Stack Object that you can then run call trees against and so on. |
0x006C | 108 | School Object GUID 2 |
0x13: Stack Object’s person data
See 0x12: My person data above for more details.
0x14: My slot
0x15: Stack Object’s definition
This gives you access to the various attributes of an object that you have defined in Object Data (OBJD). If you look at the RAW Data tab in 'Alphabetical' order rather than 'Categorized' order you will see the names in exactly the same order as shown in any instruction wizard.
0x16: Stack Obj attribute [param]
0x17: room [Temp 0]
0x18: Neighbor in stack object
0x19: Local
You can use local variables. If you use local variables in a BHAV you must remember to set how many. See BHAV#Declaring your stack variables for details on how to do this.
and plenty more to come