GetHairColor
From GECK
A function added by the New Vegas Script Extender.
Contents
Description
Returns the specified RGB int value (0=All, 1=Red, 2=Green, 3=Blue) for the specified NPC or calling reference.
Syntax
(int) Actor.GetHairColor ColorCode:int Actor:NPC
Example
int HairRedValue let HairRedValue := SunnyREF.GetHairColor 1
Note
The number returned by GetHairColor 0, ie what one would expect to be the full RGB value, is a 7-digit decimal representation of a 6-digit hexadecimal number. This in turn is a concat of 3 separate 2-digit hex numbers, each representing a color - ordered blue, green, red (BGR). It's this way in the vanilla game as well. To convert the result of GetHairColor 0 to separate integers between 0 and 255 for each color, you have to convert it to hex and re-convert the three 2-digit hex numbers back to decimal:
let iResult := someRef.GetHairColor 0 let svHex := NumToHex iResult, 6 let iBlue := ToNumber svHex[0:1], 1 let iGreen := ToNumber svHex[2:3], 1 let iRed := ToNumber svHex[4:5], 1