Difference between revisions of "0x0002"

From SimsWiki
Jump to: navigation, search
(Auto-inserted from WakkaWikki)
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{OldWikiEntry}} ==Expression==
 
 
 
For those familiar with TS1 modding, there is nothing new here. This page is designed primarily for the newcomer who does not have any previous experience with SimAntics.
 
For those familiar with TS1 modding, there is nothing new here. This page is designed primarily for the newcomer who does not have any previous experience with SimAntics.
  
 +
==Overview==
 
This is by far the most used BHAV operation and, therefore, one of the first an aspiring behavioral modder should learn.
 
This is by far the most used BHAV operation and, therefore, one of the first an aspiring behavioral modder should learn.
 
At its heart, Expression is a fairly simple instruction, taking two items and performing a logical comparison or mathematical calculation with them.
 
At its heart, Expression is a fairly simple instruction, taking two items and performing a logical comparison or mathematical calculation with them.
  
 +
==Structure==
 
The structure (with the exception of the as yet unknown bytes) is also fairly simple. We will use the following example instruction to explore the structure further:
 
The structure (with the exception of the as yet unknown bytes) is also fairly simple. We will use the following example instruction to explore the structure further:
  
OpCode, Tru, Fal, Flag, op1, op2, op3, op4, op5, op6, op7, op8, un1, un2, un3, un4, un5, un6, un7, un8
+
aa, aa, bb, bb, ??, oo, AA, BB
----
+
  xx, xx, xx, xx, xx, xx, xx, xx
0x0002, 2, Err,   00, 00, 00, 00, 00, 00,  05,  19,  09,  00,  00,  00,  00,  00,  00,  00,  00
+
  
The True and False lines are the same as in any other instruction, so we can ignore them for now.
+
Example:
The Flag is still not fully understood, so we will not be discussing it either.
+
The 8 Unknown bytes (un1 - un8) will also not be discussed as they do not appear to be used directly by the 0x0002 instruction.
+
  
This only leaves us with the 8 ops (op1 - op8), which break down as follows:
+
00, 00, 00, 00, 00, 05, 19, 09
 +
00, 00, 00, 00, 00, 00, 00, 00
  
op6 is the [[Operator]], which tells the game which mathematical/logical operation to perform
+
;xx
op7 is the first (or left-side) [[Operand]]
+
:''unused''
op8 is the second (or right-side) [[Operand]]
+
;oo
op1 and op2 are read together as a single little-endian short. It is an argument for the first Operand
+
:the [[Operator]], which tells the game which mathematical/logical operation to perform
op3 and op4 are read together as a single little-endian short. It is an argument for the second Operand
+
;AA
op5 was never completely understood in TS1. Either it is some type of flag or is unused.
+
:the first (or left-side) [[Operand]]
 +
;aa
 +
:argument for the first operand
 +
;BB
 +
:the second (or right-side) [[Operand]]
 +
;bb
 +
:argument for the second Operand
 +
;??
 +
:was never completely understood in TS1. Either it is some type of flag or is unused.
  
 
So in our example instruction:
 
So in our example instruction:
the Operator is 05 (Assign To:)
+
*the Operator is 0x05 (assign to)
the first Operand is 19 (Local Variable)
+
*the first Operand is 0x19 (local variable)
which has an argument of 00 (numeric 0)
+
*which has an argument of 0x00 (numeric 0)
the second Operand is 09 (Parameters)
+
*the second Operand is 0x09 (parameter)
which has an argument of 00 (numeric 0)
+
*which has an argument of 0x00 (numeric 0)
 +
 
 +
Our instruction would therefore be read as "local variable 0x0 := parameter 0x0".
 +
In simpler terms, this means "the value for local variable 0x0 := the value listed in parameter 0x0"
 +
 
 +
=See also=
 +
*[[Primitives]]
 +
*[[SimAntics]]
 +
 
 +
{{OldWikiEntryCleaned}}
  
Our instruction would therefore be read as "Local Variable 0 Assign To: Parameters 0".
+
[[Category:Sims 2 Modding]]
In simple terms, this means "the value for Local Variable 0 = the value listed in Parameter 0"
+
[[Category:Primitives|{{PAGENAME}}]]
[[Category:Modding]]
+

Latest revision as of 17:24, 17 September 2012

For those familiar with TS1 modding, there is nothing new here. This page is designed primarily for the newcomer who does not have any previous experience with SimAntics.

[edit] Overview

This is by far the most used BHAV operation and, therefore, one of the first an aspiring behavioral modder should learn. At its heart, Expression is a fairly simple instruction, taking two items and performing a logical comparison or mathematical calculation with them.

[edit] Structure

The structure (with the exception of the as yet unknown bytes) is also fairly simple. We will use the following example instruction to explore the structure further:

aa, aa, bb, bb, ??, oo, AA, BB
xx, xx, xx, xx, xx, xx, xx, xx

Example:

00, 00, 00, 00, 00, 05, 19, 09
00, 00, 00, 00, 00, 00, 00, 00 
xx
unused
oo
the Operator, which tells the game which mathematical/logical operation to perform
AA
the first (or left-side) Operand
aa
argument for the first operand
BB
the second (or right-side) Operand
bb
argument for the second Operand
??
was never completely understood in TS1. Either it is some type of flag or is unused.

So in our example instruction:

  • the Operator is 0x05 (assign to)
  • the first Operand is 0x19 (local variable)
  • which has an argument of 0x00 (numeric 0)
  • the second Operand is 0x09 (parameter)
  • which has an argument of 0x00 (numeric 0)

Our instruction would therefore be read as "local variable 0x0 := parameter 0x0". In simpler terms, this means "the value for local variable 0x0 := the value listed in parameter 0x0"

[edit] See also

This article is imported from the old MTS2 wiki. It's original page, with comments, can be found at http://old_wiki.modthesims2.com/0x0002

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox