Difference between revisions of "Sims 2 Variables"

From SimsWiki
Jump to: navigation, search
 
(General Variable Reference)
 
(26 intermediate revisions by one user not shown)
Line 9: Line 9:
  
 
==General Variable Reference==
 
==General Variable Reference==
===0x00: My attribute===
 
This variable is very dependant on the current object. Some objects have attributes. The names of these attributes are taken from Text List (STR#) resource 0x00000100 (see [[STR#STR.23|String Resources]] for all the different Text List usages). In the example below, the coffee maker has only one attribute.
 
 
[[Image:ObjectAttributes.JPG|frame|Showing the cross reference between the attribute strings and their use in the Expression Instruction Wizard in SimPE]]
 
<br clear="all"/>
 
===0x01: Stack Object’s attribute===
 
See 0x00: My attribute.
 
===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.
 
===0x03: My===
 
There are lots of fields here that can be used.
 
 
{| class="wikitable"  
 
{| class="wikitable"  
 
|-
 
|-
!Name!!Description
+
!colspan="3" | Variables
 
|-
 
|-
|graphic||This is a number which represents the model or mesh that the object is currently using / made of. For example, love letters are cards when set upon a table, but envelopes when on the floor – two different meshes. The names of these meshes are taken from Text List (STR#) resource 0x00000085 (see [[STR#STR.23|String Resources]] for all the different Text List usages) and this attribute contains the number which points at the correct string.
+
|
 
+
{|class="wikitable"
Of course, in general you don't see '''graphic''' being set-up unless an object has multiple meshes to choose between. This is because the default graphic is used. This is set in the [[OBJD##RAW_Data_-_Resource_cross-refs|OBJD Resource, RAW Data section, Resource cross-refs]]
+
 
+
 
|-
 
|-
|...||
+
|0x00||[[Sims 2 My attribute|My attribute]]
 
|-
 
|-
|direction||
+
|0x01||[[Sims 2 My attribute|Stack Object's attribute]]
 
|-
 
|-
|container id||Some objects must be on or in something, for example, the coffee maker must be on a counter. The counter would be represented by the container id.
+
|0x02||[[Sims 2 My attribute|My (semi) attribute]]
|}
+
===0x04: Stack Object's===
+
See [[variables#0x03: My]].
+
===0x05: Stack Object’s [semi] attribute===
+
See 0x02: My [semi] attribute
+
===0x06: Global===
+
There are lots of fields here that can be used.
+
{| class="wikitable"
+
 
|-
 
|-
!Global Attribute Name!!Details
+
|0x03||[[Sims 2 My|My]]
 
|-
 
|-
|Hour||This is as you would expect. If it is 16:30, Hour has value 16.
+
|0x04||[[Sims 2 My|Stack Object's]]
 
|-
 
|-
|Day of Month||
+
|0x05||[[Sims 2 My attribute|Stack Object's (semi) attribute]]
 
|-
 
|-
|...||
+
|0x06||[[Sims 2 Global|Global]]
 
|-
 
|-
|Game Edition||This allows you to tell what version of the game you are running. It’s a bit field, but also has the value 2000 (0x07D0) to show it is the Base Game Only. The flags are:-<br>01: Not Base only<br>02: University EP (Flag 01 is also set in this case of course)<br>03: Night Life EP<br>04: Open For Business EP<br>05: Family Fun SP<br>06: Glamour Life SP<br>07: Pets EP<br>08: Seasons EP<br>09: Celebration! SP<br>0A: H&M SP<br>0B: Bon Voyage EP<br>0C: TSS (SP?)<br>0D: Store ?<br>0E: Free Time EP<br>0F: Kitchen and Bathroom SP<br>10: IKEA SP
+
|0x07||[[Sims 2 Literal|Literal]]
 
|-
 
|-
|Day of Week||Monday = 0 ... Sunday = 6
+
|0x08||[[Sims 2 Temp|Temp]]
 +
|-
 +
|0x09||[[Sims 2 Param|Param]]
 +
|-
 +
|0x0A||[[Sims 2 Stack Object ID|Stack Object ID]]
 +
|-
 +
|0x0B||[[Sims 2 Temp (temp)|Temp (temp)]]
 +
|-
 +
|0x0C||[[Sims 2 Check tree advert: Range|Check tree advert: Range]]
 +
|-
 +
|0x0D||[[Sims 2 Stack Object's Temp|Stack Object's Temp]]
 +
|-
 +
|0x0E||[[Sims 2 My motive|My motive]]
 +
|-
 +
|0x0F||[[Sims 2 My motive|Stack Object's motive]]
 
|}
 
|}
===0x07: Literal===
+
|
This is how you represent a number.
+
{|class="wikitable"
===0x08: Temp===
+
You can use temporary variables. These are commonly used to return values from other [[BHAV|BHAVs]] since Local variable only live within a [[BHAV]].
+
===0x09: Param===
+
Your Behaviour Function ([[BHAV]]) may have arguments / parameters passed into it. If you use parameters in a BHAV you must remember to set how many. See [[BHAV#Declaring your stack variables]] for details on how to do this.
+
===0x0A: Stack Object ID===
+
This is a short-hand for Stack Object's (0x04) -> object id.
+
===0x0B: Temp [temp]===
+
===0x0C: Check tree advert: Range===
+
===0x0D: Stack Object’s Temp===
+
===0x0E: My motive===
+
This gives you access to all the various motive values.
+
{| class="wikitable"  
+
 
|-
 
|-
!Motive!!Details
+
|0x10||[[Sims 2 My slot|Stack Object's slot]]
 
|-
 
|-
|shopping||
+
|0x11||[[Sims 2 Stack Object’s motive (temp)|Stack Object's motive (temp)]]
 
|-
 
|-
|Scratch/Chew||
+
|0x12||[[Sims 2 My person data|My person data]]
 
|-
 
|-
|Mood||
+
|0x13||[[Sims 2 My person data|Stack Object's person data]]
 
|-
 
|-
|Mood+Mem||
+
|0x14||[[Sims 2 My slot|My slot]]
 
|-
 
|-
|Energy||rowspan="8"|[[Image:Motives.JPG]]
+
|0x15||[[Sims 2 Stack Object's definition|Stack Object's definition]]
 
|-
 
|-
|Comfort
+
|0x16||[[Sims 2 Stack Obj attribute (param)|Stack Obj attribute (param)]]
 
|-
 
|-
|Hunger
+
|0x17||[[Sims 2 room (Temp 0)|room (Temp 0)]]
 
|-
 
|-
|Water/Hygiene
+
|0x18||[[Sims 2 Neighbor in stack object|Neighbor in stack object]]
 
|-
 
|-
|Bladder
+
|0x19||[[Sims 2 Local|Local]]
 
|-
 
|-
|Environment
+
|0x1A||[[Sims 2 Const|Const]]
 
|-
 
|-
|Social
+
|0x1B||Unused
 
|-
 
|-
|Fun
+
|0x1C||[[Sims 2 Check tree advert: Personality variance|Check tree advert: Personality variance]]
 
|-
 
|-
|Sleep State||
+
|0x1D||[[Sims 2 Check tree advert: Minimum|Check tree advert: Minimum]]
 +
|-
 +
|0x1E||[[Sims 2 My person data (temp)|My person data (temp)]]
 +
|-
 +
|0x1F||[[Sims 2 Stack Object's person data (temp)|Stack Object's person data (temp)]]
 
|}
 
|}
===0x0F: Stack Object’s motive===
+
|
See 0x0E: My motive for more details.
+
{|class="wikitable"
===0x10: Stack Object’s slot===
+
===0x11: Stack Object’s motive [temp]===
+
===0x12: My person data===
+
This gives you access to various attributes of a Sim.
+
{| class="wikitable"  
+
 
|-
 
|-
!hex!!dec!!Person Data attribute!!Details
+
|0x20||[[Sims 2 My person data|Neighbor's person data]]
 
|-
 
|-
|0x0000||0||Sitting?||
+
|0x21||
 
|-
 
|-
|0x0001||1||Money Amount over Head||
+
|0x22||
 
|-
 
|-
| || ||...
+
|0x23||
 
|-
 
|-
|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.
+
|0x24||
 
|-
 
|-
|0x001B||27||tick counter
+
|0x25||
 
|-
 
|-
|0x0028||40||route goal
+
|0x26||
 
|-
 
|-
|0x0050||80||ci: Current Interaction Object ID
+
|0x27||
 
|-
 
|-
|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.[[Image:Fitness.JPG]]
+
|0x28||
 
|-
 
|-
|0x0067||103||ci: Current Running Object ID
+
|0x29||
 
|-
 
|-
|0x006B||107||School Object GUID 1||rowspan="2"|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 [[0x001F|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.
+
|0x2A||
 
|-
 
|-
|0x006C||108||School Object GUID 2
+
|0x2B||
 +
|-
 +
|0x2C||
 +
|-
 +
|0x2D||
 +
|-
 +
|0x2E||
 +
|-
 +
|0x2F||
 +
|}
 
|}
 
|}
===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 [[OBJD|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''
 

Latest revision as of 18:48, 11 September 2010

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.

Contents

[edit] 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.

[edit] My

[edit] Stack Object

[edit] General Variable Reference

Variables
0x00 My attribute
0x01 Stack Object's attribute
0x02 My (semi) attribute
0x03 My
0x04 Stack Object's
0x05 Stack Object's (semi) attribute
0x06 Global
0x07 Literal
0x08 Temp
0x09 Param
0x0A Stack Object ID
0x0B Temp (temp)
0x0C Check tree advert: Range
0x0D Stack Object's Temp
0x0E My motive
0x0F Stack Object's motive
0x10 Stack Object's slot
0x11 Stack Object's motive (temp)
0x12 My person data
0x13 Stack Object's person data
0x14 My slot
0x15 Stack Object's definition
0x16 Stack Obj attribute (param)
0x17 room (Temp 0)
0x18 Neighbor in stack object
0x19 Local
0x1A Const
0x1B Unused
0x1C Check tree advert: Personality variance
0x1D Check tree advert: Minimum
0x1E My person data (temp)
0x1F Stack Object's person data (temp)
0x20 Neighbor's person data
0x21
0x22
0x23
0x24
0x25
0x26
0x27
0x28
0x29
0x2A
0x2B
0x2C
0x2D
0x2E
0x2F
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox