Difference between revisions of "LlAvatarOnSitTarget"
Jump to navigation
Jump to search
All Issues ~ Search JIRA for related Bugs
Line 12: | Line 12: | ||
{ | { | ||
// set sit target, otherwise this will not work | // set sit target, otherwise this will not work | ||
llSitTarget(<0,0,.1>, ZERO_ROTATION); | llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); | ||
} | } | ||
Revision as of 12:39, 9 May 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: key llAvatarOnSitTarget( );239 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
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.
Examples
default { state_entry() { // set sit target, otherwise this will not work llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); } changed(integer chance) { if (change & CHANGED_LINK) { key av = llAvatarOnSitTarget(); if (av) {//evaluated as true if not NULL_KEY or invalid llSay(0, "Hello " + llKey2Name(av) + ", thank you for sitting down"); } } } }
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 )))//is the key valid? if(avatar == linkKey)//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