« Religion is Broadly Offensive | Main | Do You Ever Ego Surf? »

"No Sit" Script

Sometimes when you're building an object with multiple prims you want some of them to allow an avatar to sit down while other linked prims should reject a sit request.

The way the sit system works is link order. When you choose to sit on an object in general the actual prim whose surface you sit on is chosen based upon the order in which the prims were added to the link set (shift clicked) when it was linked - the link order.

Let's say you have made a bench. Let's say that the bench has about 6 prims - two for legs, one for the bench surface and the remainder as cushy seats. You probably want 3 people to be able to sit here, on the three cushy seat prims. If you do no scriping it's possible that people can sit on any of the 6 prims if they accidentally right click the wrong part of your object or even if the link order is not what you wanted.

One little hack I found along the way, other than to llUnsit(key avatar) on the sit event for the wrong prim, is to set the prim's sit target to something senseless. When an avatar tries to sit on the wrong prim the event fails and instead is passed on to the rest of the object in its standard link order. If there is another prim in the standard link order that can take the sit event then that prim handles the sit request instead. This way the avatar gets to sit down somewhere rather than either being told that there is no appropriate surface to sit on, standing right back up, or not even seeing a sit option in the pie menu.

Just copy the following "No Sit" script into the prims of your object which should not allow avatars to sit to make your object that much more user friendly.

Thoughts? Concerns? See the comments system on this page.


default
{
// set sit position to something stupid so we're ignored in seat selection lineup
state_entry()
{
vector sittingPosition = <0,0,0>;
vector eul = <0, 0, 0>;
eul *= DEG_TO_RAD; //convert to radians
llSitTarget(sittingPosition,llEuler2Rot(eul));
}

//on_rez - launches whenever the object is rezzed
on_rez(integer times)
{
llResetScript();
}
}

Comments

I tried this and it didn't work? My avatar did a lovely dance around once, and another time sat on the object. Perhaps because I was putting it into a sculpted prim.

Ael - I've not tried scripting sculpties yet. Also this script is for multi prim objects - I've not tested it with a single prim object. It's not saying "you can't sit here" it's saying "here's this stupid place to sit" which should let the prim reject it and send the request down the link chain.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Recent Comments

Melynn said: The purple/pink guitar is in small pieces now, so it's a toad-ily mute point anyway. :) That's even more amusing.…

Crap Mariner said: You know, it would be amusing to have the equivalent of a Turing Test to see if people could figure out if a stream of chat is actually from me or if it's from …

Dolmere Talamasca said: One might note that the JIRA bug now has 650 votes for it. Keep 'em coming people, it's easy to login and add your vote if you think something like this is need…

Dolmere Talamasca said: Interesting way of looking at it, Vint. I would think more PA than PS but unpaid labor is still unpaid labor.…

Dolmere Talamasca said: Instead of the typing animation use "UISndTyping" and clear the field to accomplish the closest thing to what I'm looking for (As noted by Jacek at Crap Mariner said: *shrug* Got time to hit the tower on Monday with Cyl and SUPRISE SPECIAL GUEST? Not sure which song... um... Rainbow Connection would be cool basstasstically…