Difference between revisions of "LlGetGender"

From Second Life Wiki
Jump to navigation Jump to search
(Avoid confusing agent and avatar)
m (Yeah, they went there. Will test after the RCs roll.)
Line 9: Line 9:
|return_text=the gender of an agent located in the same region the script is running in.
|return_text=the gender of an agent located in the same region the script is running in.
|return_type=string
|return_type=string
|spec
|spec=Note that this feature was added under a different name, see [[OBJECT_BODY_SHAPE_TYPE]].
<source lang="lsl2">
string GetGender(key avatar)
{
    float gender = llList2Float(llGetObjectDetails(avatar, [OBJECT_BODY_SHAPE_TYPE]), 0)
    // In practice this is only expected to return -1.0, 0.0 or 1.0
    if (gender < 0.0) return ""; // agent not found
    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";
}
</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.
**Grid-wide GetGender could be provided via a [[dataserver]] call.
**Grid-wide GetGender could be provided via a [[dataserver]] call.

Revision as of 17:44, 13 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 );
REQUEST Function ID
0.0 Forced Delay
0.0 Energy

Returns a string the gender of 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)
{
    float gender = llList2Float(llGetObjectDetails(avatar, [OBJECT_BODY_SHAPE_TYPE]), 0)
    // In practice this is only expected to return -1.0, 0.0 or 1.0
    if (gender < 0.0) return ""; // agent not found
    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.
All Issues ~ Search JIRA for related Bugs

Examples

Notes

To avoid confusing agent and avatar: It's gender of the avatar, not the user's RL sex. 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

Search JIRA for related Issues

Signature

//function string llGetGender( key avatar );