PDA

View Full Version : HasTrait(whatevertrait) vs a Traitname typecast


jtravers88
30th Oct 2010, 02:41 PM
I seem to remember a way to determine this in sims2, but I'm having a brain f$%^ in sims3.

In many cases, a check for a certain trait uses the enums and is easy to see. In others, a typecast to Traitname is performed, on a number like (-5175480303478028976L).

I've followed the HasTrait back thru HasElement and I'm not seeing anything easy.

I guess one way would be to set up a custom HasTrait to pop up a message, only call it for the line of code I need to determine the trait for, then deduce the trait on the sims I get the popup for.

I'm sure there is a better way to do this. And I know one of you guys/gals has a better way.?
Or does this neg # convert to one of the Traitname enums?

Buzzler
30th Oct 2010, 04:09 PM
Or does this neg # convert to one of the Traitname enums?This, but Reflector doesn't know that these values are of an unsigned type. If you look up the TraitNames enum in Reflector, you'll see how the enum elements are related to the numbers. If you want to actually use the ulong values, change Reflector's setting to show numbers in hexadecimal format.

If you simply want to check for a certain trait, I'd recommend using Sim.HasTrait(TraitNames) and the actual enumerator element as parameter instead of the ulong value. Much more intuitive.

jtravers88
30th Oct 2010, 05:03 PM
Sounds like I need to change Reflector to show the ulong values, so I can match them up with the Traitname enums. Thanks.

Edit: Yeap, changed from auto to hex, and matched em up.