Difference between revisions of "LlGetGender"

From Second Life Wiki
Jump to navigation Jump to search
m (Yeah, they went there. Will test after the RCs roll.)
m
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
|sort=GetGender
|sort=GetGender
|p1_type=key|p1_name=avatar|p1_desc=agent UUID
|p1_type=key|p1_name=avatar|p1_desc=agent UUID
|return_text=the gender of an agent located in the same region the script is running in.
|return_text=corresponding to the "female" or "male" setting for the shape currently worn by an agent located in the same region the script is running in.
|return_type=string
|return_type=string
|spec=Note that this feature was added under a different name, see [[OBJECT_BODY_SHAPE_TYPE]].
|spec=Note that this feature was added under a different name, see [[OBJECT_BODY_SHAPE_TYPE]].
Line 13: Line 13:
string GetGender(key avatar)
string GetGender(key avatar)
{
{
     float gender = llList2Float(llGetObjectDetails(avatar, [OBJECT_BODY_SHAPE_TYPE]), 0)
     list details = llGetObjectDetails(avatar, [OBJECT_BODY_SHAPE_TYPE]);
     // In practice this is only expected to return -1.0, 0.0 or 1.0
     if (details == []) return ""; // key not found
     if (gender < 0.0) return ""; // agent not found
    float gender = llList2Float(details, 0);
     if (gender < 0.0)   return "object";
     if (gender == 0.0)  return "female";
     if (gender == 0.0)  return "female";
     if (gender < 0.5)  return "somewhat feminine";
     if (gender < 0.5)  return "somewhat feminine"
     if (gender == 0.5)  return "androgynous";
     if (gender == 0.5)  return "androgynous"
     if (gender < 1.0)  return "somewhat masculine";
     if (gender < 1.0)  return "somewhat masculine"
     return "male";
     return "male";  
}
}
</source>
</source>
|caveats=*Works only for agents recently located in the same region the script is running in.
|caveats=*Works only for agents recently located in the same region the script is running in.
Line 30: Line 32:
|also
|also
|also_functions={{LSL DefineRow||[[llRequestAgentData]]|}}
|also_functions={{LSL DefineRow||[[llRequestAgentData]]|}}
|notes=To avoid confusing agent and avatar: It's gender of the avatar, not the user's RL sex.  
|notes=This function only returns the gender setting on the avatar's currently worn shape, which can change at any time. Avatars do not have a set gender of their own. Information about the user's real life gender is not available.
Very useful for some special kind of products like poseballs and animations, also for attaching or detaching some body parts and access rules in some regions. <br/>
Very useful for some special kind of products like poseballs and animations, also for attaching or detaching some body parts and access rules in some regions. <br/>
Sounds useful indeed, but should probably be agent data you can fetch with [[llRequestAgentData]].}}
Sounds useful indeed, but should probably be agent data you can fetch with [[llRequestAgentData]].}}

Latest revision as of 10:06, 15 April 2015

Emblem-important-yellow.png LSL Feature Request
The described function does not exist. This article is a feature request.

Summary

Function: string llGetGender( key avatar );

Returns a string corresponding to the "female" or "male" setting for the shape currently worn by an agent located in the same region the script is running in.

• key avatar agent UUID

Specification

Note that this feature was added under a different name, see OBJECT_BODY_SHAPE_TYPE.

string GetGender(key avatar)
{
    list details = llGetObjectDetails(avatar, [OBJECT_BODY_SHAPE_TYPE]);
    if (details == []) return ""; // key not found
    float gender = llList2Float(details, 0);
    if (gender < 0.0)   return "object";
    if (gender == 0.0)  return "female";
    if (gender < 0.5)   return "somewhat feminine"
    if (gender == 0.5)  return "androgynous"
    if (gender < 1.0)   return "somewhat masculine"
    return "male"; 
}

Caveats

  • Works only for agents recently located in the same region the script is running in.
    • Grid-wide GetGender could be provided via a dataserver call.

Examples

Notes

This function only returns the gender setting on the avatar's currently worn shape, which can change at any time. Avatars do not have a set gender of their own. Information about the user's real life gender is not available. Very useful for some special kind of products like poseballs and animations, also for attaching or detaching some body parts and access rules in some regions.
Sounds useful indeed, but should probably be agent data you can fetch with llRequestAgentData.

See Also

Functions

•  llRequestAgentData

Deep Notes

Signature

//function string llGetGender( key avatar );