0x0076

From SimsWiki
Revision as of 18:20, 26 December 2009 by MogHughson (Talk | contribs)

Jump to: navigation, search
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.

Pictorial representation of an array

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.


Operations

There are various things you will want to do to an array which we will cover in this section.

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.

Empty the array

Find out the size of the array

Put something into the array

Read something out of the array

See also

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox