Jump to content

Closeness enabled SIT, and only clicking ONE prim


Restless Swords
 Share

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

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

Recommended Posts

I have a 2 prim object, and want to very specifically control sits on it:

1. I only want sit possible/enabled if avatar is within a specified distance

2. I only want sit possible if user clicks prim #1, not clicking sub-link prim #2

I know how to script *TOUCH* restrictions by testing distance to avatar, but

from what I can tell SIT just happens and the only (ugly) option is to unsit

Suggestions ???

 

 

Link to comment
Share on other sites

6 hours ago, Rolig Loon said:

Try using

llSetLinkPrimitiveParamsFast(2,[ PRIM_SCRIPTED_SIT_ONLY, TRUE]);

That should prevent anyone from sitting on link #2 unless your script seats them.

This is the first time I'm seeing that property, I love it!

But what I would suggest more broadly is to apply script-sit for the whole linkset, and only disable it for the intended link when an avatar is within range. This because scripted sitting requires an Experience and you could still sit on #1 from far away otherwise.

Of course, there's the edge-case of some other avatar sitting on the object from afar while any other avatar is close enough (which you can't really prevent pre-sit), but this definitely narrows things down a lot.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

It isn't quite what the OP was asking for, but I set several items in an old RP build so that they couldn't be sat on unless an avatar was within 5 metres and first touched the item. The timer set a sit-position and timed-out after 20 seconds clearing the sit target. The idea was to stop visitors who sat at the arrival point and cammed around the build from then prim-sitting their way into areas.

Link to comment
Share on other sites

To examine if the avatar is within range, something along this when handling touching:

key  id      = llDetectedKey(0);
list details = llGetObjectDetails(id, ([ OBJECT_POS)]));

You then compare the position of the avatar and the position of the sitting object in question.

Ohh, facepalm, you wrote: " I know how to script *TOUCH* restrictions by testing distance to avatar "...  well for others, who may be looking for a solution.

 

Edited by Rachel1206
Link to comment
Share on other sites

8 hours ago, Wulfie Reanimator said:

what I would suggest more broadly is to apply script-sit for the whole linkset, and only disable it for the intended link when an avatar is within range. This because scripted sitting requires an Experience and you could still sit on #1 from far away otherwise.

This is exactly what I would do if I were scripting in an Experience.  It gives you full control over who sits where.  In this particular case, the OP seems to be looking for a somewhat restricted solution.  If I understand correctly, he simply wants to keep people from sitting on link #2 ever.  That's what PRIM_SCRIPTED_SIT_ONLY will do in a non-Experience environment, since you can't force seat someone without an Experience..  He can still use a distance or time limit to control access to link #1, and PRIM_SCRIPTED_SIT_ONLY will make link #2 off limits entirely.

Link to comment
Share on other sites

24 minutes ago, Rolig Loon said:

This is exactly what I would do if I were scripting in an Experience.  It gives you full control over who sits where.  In this particular case, the OP seems to be looking for a somewhat restricted solution.  If I understand correctly, he simply wants to keep people from sitting on link #2 ever.  That's what PRIM_SCRIPTED_SIT_ONLY will do in a non-Experience environment, since you can't force seat someone without an Experience..  He can still use a distance or time limit to control access to link #1, and PRIM_SCRIPTED_SIT_ONLY will make link #2 off limits entirely.

You can't enforce distance limits on #1 until the avatar has already sat though. That is why I would suggest using PRIM_SCRIPTED_SIT_ONLY on #1 as well, and disable it only when an avatar meets the distance condition (through Sensor or something). I wasn't talking about scripting for an experience, in fact I said what I said because you can't sit in any way if we're outside of one.

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

19 minutes ago, Wulfie Reanimator said:

I would suggest using PRIM_SCRIPTED_SIT_ONLY on #1 as well, and disable it only when an avatar meets the distance condition (through Sensor or something).

Good point.  I misunderstood where you were going before.  Yes, that would work nicely.  

Link to comment
Share on other sites

1 hour ago, Wulfie Reanimator said:

You can't enforce distance limits on #1 until the avatar has already sat though. That is why I would suggest using PRIM_SCRIPTED_SIT_ONLY on #1 as well, and disable it only when an avatar meets the distance condition (through Sensor or something). I wasn't talking about scripting for an experience, in fact I said what I said because you can't sit in any way if we're outside of one.

That was my issue I had to deal with, I did initially use sensors but they had to be running all the time, so I opted for a touch-first to get a request to sit, as a result of which, if the range was sufficient, the script set the object to click_action_site and defined the sit-target. On standing up, those conditions were reset. The main drawback to my method was that people entering the sim had to be told this, touch first, then hover and if you get the sit-cursor, sit, otherwise go nearer. Not everybody reads the advice notices.

The new thing I would have definitely made use of, though, I must look it up and see if it has to be in a script in the object all the time, or just putting it in a script briefly gives a prim-persistent condition in the way sit-target does.

Link to comment
Share on other sites

20 hours ago, Wulfie Reanimator said:

But what I would suggest more broadly is to apply script-sit for the whole linkset, and only disable it for the intended link when an avatar is within range

i like this approach

a use case close to OP is when the avatar has to first touch the chair to make it sittable by the toucher only.  Check on touch for distance then enable the sit

another use case with experiences could be: Avatar is in proximity to a chair. They touch to enable sit, then force sit somebody else on the chair

Link to comment
Share on other sites

PARTLY SOLVED (#1) and WORKAROUND (#2):

@Rolig gave the perfect answer to my problem #2 (blocking link sit)

- llSetLinkPrimitiveParamsFast(2,[ PRIM_SCRIPTED_SIT_ONLY, TRUE]);

It looks like there is no direct answer to #1 (closeness limit)

- so, i think i will have to settle with the touch, test distance, and enable sit for 10 secs.

 

  • Like 1
Link to comment
Share on other sites

GROANS...

The #1 solution sounds perfect.  I want folks to be able to sit on prim-1 and not on prim-2, but it isn't working:

        llSitTarget(ZERO_VECTOR, ZERO_ROTATION);
        llLinkSitTarget(1, <0.0, 0.0, OFFSET>,  llEuler2Rot(<0,05*DEG_TO_RAD,0>)   );
        llSetLinkPrimitiveParamsFast(2, [PRIM_SCRIPTED_SIT_ONLY , TRUE  ]);

I cleared any object sit-target, set link-1 sit-target, and blocked link-2 sitting --- but folks can still sit

I previous reversed the 2nd & 3rd lines, but still did not work

        llSitTarget(ZERO_VECTOR, ZERO_ROTATION);
        llSetLinkPrimitiveParamsFast(2, [PRIM_SCRIPTED_SIT_ONLY , TRUE]  );
        llLinkSitTarget(1, <0.0, 0.0, OFFSET>,  llEuler2Rot(<0,05*DEG_TO_RAD,0>)   );

The wiki says this should work even outside an experience (my situation), but does not seem to be

- I assume it is a bug?  but thought I would see if anyone had any observations befoe I opened a JIRA

 

 

Link to comment
Share on other sites

50 minutes ago, Restless Swords said:

GROANS...

The #1 solution sounds perfect.  I want folks to be able to sit on prim-1 and not on prim-2, but it isn't working:

        llSitTarget(ZERO_VECTOR, ZERO_ROTATION);
        llLinkSitTarget(1, <0.0, 0.0, OFFSET>,  llEuler2Rot(<0,05*DEG_TO_RAD,0>)   );
        llSetLinkPrimitiveParamsFast(2, [PRIM_SCRIPTED_SIT_ONLY , TRUE  ]);

I cleared any object sit-target, set link-1 sit-target, and blocked link-2 sitting --- but folks can still sit

I previous reversed the 2nd & 3rd lines, but still did not work

        llSitTarget(ZERO_VECTOR, ZERO_ROTATION);
        llSetLinkPrimitiveParamsFast(2, [PRIM_SCRIPTED_SIT_ONLY , TRUE]  );
        llLinkSitTarget(1, <0.0, 0.0, OFFSET>,  llEuler2Rot(<0,05*DEG_TO_RAD,0>)   );

The wiki says this should work even outside an experience (my situation), but does not seem to be

- I assume it is a bug?  but thought I would see if anyone had any observations befoe I opened a JIRA

Can you be more specific or post the full code?

If you have a sit-target (on link 1), the avatar will always sit on that, regardless of which part of the linkset they right-click on. This is true even if you have a sit-target on link 2 as well. Sitting on link 2 (while it has a target) will put the avatar on sit-target 1, and a second avatar will be unable to sit because "there is no room."

Edited by Wulfie Reanimator
Link to comment
Share on other sites

I found a solution (workaround) to problem #2 (link sit restriction) not working as per the wiki

  1. set PRIM_SCRIPTED_SIT_ONLY on the entire object (not just prim-2)
  2. required user to touch prim-1 to enable its sit (mouse icon changes from TOUCH-HAND to SIT-CHAIR)
  3. user clicks/sits on prim-1 within 5 seconds, after which the object is returned to PRIM_SCRIPTED_SIT_ONLY
  4. and, the touch code includes the solution to problem #1 (closeness requirement) at the same time


state_entry() {
    llSetSitText("Touch");
    llSetClickAction(CLICK_ACTION_TOUCH);
    llSetPrimitiveParams([ PRIM_SCRIPTED_SIT_ONLY , TRUE]);
}
touch_start(integer n) {
    if(llDetectedLinkNumber(0) != 1)
        return;
    vector avatar_pos = llList2Vector( llGetObjectDetails( llDetectedKey(0),[OBJECT_POS]), 0  );
    if( llVecDist(avatar_pos,llGetPos() ) >  2.0) {
        llWhisper(0,"Sorry, you must move closer to use the rope" );
        return;
    }
    llSetPrimitiveParams([ PRIM_SCRIPTED_SIT_ONLY , FALSE]);
    llSetSitText("Slide");
    llSetClickAction(CLICK_ACTION_SIT);
    llSleep(5.0);
    llSetPrimitiveParams([ PRIM_SCRIPTED_SIT_ONLY , TRUE]);
    llSetSitText("Touch");
    llSetClickAction(CLICK_ACTION_TOUCH);
}

 

SHRUGS.  not perfect, but for now it works.  I don't like the requirement for the extra click process, but at least it works regardless of the bug.

- and since it does not do a forced llSitOnLink it does not need to be in an experience

Edited by Restless Swords
clarified works outside of experiences
Link to comment
Share on other sites

1 hour ago, Wulfie Reanimator said:

If you have a sit-target (on link 1), the avatar will always sit on that, regardless of which part of the linkset they right-click on. This is true even if you have a sit-target on link 2 as well. Sitting on link 2 (while it has a target) will put the avatar on sit-target 1, and a second avatar will be unable to sit because "there is no room."

1) yes, but the point of the exercise was to disable *ANY* sit action on the other link (2)

The solution below is ugly but works,  the problem/bug I posted was that this code still allows a sit on prim-2 (even if it ends up on the object sitTarget)

        llSetLinkPrimitiveParamsFast(2, [PRIM_SCRIPTED_SIT_ONLY , TRUE  ]);

The wiki says:

If some other prim in the linkset does have a sit target (that is not filled or marked PRIM_SCRIPTED_SIT_ONLY), the agent can sit on that prim.

2) PS: if my code (in different, multi-sit products) sets a sit-target on link-1, and a different sit-target on link-2, and the user click-sits on link-2 he *DOES* sit on link-2.  I do that all the time in products with multiple sit-targets.

Edited by Restless Swords
clarification on multi-sit products
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1953 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
 Share

×
×
  • Create New...