I discovered how to read a person's hair/skin/eye color. It done via a Lua Script. It goes into Text List instance number 0x130, in the Description field, and its name into the main string. This lua script can then be called from BHAV.
If the line in text list is 4, the operands for 7E are as follows: 300105000AFF09000007000007000000
Example, takes nid in param 0, puts colors into Temp 0-2:
Code:
local ngh = CachedNeighbor.new(GetPrimitiveParameter(0));
local hair = ngh:getOutfitProperty(128,0);
local skin = ngh:getOutfitProperty(128,1);
local eyec = ngh:getOutfitProperty(128,2);
SetTemp(0,hair)
SetTemp(1,skin)
SetTemp(2,eyec)
Example, takes nid in param 0, and outfit to be tested in param 1 and property in param 2.
Code:
local ngh = CachedNeighbor.new(GetPrimitiveParameter(0));
local outfit = GetPrimitiveParameter(1)
local prop = GetPrimitiveParameter(2)
local result = ngh:getOutfitProperty(outfit,prop);
SetTemp(0,result)
"Outfit" is one of the graphical flags. Nid doesn't need to be on the lot. The reference of all outfit properties are in ObjectScripts.package / OutfitData. It can retrieve if the person has glasses/hat/jewellery in each outfit category. Exception seems to be custom hair; the person's natural hair color is returned instead. Swim/pajamas/naked may not show jewellery even if it is visible. Sometimes it doesn't reflect glasses/makeup immediately.
It seems that the game has a Bug in the Turn-Ons system (in FreeTime and Mansion .66). If you put on a Jewelry, you get a Lycanthropy trait instead. I have tested this by selecting a Lycanthropy turn-on and observing the attraction changing as jewelry is added and removed.
Another Lua discovery I was looking for: isValidObjectGUID. Tells if a pair of numbers is a valid GUID of an installed object. Better than 20 Test Object Type: works on all expansion packs Open for Business and up, the GUID can be in variables instead of immediate. You can, for example, loop through a list of mod objects to find if they are present. Previously I could only do it by spawning the object, which is slow, logged to disk and could cause unwanted actions.
Code:
local guid1 = GetPrimitiveParameter(0)
local guid2 = GetPrimitiveParameter(1)
local guid = BitShiftLeft(guid2,16)
if(guid1 < 0)
then
guid = guid + 65536 + guid1
else
guid = guid + guid1
end
if(GlobalObjManager:isValidObjectGUID(guid) == true)
then
SetScriptReturnValue(true)
else
SetScriptReturnValue(false)
end