Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

detecting WHO right-clicks

Andurant Proudfoot
Registered User
Join date: 11 Jul 2004
Posts: 27
04-27-2005 14:53
Lend an assist to a slightly higher than newbie but totally confused scripter, would you?

I need to determine the Key or Name of the AV who right-clicks an object containing my script and uses the "sit" operation.

I can detect this from touch_start easy enough using llDetectKey(), but that's not the event (apparently) triggered with a right-click: that processing seems to occur in state_entry.

sounds simple enough, but I'm stuck: Anyone got any ideas or info for me?

Thanks
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
04-27-2005 17:17
What you are looking for is the changed event, particularly the CHANGED_LINK type and example script on that wiki page.
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
04-27-2005 19:24
To do this, the object will need a sit target.

Malachi is right, this will happen in the changed() event, becasue an avatar sitting on an object is actually linking to it. And if that object has a sit target, you can use llAvatarOnSitTarget() to get his or her key:

CODE
changed(integer change) // something changed about this object
{
if (change & CHANGED_LINK) // and it was a link change, so...
{
key avatar = llAvatarOnSitTarget(); // Get the key of an av on the sit target
if (avatar != NULL_KEY) // Not NULL = there's an avatar there
{
llSay(0, "I dare say, " + llKey2Name(avatar) + " has sat opon me!");
}
}
}
_____________________