More Awesome Than You!
Welcome, Guest. Please login or register.
2019 September 21, 14:07:28

Login with username, password and session length
Search:     Advanced search
539949 Posts in 18022 Topics by 7840 Members
Latest Member: bobobrains
* Home Help Search Login Register
+  More Awesome Than You!
|-+  The Bowels of Trogdor
| |-+  The Small Intestines of Trogdor
| | |-+  neighbor ID - why does EAxis code always do 'instance id' check?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] THANKS THIS IS GREAT Print
Author Topic: neighbor ID - why does EAxis code always do 'instance id' check?  (Read 5041 times)
tunaisafish
Axe Murderer
Exasperating Eyesore
*
Posts: 245



View Profile
neighbor ID - why does EAxis code always do 'instance id' check?
« on: 2008 October 10, 04:07:56 »
THANKS THIS IS GREAT

You can see these checks in the wants 'CT- Test' BHAV's.

These BHAV's are passed a nID which gets assigned to the Stack Ob., then the check...
[prim 0x0002] Expression (Neighbor in stack object 0x0000 (person instance id) > Literal 0x0000)

If this is true, I'm assuming this means that it contains a valid Object ID of the sim on the current lot.
This Object ID is assigned to the stack object, and the Stack Obects person data is read/written to.

If it is false, then they use Neighbor's person data instead.

I can understand the reason for this in BHAV's such as 'CT - Generic Test - Max Enthusiasm?', as using the Object ID allows you to use a local variable to index into the person data array.  ie. it is a speed optimization.
But if you only want to access a single value in the array, is there a reason why just using the nID is wrong if the instance id is true?

The only other reason I can think of is that the Object ID of the sim is a copy of the nID.  ie. it will contain the most up to date info, and will be written back when the sim leaves the lot or user saves the game.
Logged

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26206



View Profile
Re: neighbor ID - why does EAxis code always do 'instance id' check?
« Reply #1 on: 2008 October 10, 04:21:21 »
THANKS THIS IS GREAT

The only other reason I can think of is that the Object ID of the sim is a copy of the nID.  ie. it will contain the most up to date info, and will be written back when the sim leaves the lot or user saves the game.
This is exactly it: If you use "Neighbor's Persondata", it will not return the most up-to-date information. This is particularly pertinent with information that may be subject to change while a sim is on the lot. It is somewhat less necessary, but still good practice, if the information is extremely unlikely to change: A sim's gender is probably a safe attribute to just read from neighbor's persondata without checking for instantiation, because there is nothing in the game that can really change this. Things like skills, enthusiasms, and soforth, however, *ARE* easily subject to change during gameplay and as such you should check to make sure the sim is not already present and possibly altering those attributes.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.123 seconds with 19 queries.