Difference between revisions of "0x0076"
MogHughson (Talk | contribs) |
MogHughson (Talk | contribs) |
||
Line 15: | Line 15: | ||
<br clear="all"/> | <br clear="all"/> | ||
+ | ==Using the Instruction Wizard== | ||
+ | [[Image:ArrayOperationInstructionWizard.JPG|frame|Array Operation Instruction Wizard]] | ||
+ | This wizard allows you to choose the specific operation to be performed on your array, and to provide a few extra bits of information depending on which operation you are doing. The various different things you may want to do to an array are discussed below. | ||
− | + | Regardless of the operation you are using, you must select whether the array in question is in the object currently known as the [[variables#My|My]] object, or the [[variables#Stack Object|Stack Object]], and you must indicate which array it is since you can have many array. they are represented numerically. | |
− | + | ||
You must remember if you decide to use an array, it belongs to an object and that object must be pre-prepared to hold an array - needs space for it. In order to prepare your object for array operations, you must edit the [[OBJD#RAW_Data_-_Data_Space|OBJD Resource, RAW Data section, Data Space]] to tell the object how many arrays you are going to have. | You must remember if you decide to use an array, it belongs to an object and that object must be pre-prepared to hold an array - needs space for it. In order to prepare your object for array operations, you must edit the [[OBJD#RAW_Data_-_Data_Space|OBJD Resource, RAW Data section, Data Space]] to tell the object how many arrays you are going to have. | ||
+ | <br clear="all"/> | ||
===Empty the array=== | ===Empty the array=== | ||
Revision as of 12:41, 26 December 2009
Array Operation | ||
---|---|---|
OpCode: | 0x0076 | |
Game Version: | The Sims 2 |
Contents |
Overview
In SimAntics you have various different variables to store values in. Sometimes you will have need to store many related values, possibly an unknown number (as you loop round something) and so it is infeasible to code to use Local[0], then Local[1], then Local[2] etc. In times like these you should use an array by using the Array Operations primitive. It has an Instruction wizard to help you use it.
An array can hold many values, each one being able to be directly accessed when it is needed.
In the image we have an array containing four values. We could directly access the 2nd element in the array, Box 1, to find out that its value is 7. When using an array in SimAntics you will use what is known as zero-based indexing. This means that the 1st box is called Box 0. Beware when using zero-based indexing with the size of the array. In our picture the array has a size of 4 but there is not a Box 4.
Using the Instruction Wizard
This wizard allows you to choose the specific operation to be performed on your array, and to provide a few extra bits of information depending on which operation you are doing. The various different things you may want to do to an array are discussed below.
Regardless of the operation you are using, you must select whether the array in question is in the object currently known as the My object, or the Stack Object, and you must indicate which array it is since you can have many array. they are represented numerically.
You must remember if you decide to use an array, it belongs to an object and that object must be pre-prepared to hold an array - needs space for it. In order to prepare your object for array operations, you must edit the OBJD Resource, RAW Data section, Data Space to tell the object how many arrays you are going to have.