Difference between revisions of "0x001F"

From SimsWiki
Jump to: navigation, search
(Overview)
(The various types of items that can be enumerated)
 
(11 intermediate revisions by one user not shown)
Line 5: Line 5:
 
}}
 
}}
 
==Overview==
 
==Overview==
This [[Primitives|primitive]] allows you to cycle through, objects, Pets, Sims, types of things, objects on the same tile as your stack object etc. Rather like an inbuilt "for loop" of sorts. It has an Instruction wizard to help you use it.
+
This [[Primitives|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==
 
==Using the Instruction Wizard==
 
[[Image:SetToNextInstructionWizard.JPG|frame|Set to Next Instruction Wizard]]
 
[[Image:SetToNextInstructionWizard.JPG|frame|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 [[0x0002|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 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 [[0x0002|Expression [prim 0x0002]]] when you set the assignment operator (:=). The choices are any of the many [[Sims 2 Variables|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.
 
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.
  
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.
+
'''N.B.''' Some Set To Next varients have a quirk where they will [[Set to Next never returning False|never return False]].
 +
 
 +
 
 +
Beware of the "[[Object Errors#7. Too many iterations|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.
  
 
<br clear="all"/>
 
<br clear="all"/>
 +
 
==The various types of items that can be enumerated==
 
==The various types of items that can be enumerated==
 
{| class="wikitable"  
 
{| class="wikitable"  
Line 36: Line 40:
 
|[[neighbor id]]
 
|[[neighbor id]]
 
|-
 
|-
|[[obj with category == param 0]]
+
|[[obj with category|obj with category == param 0]]
 
|-
 
|-
 
|[[neighbor of type]]
 
|[[neighbor of type]]
Line 48: Line 52:
 
|[[Lot ID]]
 
|[[Lot ID]]
 
|-
 
|-
|[[obj with category == temp 0]]
+
|[[obj with category|obj with category == temp 0]]
 
|-
 
|-
 
|[[person closest to person in temp 0, distance returned in temp 4, relative direction in temp 5.]]
 
|[[person closest to person in temp 0, distance returned in temp 4, relative direction in temp 5.]]
Line 58: Line 62:
 
|[[vehicle]]
 
|[[vehicle]]
 
|-
 
|-
|[[Neighbor of Family in temp0]]
+
|[[neighbor id|Neighbor of Family in temp0]]
 
|-
 
|-
|[[Object of type GUID in temp 0/1]]
+
|[[object of type|Object of type GUID in temp 0/1]]
 
|-
 
|-
 
|[[Group member of object in temp0]]
 
|[[Group member of object in temp0]]
Line 103: Line 107:
 
|[[Object With Wants Category equal to Temp 0]]
 
|[[Object With Wants Category equal to Temp 0]]
 
|-
 
|-
|influence [[http://www.modthesims.info/showthread.php?t=319571 Tutorial: Creating a random object in a particular category]]
+
|[[influence]]
 
|-
 
|-
 
|[[Neighbor with no relationship to neighbor ID in temp 0]]
 
|[[Neighbor with no relationship to neighbor ID in temp 0]]
Line 132: Line 136:
 
|}
 
|}
 
|}
 
|}
 +
 +
<br clear="all"/>
 +
 +
==See also==
 +
*[[Primitives]]
 +
*[[SimAntics]]

Latest revision as of 18:43, 11 August 2010

Set to Next
OpCode:0x001F
Game Version:The Sims 2


Contents

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

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


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


[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox