"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.
Posted by: Ael Oh | July 18, 2007 12:45 PM
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.
Posted by: Dolmere Talamasca
|
July 18, 2007 02:20 PM