Simple sit script?
|
Grace Cuthbertsson
Registered User
Join date: 1 Aug 2009
Posts: 41
|
11-19-2009 06:44
Without any script in my furniture, I can sit on the object but it seems to be a standard sit pose with both feet on the floor and both hands on the knees. I wanted to have a crossed leg script and found a freebie on xStreet, but after I put the script in the contents of the piece of furniture, nothing happened. When I right click the furniture and choose "sit here," my avatar sits in that standard sit pose and not in a crossed leg sit pose. Do I need to add something to the code? I thought it was automatic. I do see that the code says something about a sit target. Do I have to put in coordinates for each and every piece of furniture? What do I do if I move the furniture? Must I change those coordinates? I do not understand how scripts work, that is why I need to find freebies. BTW, here is the script below that I tried to use. Can anyone tell me what is wrong? Thanks so much! //script for sitting cross legged on an object //by Ananda Sandgrain - free to distribute but please don't sell! key avatar; vector pos = <-0.25,0,0.8>; //adjust the position to fit object -must be //nonzero in at least one direction or script will not work! rotation rot = <0,0,0,1>; //adjust rotation (1 in any vector gives 90 deg) default { state_entry() { llSitTarget(pos, rot); } changed(integer change) { avatar = llAvatarOnSitTarget(); if(change & CHANGED_LINK) { if(avatar == NULL_KEY) { // You have gotten off llStopAnimation("sit_ground"  ; llReleaseControls(); llResetScript(); } else if(avatar == llAvatarOnSitTarget()) { // You have gotten on llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION ); } } } run_time_permissions(integer perms) { if(perms) { llStopAnimation("sit"  ; llStartAnimation("sit_ground"  ; } else { llUnSit(avatar); } } }
_____________________
Blessings,
Grace Cuthbertsson ______________________
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life." (John 3:16, NIV)
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
11-19-2009 07:08
The script isn't what's doing the work (other than recognizing that someone has sat down or stood up). This is a generic sit script. The work is done by the sit pose identified in the script. In this case, it's a standard SL pose named "sit_ground" that we all have access to through SL's servers. That's not a cross-legged sitting pose, it's the one that SL uses by default if you sit on the turf (as opposed to sitting on an object). If you want to sit cross-legged on a chair or a box, then you need to find or create a new pose that does that. Put it in inventory along with this script, and change the word "sit_ground" in the script to whatever the name of that new pose is.
As for adjusting the sit target ...... that's what the second line in the script is for. The vector named "pos" defines where you sit, relative to the center of the object that contains the script. So right now it says, "Sit 0.25m behind the center and 0.8 m above the center of the object." If you put the script directly in a piece of furniture, you will have to fiddle with those numbers experimentally to make it so you sit in the proper place. Many people find it a lot easier to put the script in a pose ball instead and simply move the poseball instead of messing with the vector in the script.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Grace Cuthbertsson
Registered User
Join date: 1 Aug 2009
Posts: 41
|
11-19-2009 07:45
Thank you for your reply. This is all too complicated for me.
I have a seat cushion that I want to copy and use in church pews, four to a pew. Within the seat cushion, I need a simple sit pose. If anyone can help me inworld to put the animation, pose, script, or whatever in the seat cushion, I will be glad to pay whatever is reasonable for your time.
Thanks so much.
Grace
_____________________
Blessings,
Grace Cuthbertsson ______________________
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life." (John 3:16, NIV)
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
11-19-2009 08:09
This is really a forum for people who want to learn how to script on their own, or to share what they have learned. You might try posting in the Services Wanted forum or simply looking for ready-made cushions that fit your needs. Not to push a particular vendor, but I have found some very nice cushions and other objects animated for sitting at Pillow Talk ( http://slurl.com/secondlife/Pillow%20Talk/125/134/216). Good luck. ETA: Grace, here's another simple thing you might try ....... Take that little script you posted and replace the word "sit_ground" in the two places it appears with "sit_female". It's another one of the default SL poses that's always there for you to use. It isn't a cross-legged sit, but it's more feminine than the basic "sit" pose. Give it a try.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Grace Cuthbertsson
Registered User
Join date: 1 Aug 2009
Posts: 41
|
11-19-2009 08:38
From: Rolig Loon This is really a forum for people who want to learn how to script on their own, or to share what they have learned. You might try posting in the Services Wanted forum or simply looking for ready-made cushions that fit your needs. Not to push a particular vendor, but I have found some very nice cushions and other objects animated for sitting at Pillow Talk ( http://slurl.com/secondlife/Pillow%20Talk/125/134/216). Good luck. ETA: Grace, here's another simple thing you might try ....... Take that little script you posted and replace the word "sit_ground" in the two places it appears with "sit_female". It's another one of the default SL poses that's always there for you to use. It isn't a cross-legged sit, but it's more feminine than the basic "sit" pose. Give it a try. Thanks, Rolig. I didn't realize this was the wrong forum.... sorry. I'll try your suggestion, and if I still have problems, I'll post to the service wanted forum. 
_____________________
Blessings,
Grace Cuthbertsson ______________________
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life." (John 3:16, NIV)
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
11-19-2009 09:43
Give this a try, Grace. It's your script only slightly modified so it will use any animation you choose to put in the prim's inventory (if there isn't one there, it will use the sit_female pose Rollig suggests). You will probably need to alter the stuff about vector pos and rotation rot, up at the top, to get the positioning right, but that's all that should need changing. key avatar; vector pos = <-0.25,0,0.8>; //adjust the position to fit object -must be //nonzero in at least one direction or script will not work! rotation rot = <0,0,0,1>; //adjust rotation (1 in any vector gives 90 deg) string anim; default { state_entry() { anim = llGetInventoryName(INVENTORY_ANIMATION,0);// use the first animation in my inventory if(llGetInventoryType(anim)!=INVENTORY_ANIMATION){//if there isn't one there anim = "sit_female"; // then use the default sit_female } llSitTarget(pos, rot); } changed(integer change) { avatar = llAvatarOnSitTarget(); if(change & CHANGED_LINK) { if(avatar == NULL_KEY) { // You have gotten off if(llGetPermissions()&PERMISSION_TRIGGER_ANIMATION){//doesn't hurt to check llStopAnimation(anim); } } else if(avatar == llAvatarOnSitTarget()) { // You have gotten on llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION ); } } else if(change&CHANGED_INVENTORY){//if the animation is changed llResetScript(); // reset the script to read the new name } } run_time_permissions(integer perms) { if(perms&PERMISSION_TRIGGER_ANIMATION) { llStopAnimation("sit"); llStartAnimation(anim); } else // not sure why this is here,but it does no harm { llUnSit(avatar); } } }
|
Grace Cuthbertsson
Registered User
Join date: 1 Aug 2009
Posts: 41
|
11-19-2009 09:56
Thank you all so much for your help!  God bless you, Grace
_____________________
Blessings,
Grace Cuthbertsson ______________________
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life." (John 3:16, NIV)
|
Lennard Denver
Registered User
Join date: 20 Jun 2009
Posts: 9
|
11-19-2009 12:16
You will probably need to correct the sittarget. On Xstreetsl you can find "Sit Target Helper" for free. This tool generates the complete sit script for you.
|
Grace Cuthbertsson
Registered User
Join date: 1 Aug 2009
Posts: 41
|
11-19-2009 13:28
I used a sit target and found a sit pose that I like. After following the instructions, I clicked the seat cushion and then clicked "sit here." It worked to a point. My avatar was in the sitting position, but up in the air instead of on the cushion. What have I done wrong?
Thanks
_____________________
Blessings,
Grace Cuthbertsson ______________________
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life." (John 3:16, NIV)
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
11-19-2009 13:42
Something sounds to have gone wrong with the z vector (the last number) in the vector pos = < something,something,something > ;
Those numbers are just the offset, in meters, from the centre of the cushion. So if you're happy with the rest of it, just reduce the z vector by whatever seems appropriate.
|
Lennard Denver
Registered User
Join date: 20 Jun 2009
Posts: 9
|
11-19-2009 15:13
Just work some more with Sit Target Helper. It works fine. You only need some more experience
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
11-19-2009 15:37
Or you simply need to change the last number in pos = < something, something something> to pos = < something, something, somethingsmaller>. You've obviously been able to open the script, since you posted a copy here earlier. So, open it again, change the number by typing in a smaller one, click SAVE and try it out. If you didn't guess quite the right new number, change it and try again until it looks right. You don't really need Sit Target Helper to do that. 
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|