Jump to content
You are about to reply to a thread that has been inactive for 1535 days.

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

Recommended Posts

Posted

If the object has a sit target, the first avatar to sit gets to use it and subsequent avatars don't. So the first avatar to sit is the one who's key is returned by llAvatarOnSitTarget.

So, whenever the changed event is triggered with the CHANGED_LINK bit set in the changes parameter you can loop through the links and use llGetAgentSize to check if it's an avatar, and if it is then check if it's the avatar on the sit target. If it isn't you can use llUnSit to unsit them.

Seated avatars are given link numbers that count up from the highest link number (unlike additional prims that are linked to an existing object which are inserted as link number 2, with all the others being bumped up). Thus when you scan the link set you can start with the highest link and work back to the avatar on the sit target. llGetNumberOfPrims will tell you where to start the loop if you count backwards (counting forwards can run into the problem of the number of links reducing as unwanted avatars are unseated).

I'm tired and I'm not in-world to check what I've just written, so I may be going wrong somewhere, but I think I'm making sense here.

Posted (edited)

Maybe the easiest way is to use llGetObjectDetails.

integer iSitCount = llList2Integer(llGetObjectDetails(llGetKey(),[OBJECT_SIT_COUNT]), 0);

then

if (iSitCount > 1)
{
     llUnSit(llGetNumberOfPrims());
}

That would work, since the last person to sit down is always the most recent link to be added to the linkset.  If necessary, you can repeat the test to see if there's yet another person on the object.

You could also put this entire test in a changed event, to be triggered if (change & CHANGED_LINK)

Edited by Rolig Loon
  • Like 1
Posted

a way with Rolig's suggested method

if (change & CHANGED_LINK)
{
   if (llList2Integer(llGetObjectDetails(llGetKey(),[OBJECT_SIT_COUNT]), 0) > 1)
   {
      // unsit the last person to sit
      llUnSit(llGetLinkKey(llGetNumberOfPrims()));
   }
}

 

  • Thanks 1
Posted
20 minutes ago, KT Kingsley said:

But llUnSit needs the key of the avatar being unseated, not the link number.

Yeah, oops.  And thank you, Molly.  My brain wasn't quite where I thought it was.

  • Like 1
Posted

OK. This is VERY Simplistic and I am not a script person by any means but if you use AVsitter (now free) and only have one person sit, no one else can sit.   When they try they get bounced off. Not sure if that is what you are after. A little unclear for me, but throwing that into the mix. 

 

This for @Leo1452 obviously :D.  

 

 

Posted
8 minutes ago, Rolig Loon said:

Yeah, oops.  And thank you, Molly.  My brain wasn't quite where I thought it was.

i think there might be something in the ether as my own brains fell out yesterday on another post 😺

  • Like 1
Posted

To merely prevent multiple sitters (as opposed to unseating them), I've used something like this:

default
{
    state_entry()
    {   // just make it easy to test:
        llSetLinkPrimitiveParamsFast(LINK_SET, 
            [ PRIM_SIT_TARGET, TRUE, <0, 0, 0.5>, ZERO_ROTATION
            , PRIM_SCRIPTED_SIT_ONLY, FALSE
            ]);
    }
    changed(integer change)
    {
        if (CHANGED_LINK & change)
            if (ZERO_VECTOR != llGetAgentSize(llGetLinkKey(llGetNumberOfPrims())))
                llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_SCRIPTED_SIT_ONLY, TRUE]);
            else
                llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_SCRIPTED_SIT_ONLY, FALSE]);
    }
}

(That state_entry is totally disposable; it just sets up a linkset to demo the function.)

  • Like 5
You are about to reply to a thread that has been inactive for 1535 days.

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...