This page is located on the SimsWiki. To view it in it's original form, click here.
Set to Next
OpCode:0x001F
Game Version:The Sims 2


Contents

Overview

This primitive allows you to cycle through, objects, Pets, Sims, types of things, objects on the same tile as your stack object etc inside the simulation from SimAntics. It is rather like an inbuilt "for loop" of sorts. It has an Instruction wizard to help you use it.

Using the Instruction Wizard

Set to Next Instruction Wizard

The top half of the wizard covers where you are going to assign the next thing as you loop through them all. This should be familiar to you if you have used Expression [prim 0x0002] when you set the assignment operator (:=). The choices are any of the many variables and attributes that are part of SimAntics.

The bottom half of the wizard deals with what you are enumerating. There is a wonderful selection of different things you can cycle through. Most are self-explanatory. Many reference "temp 0" or another variable, and you are expected to set the appropriate value in that variable before calling the Set to Next instruction. After you have done whatever you are going to do with this instance of the enumerated object, you will loop back, i.e. point an instruction back to this one, to get the next object to work on, and you will loop round all of the items. If Set to Next returns False, there are no more objects and your code will now break out of the loop to wherever you point the False Target on this instruction to.

N.B. Some Set To Next varients have a quirk where they will never return False.


Beware of the "Too many iterations" error. If you zero out the variable you are setting before each call to Set to Next, you are effectively starting the for loop again from the top. So, if you see this error, ensure you are not doing this. Also, always make sure if you are starting an enumeration with Set to Next that the variable you are setting is set to Literal 0. if not, you may find you don't even find the first object.


The various types of items that can be enumerated

Set to Next..
object
person
non-person
part of a multi-tile object
object of type
neighbor id
obj with category == param 0
neighbor of type
obj on same tile
obj adjacent to object in (local)
career
Lot ID
obj with category == temp 0
person closest to person in temp 0, distance returned in temp 4, relative direction in temp 5.
Job Obj Instance from Job Obj GUID in sim in stack obj
Job Obj Instance from job obj GUID from neighbor ID in stack obj
vehicle
Neighbor of Family in temp0
Object of type GUID in temp 0/1
Group member of object in temp0
Group member in reverse order of object in temp0
Family member parent (of neighbor ID in temp0)
Family member sibling (of neighbor ID in temp0)
Family member child (of neighbor ID in temp0)
Visible object in my view within distance in temp0
Object in Room in Temp 0
Verify Stack Object
Utility Using Object
Neighbor with non zero var3 relationship to neighbor ID in temp 0
Verify Neighbor ID in Stack Object
Verify Sim in Stack Object
Family member Spouse (of neightbor ID in temp0)
Owner of Object (Object in Temp0, Threshold in Temp1) returns Neighbor ID
Hauntable Object
Object within one tile of object in (local)
NeighborID with an STR value greater than temp 1 to me.
NeighborID with rel var 1 & temp 1
Object With Wants Category equal to Temp 0
influence
Neighbor with no relationship to neighbor ID in temp 0
Sim (pets, humans)
Pet
Dog
Large dog
Small dog
Cat
Sim nID (humans, pets)
Pet nID
Doc nID
Large Dog nID
Small Dog nID
Cat nID


See also