User/Digit Ditko/Detect gender script
< User
Jump to navigation
Jump to search
Detect an Avatars Gender
A new option to the llGetObjectDetails API has been added to allow a script to detect an avatars gender, kind of.
See the full API at llGetObjectDetails for more details
string
getAvatarGender (key inKey)
{
string result = "";
list l = llGetObjectDetails (llGetOwner (), [OBJECT_BODY_SHAPE_TYPE]);
float value = llList2Float (l, 0);
if (value <= 0.0 && value < 1.5)
{
result = "female";
}
else if (value <= 1.5)
{
result = "male";
}
else
{
result = "unknown";
}
return (result);
}
// -----------------------------------------------
default
{
state_entry ()
{
key k = llGetOwner ();
string value = getAvatarGender (k);
llSay (PUBLIC_CHANNEL, "The owners gender is " + value);
}
touch_start (integer inNumTouched)
{
integer i;
for (i = 0; i < inNumTouched; i++)
{
key avatar = llDetectedKey (i);
string name = llKey2Name (avatar);
string value = getAvatarGender (avatar);
llSay (PUBLIC_CHANNEL, "The avatar '" + name + "' has a gender of " + value);
}
}
}