Difference between revisions of "LlAvatarOnSitTarget"

From Second Life Wiki
Jump to navigation Jump to search
Line 7: Line 7:
|spec
|spec
|examples
|examples
|helpers
|helpers=<pre>
//Gets the link number of a seated avatar
integer GetAgentLinkNumber(key avatar)
{
    integer linkNum = 1 + llGetNumberOfPrims();
    key linkKey;
    //Next we get the linkKey and make sure it's not null, if it's null we are done.
    while((linkKey = llGetLinkKey( --linkNum )))
        if(avatar == linkKey)//It's an avatar, is it the avatar we want?
            return linkNum;//It's the avatar we want so return.
    //avatar wasn't found so return a number that isn't a LINK_* flag that can't be a valid link number either.
    return 0x7FFFFFFF;//max int.
}//Written by Strife Onizuka
</pre>
|related
|related
|also_tests
|also_tests

Revision as of 13:21, 28 April 2007

Summary

Function: key llAvatarOnSitTarget( );

Returns a key that is the key of the user seated on the prim.

If the prim lacks a sit target or there is no avatar sitting on the prim, then NULL_KEY is returned.

Caveats

If the prim lacks a sit target or the avatar is seated upon a different prim, the only way to determin how many and which avatars are seated upon the object is to scan the link set.

All Issues ~ Search JIRA for related Bugs

Examples

Useful Snippets

//Gets the link number of a seated avatar
integer GetAgentLinkNumber(key avatar)
{
    integer linkNum = 1 + llGetNumberOfPrims();
    key linkKey;
    //Next we get the linkKey and make sure it's not null, if it's null we are done.
    while((linkKey = llGetLinkKey( --linkNum )))
        if(avatar == linkKey)//It's an avatar, is it the avatar we want?
            return linkNum;//It's the avatar we want so return.
    //avatar wasn't found so return a number that isn't a LINK_* flag that can't be a valid link number either.
    return 0x7FFFFFFF;//max int.
}//Written by Strife Onizuka

See Also

Events

•  changed

Functions

•  llSitTarget

Deep Notes

Search JIRA for related Issues

Signature

function key llAvatarOnSitTarget();