PDA

View Full Version : Help Needed with Set to Next primitive 0x1F


syberspunk
3rd Apr 2006, 06:13 AM
I did a quick search, and didn't see anything on this yet.

I am trying to use Set to Next to iterate through a sims relatives. I figured that the best way to narrow the search down and avoid the dreaded too many iterations was to use a narrower search to begin with. So I opted for this:

[prim 0x001F] Set to Next (Neighbor with non zero var3 relationship to neighbor ID in temp 0,
result in Stack Object ID,
excluding disabled objects)

Operands:
000000009C0A00000000000000000000

If I understand it correctly, it should return a 'neighboring' sim that has a 'non zero var3 relationship' to the nID that I supply in Temp 0 and stick it in the StO.

As I understand it, this means it should find a sim whose var3 relationship is not zero. Although I'm not quite sure what the var3 relationship is... I am going by examples that I have seen elsewhere (I forget where though... :P).

Anyways. After this, the next line is:


[prim 0x001A] Relationship (var 0x03 ("Familial Relationship") of Stack Object ID to Param 0x0000 ([No TPRP label for BHAV 0x1014 Param 0x0000]),
fail if too small: False,
use neighbor IDs: True,
result in: Temp 0x0000,
don't check presence of second object: False)

Operands:
03020A00000900000800000000000000

So... revisiting this... I have a vague idea of what the line does. I think I understand it as checking the var3 relationship of the StO (which was just set by the Set to Next line) and putting it into T0, failing if it is 'too small' (whatever that means, I'm not sure how 'too small' would be defined... 0? or a negative value?)

Anyways... I would expect that the StO should now be the nID of some neighbor sim that has a non-zero relationship to the nID I supplied previously.

I then use a line to verify that the StO is indeed an nID:

[global 0x014B] Verify - Person ID (1 arg: Neighbor in stack object 0x0000 (person instance id))

Operands:
1800000A00000A00000A000001000000

However... it seems to throw an error on this (according to an error log I received from a user of my mod that contains this code). Unfortunately, I have yet to reproduce this error in my own game. For some reason... the StO is being set to some food object? :confused:

Does this mean that the Set to Next can return Objects instead of sims?

Or am I misusing any of the above lines? I thought that 'Neighbor in stack object' is a way to get back the Object ID if the StO contains an nID? Is this wrong?

If so, then how can I properly get back the Object ID if the StO is an nID?

I'm going to try a couple of things as a temporary fix... perhaps setting the false target of this verify line to loop back to the Set to Next line instead of throwing an error... but I would have expected that the Set to Next should only return neighbors, which I thought was another name for sim objects?

As always, any help will be greatly appreciated. :)

Ste

syberspunk
3rd Apr 2006, 06:59 AM
Thanks atavera for the quick response.

I figured it was something that had to do with nIDs and Object IDs getting confused. At first, I didn't see what the problem could be... but after staring at the code for a while, I noticed that I was using:

Verify - Person ID () instead of Verify - Neighbor ID ()

I am going to try this. I would think that it should work...

What I wonder is... am I just fortunate in my test runs? Is it probably because I test in a virtually 'clean' environment i.e. a fresh install. And thus, since I don't have any effects of long term play, my lots just happen to have objects where the Object ID and nIDs do not conflict/overlap?

This is my guess. Because the mods I have made have been in my game ever since I made them, and I rarely ever run into problems that manage to crop up in other people's games. I'm not saying that the mods are flawless, because they obviously do have bug(s). I just seem to be lucky enough that they don't throw errors in my game? In other words, looking at the code, it makes sense to me now why they would error. What doesn't make sense is why it doesn't seem to happen in my game. :loco:

Anyways... I usually only resort to posting questions as a last minute desperation kinda thing, pretty much after I feel that I've exhausted other avenues (mostly bugging Pescado or others who happen to be in chat :P), and have searched around reasonably enough before my lazy ass actually gives up. Sometimes I just get impatient though. :lol:

Well... I think/hope this should fix the problem now. :rolleyes:

Ste

christianlov
7th Apr 2006, 09:19 PM
[prim 0x001F] Set to Next (Neighbor with non zero var3 relationship to neighbor ID in temp 0,
result in Stack Object ID,
excluding disabled objects)

It's finding a neighbor who has familial relationship with a neighbor whose neighbor id is stored in temp 0. The returned 'stack object id' will be the number of the found neighbor's nID.

You can find many more examples in maxis objects package.

[prim 0x001A] Relationship (var 0x03 ("Familial Relationship") of Stack Object ID to Param 0x0000 ([No TPRP label for BHAV 0x1014 Param 0x0000]),
fail if too small: False,
use neighbor IDs: True,
result in: Temp 0x0000,
don't check presence of second object: False)

It's getting the familial relationship of stack object toward a neighbor whose nID is stored in param 0. The result will be returned in temp 0 and you can compare this number with the global bcon 'famililal relationship' which has several numbers like 'parent', or 'child'. It's similar to asking "Is stack object param 0's parent?" or "Is stack object param 0's grandson?".

[global 0x014B] Verify - Person ID (1 arg: Neighbor in stack object 0x0000 (person instance id))

It's asking whether the neighbor, whose nID is stored in stack object id 0, is on the lot. If it returns true, it means there is a sim who has the same nID on the lot. It false, it means the neighbor isn't on the lot at the moment. It's same with asking if neighbor in stack object id 0(person instance id) is bigger than literal 0. This global will return only true or false, and the stack object won't return a person id. To get a person id after getting true from calling this global, you can simply assign stack object id 0 to neighbor in stack object id 0 or you can search for a sim using set to next and compare its nID.

syberspunk
10th Apr 2006, 06:37 PM
It's finding a neighbor who has familial relationship with a neighbor whose neighbor id is stored in temp 0. The returned 'stack object id' will be the number of the found neighbor's nID.

I just want to be sure I understand this correctly. So the neighbor should be a Sim object, right?


It's asking whether the neighbor, whose nID is stored in stack object id 0, is on the lot. If it returns true, it means there is a sim who has the same nID on the lot. It false, it means the neighbor isn't on the lot at the moment. It's same with asking if neighbor in stack object id 0(person instance id) is bigger than literal 0. This global will return only true or false, and the stack object won't return a person id. To get a person id after getting true from calling this global, you can simply assign stack object id 0 to neighbor in stack object id 0 or you can search for a sim using set to next and compare its nID.

I did not realize that this line actually checks to see if the neighbor is present on the lot. I also just want to make sure I understand what you mean. You are saying that 'Verify - Object ID' checks to see if the parameter that you pass to is present on the current lot?

I only thought that it just checks to 'verify' that the parameter you pass is actualy an Obj ID. In other words, I thought it only makes sure that the 'type' is correct. But... from what you are saying, this check can be used to see if the sim is on the lot, and it should therefore return false if that sim is NOT on the lot, meaning they are NOT visiting (if they are NOT part of the family) or they are 'Off-world' (meaning they are 'At school' or 'At work' if they ARE part of the family). Is my understanding correct?

Or... are 'Off-world' sims still considered On the lot? Even though they may not be selectable or visible... are these sims still considered On the lot, but just hidden?

Also... I just want to be sure I understand what a neighbor is. A neighbor is the nID of a sim, right? In other words, nIDs are only used to reference sims. So... whenever you use a Set to Next with neighbor as the result, it should always be a sim. It should never be an object, right? The nID might coincidentally match the Object ID of some object (non-sim). But the nID itself should be a reference to a sim somewhere in the neighborhood. Right?

Thanks christianlov for your help. I appreciate it. :)

Ste

christianlov
11th Apr 2006, 04:50 PM
I just want to be sure I understand this correctly. So the neighbor should be a Sim object, right?
->
Right. It is a neighbor ID of a person. It is a registered number as a neighbor. But the returned neighbor is not an object all the time, because an object is something which is on the lot.

You are saying that 'Verify - Person ID' checks to see if the parameter that you pass to is present on the current lot?
->
Right. You are checking if parameter is on the lot by calling this global. For example, if you are passing stack object in this global, you are checking if the stack object is on the lot. If you are passing neighbor in stack object 0 in this global, you are checking if the neighbor whose nID stored in stack object 0 is on the lot. Verify - Object id is same too. You are checking if an object is still on the lot. Btw, Maxis kindly included a global called 'verify - neighbor on the lot' since EP2. So it will be more easy to use if you want to check the presence of a neighbor.

I only thought that it just checks to 'verify' that the parameter you pass is actualy an Obj ID.
-> Right. It's checking if an obj of a ceratin parameter is there.

But... from what you are saying, this check can be used to see if the sim is on the lot, and
-> Right.

Or... are 'Off-world' sims still considered On the lot? Even though they may not be selectable or visible... are these sims still considered On the lot, but just hidden?
-> Right. They are still on the lot but their room number is below literal 0.

It should never be an object, right? The nID might coincidentally match the Object ID of some object (non-sim).
-> Right.

But the nID itself should be a reference to a sim somewhere in the neighborhood.
-> Right. If you use this number as a nID, this is a nID. But if you use this number as an obj id, this will be a irrevalent obj.

Btw, when you search for a nID using set to next, I'd like to recommend verifing the returned nID. I mean, sometimes set to next will return nIDs of dead/unlinked sims. So it's better to ask if they are not dead/linked by calling some more globals.