Jump to content
Sign in to follow this  
Innula Zenovka

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

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

I don't think Strife's snippet applies here.  It will tell you the link number of the avatar but not the link number of the prim s/he's sitting on.  Nice idea, though.

Share this post


Link to post
Share on other sites

Thanks, but that's not really what I'm looking for.

But I've just had a thought .. maybe I'm looking at the wrong event -- because I'll know in the run_time_permissions event when I trigger a certain anim, won't I?  /me runs off to investigate....

Share this post


Link to post
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.)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...