Jump to content

How do I tell when someone's sat on a particular prim?


Innula Zenovka
 Share

You are about to reply to a thread that has been inactive for 91 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I've got several linked prims, each containing a simple script and a different animation.   And, not surprisingly, the appropriate animation plays when I sit on the appropriate prim.

What I'm stuck on is, how do I tell when someone has sat on a particular prim, thus triggering the animation it contains?   As it happens, I know the UUID of the anim, so I guess I can check llGetAnimationList whenver someone sits down, but that seems a very complicated way of doing things.

I can't use  llAvatarOnSitTarget() in the changed event on its own, I don't think, because AIUI that's just going to tell me the last person who sat, no matter prim it was.   I want to know when someone sits on link number n, thus triggering animation such-and-such.   The sim must know, somehow, which child prim someone has sat on, because it sends the right animation to the viewer.   But I can't figure out  how my script can find out -- which frequently means it's simple really but I've missed someting basic.

Link to comment
Share on other sites

Thinking quickly here, so probably not with great clarity .... When a person sits, you must have a llStartAnimation function that fires the right animation. Can you follow that immediately with a linked message that says "I did it!", naming the prim that was sat upon?  Since you know which anim was in which prim, there ought to be a way to connect link number with animation name.

Link to comment
Share on other sites

you can always cheat and hard code the position.... sit on the target prim, find the avatar, get their key, and their position, compare their position to a list of positions and you'll know exactly which prim was sat upon (you'll want to record the positions by script in advance, they may not match perfectly to inworld reported position for the av.)

Link to comment
Share on other sites

Thanks, everyone.. I've managed -- I think -- to get it working for my purposes by grabbing the avatar's key in the run_time_permissions event and also following up Thex's suggestion, which provides me with a neat way to find out when that particular spot is unoccupied again.

It's for an RP item that can seat several people, but I'm only really interested in one of the seats because when someone sits on that is when the fun really starts and my special effects start to happen.

Link to comment
Share on other sites

  • 11 years later...

I wish that Innula had provided more detail on how she could tell what avatar was sitting on a particular prim , because that is a problem that I am also trying to solve.  By looking at Thex's link, I can't figure out what that neat way might have been.

Link to comment
Share on other sites

I can't help with what Innula decided on, but the simplest way to do what you want to do is to call llAvatarOnLinkSitTarget for the particular child number. If it doesn't return NULL_KEY then you have found an avatar on that particular prim.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 91 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...