Jump to content

Sit script question


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

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

Recommended Posts

Hello! I am mildly new to scripting in second life. I built a table with benches and I would like to have scripts built into the benches so when people sit down they are facing the table. None of the scripts I'm finding let me permanently change the rotation of that spot, even if I rotate the prim it is attached to, and I'm not finding where rotation can be changed withing the lsl coding. Help, please! 

Link to comment
Share on other sites

If the benches are linked with the table and there's one link element per sitting position, you want to use llLinkSitTarget which specifies position and rotation and all the seats can be specified in a single script -- and indeed those settings become properties of the object and the script doesn't need to keep running.

That's the simplest approach. It gets more tricky if there are fewer links than seating positions. That often leads to a "no room to sit" message and requires that the sitting avatars be moved into position when they sit by setting their positions and rotations as regular elements of the linkset. This, plus the ability to change animations, is the basis of "multi-pose" scripts such as AVsitter, nPose, and others, some free and some commercial products.

Link to comment
Share on other sites

If you can make a prim per sitting area (invisible on your bench) this VERY OLD script will work You would need one in each of the invisible prims (or cushions) on your bench. Rotation is listed at the top of the script.  I have been using it for almost a decade. Came from a class long ago. Free to share. 

 

It may of course be outdated now, but it does still work LOL. Not a script person. AVsitter works great if you want to spend the lindens. This works if you do not. There are no adjustments features of course. 

 

// Sit script
// If object is 0-0-0 rotation the position numbers below are
vector POSITION=<0, -0.05, 0.0>;
vector ROTAT = <0, 0 ,270>;
string animation;

default {
state_entry() {
llSetRemoteScriptAccessPin(-1923474209);

// Sit location
ROTAT *= DEG_TO_RAD;
rotation quat = llEuler2Rot(ROTAT);
llSitTarget(POSITION, quat);
llSetSitText("Meditate");
}

changed(integer change) {
if (change & CHANGED_LINK) {
if (llAvatarOnSitTarget() != NULL_KEY) {
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
} else {
integer perm=llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(animation)>0)
llStopAnimation(animation);
animation="";
}
}
}

run_time_permissions(integer perm) {
if (perm & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation("sit");
animation=llGetInventoryName(INVENTORY_ANIMATION,0);
llStartAnimation(animation);
}
}
}

Link to comment
Share on other sites

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