Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Free, open-source pose ball code for anims - EASY, low lag!

FlipperPA Peregrine
Magically Delicious!
Join date: 14 Nov 2003
Posts: 3,703
06-11-2005 18:05
This should work great for furniture, hang out areas, and more. There are two versions of the script below:

(1) The "no listener" version. This will automatically turn transparent and solid when used. It automatically reads the animation in inventory so you should have to modify anything other than the "Sit Replacement Text" at the top. This will cause almost no lag to your sim.

(2) The "listener" version. This contains a listener on channel 1, which replies to a "show / hide" command from anyone. This is handy for poseballs which may need to be moved or positioned AFTER the avatar is actively posed.

Another advantage: I'm calling the transparent and solid textures by key, so you don't have to put any textures into the prim's inventory - just the script and the animation you want triggered. I'm sure they can be improved a bit, but here they are.

The NO LISTENER version (recommended; minimum lag):
CODE

// FlipperPA's auto-transparent minimum lag pose thingy.

// STEP 1: Drop your pose into an object inventory with this script (only 1)
// STEP 2: Simply enter the text you wish to hover about the pose object below

string DISPLAY_TEXT = "Float";

// STEP 3: Hit "SAVE" below. If you change the pose, you can reset the script to re-read the pose

/////////////////////// DO NOT CHANGE BELOW ////////////////////////
string ANIMATION;
integer is_sitting;

default
{
state_entry()
{
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
is_sitting = 0;
llSitTarget(<0,0,.1>,ZERO_ROTATION);
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",ALL_SIDES);
llSetText(DISPLAY_TEXT,<1,1,1>,1);
}

changed(integer change)
{
if(change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();

if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
else
{
if((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && is_sitting)
{
is_sitting = 0;
llStopAnimation(ANIMATION);
llSetText(DISPLAY_TEXT,<1,1,1>,1);
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",ALL_SIDES);
}
}

}
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
}

run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
is_sitting = 1;
llStopAnimation("sit_generic");
llStopAnimation("sit");
llStartAnimation(ANIMATION);
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204",ALL_SIDES);
llSetText("",<1,1,1>,1);
}
}

on_rez(integer start_param)
{
llResetScript();
}
}


The LISTENER version (only use if necessary):
CODE

// FlipperPA's auto-transparent minimum lag pose thingy.

// STEP 1: Drop your pose into an object inventory with this script (only 1)
// STEP 2: Simply enter the text you wish to hover about the pose object below

string DISPLAY_TEXT = "Sit Here!";

// STEP 3: Hit "SAVE" below. If you change the pose, you can reset the script to re-read the pose
// by typing "/1 reset" into chat within listen range of the script.



/////////////////////// DO NOT CHANGE BELOW ////////////////////////
string ANIMATION;
integer is_sitting;

default
{
state_entry()
{
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
is_sitting = 0;
llListen(1,"","","");
llSitTarget(<0,0,.1>,ZERO_ROTATION);
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",ALL_SIDES);

llSetText(DISPLAY_TEXT,<1,1,1>,1);
}

changed(integer change)
{
if(change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();

if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
else
{
if((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && is_sitting)
{
is_sitting = 0;
llStopAnimation(ANIMATION);
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",ALL_SIDES);
llSetText(DISPLAY_TEXT,<1,1,1>,1);
}
}
}
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
}

run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
is_sitting = 1;
llStopAnimation("sit_generic");
llStopAnimation("sit");
llStartAnimation(ANIMATION);
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204",ALL_SIDES);
llSetText("",<1,1,1>,1);
}
}

listen(integer channel, string name, key id, string message)
{
if(!is_sitting)
{
if(message == "show")
{
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f",ALL_SIDES);
llSetText(DISPLAY_TEXT,<1,1,1>,1);
}
else if(message == "hide")
{
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204",ALL_SIDES);
llSetText("",<1,1,1>,1);
}
else if(message == "reset" && id == llGetOwner())
{
llResetScript();
}
}
}

on_rez(integer start_param)
{
llResetScript();
}
}


You should be able to do a drop and replace of most pose code out there to reduce lag, but no promises, no warranties. Standard disclaimer, etc. Do with them as you will. If you improve anything within the code, be sure to contribute back to the code. :-)

Thanks & Enjoy,

-Flip
_____________________
Peregrine Salon: www.PeregrineSalon.com - my consulting company
Second Blogger: www.SecondBlogger.com - free, fully integrated Second Life blogging for all avatars!
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Post
06-12-2005 20:38
/15/d7/49960/1.html
_____________________
i've got nothing. ;)
Toy LaFollette
I eat paintchips
Join date: 11 Feb 2004
Posts: 2,359
06-12-2005 21:23
works great Flip ty ty ty :)
_____________________
"So you see, my loyalty lies with Second Life, not with Linden Lab. Where I perceive the actions of Linden Lab to be in conflict with the best interests of Second Life, I side with Second Life."-Jacek
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
06-14-2005 21:32
Note - that setTexture command can easily be swapped with a setAlpha command toggling between 1.0 for solid and 0.0 for transparent. - This would allow you to make the poseball any texture you'd like.

Thanks Flip for posting the low-lag poseball. While PosAbility does eliminate the need for a lot of poseballs, some may be advantageous when only 1 animation is needed.
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
06-15-2005 07:28
great flip generations of SLers will worship you ^_^

what is the sit_generic?
_____________________

tired of XStreetSL? try those!
apez http://tinyurl.com/yfm9d5b
metalife http://tinyurl.com/yzm3yvw
metaverse exchange http://tinyurl.com/yzh7j4a
slapt http://tinyurl.com/yfqah9u
MissWendy Divine
Registered User
Join date: 28 Dec 2004
Posts: 14
how about a no-disappearing version?
06-20-2005 12:50
I have made some things in game that I add pose balls to. I am looking for a pose script that does not make the prim disappear.

Then, I could put the script and the animation right into .. for example.. a dining room chair seat, and not have to use the extra prims.

Would that be even less lag? When it does not change the textures of the prim either?

Warmly
MissWendy Divine
_____________________
People used to tease me and say I looked at the world through Rose-Colored Glasses. I corrected them and said it was a Rose-Colored Rifle Scope. Now, they don't tease me anymore.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
06-20-2005 17:04
Yes, although fiddling to get the sit target right is a pain. If you take out all the llSetTexture() lines it will do that for you though.
Esso Vollmar
Registered User
Join date: 24 Mar 2007
Posts: 6
05-31-2007 03:38
How can I change in this script name "Sit Here" to something else?
Thank you very much in advance for your help :)

PS: Thanks for this great script!
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-31-2007 04:17
Esso: add this bit in state_entry, after the bit about llSetText

llSetSitText("your text here";);


Or for consistency's sake you could declare another global and use it to set the pie menu text; up top, under the line about DISPLAY_TEXT add this:

PIE_MENU_TEXT = "your text here";


Then back in state_entry use this instead of what I posted before:

llSetSitText(PIE_MENU_TEXT);
Esso Vollmar
Registered User
Join date: 24 Mar 2007
Posts: 6
05-31-2007 04:34
Thank you very much Anti! :)
Can I make the same thing with "Pay..." button on the donation box script?
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-31-2007 05:50
From: Esso Vollmar
Thank you very much Anti! :)
Can I make the same thing with "Pay..." button on the donation box script?

Nope, there's an llSetTouchText for changing "touch" to something else, but those are the only two you can change.
Esso Vollmar
Registered User
Join date: 24 Mar 2007
Posts: 6
05-31-2007 07:19
Thx again :)
And is there a way to disable SIT or TOUCH on a object?
I have some lights on my club that people touch and sit on them all the time instead of a pose balls... Can I somehow disable touch & sit or just make those lights untouchable?!
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
05-31-2007 07:23
You can llUnsit() them in the changed event to kick them off.
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
05-31-2007 09:59
any idea what it is that makes some unsit actions work gracefully and some launch you about 100 feet?
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-31-2007 11:33
From: Shadow Subagja
any idea what it is that makes some unsit actions work gracefully and some launch you about 100 feet?

Couple things:

- proximity to other prims, particularly small ones (don't ask me why small prims are worse, it was explained to me once in a convincing manner but I'll screw it up if I try to explain it myself)

- proximity to the ground

- the value of llSitTarget, added to both of the above considerations. If you disregard the animation being played and the sit target would result in a *standing* avatar being sunk into the ground or a nearby prim, SL will spit him or her back out once they are no longer sitting on a poseball.

Consider that dance balls rarely eject avatars violently - it's because the avatars remain fully above the ground, even when the animation is done playing. Unless the animator did something weird with vertical hip offsets and compensated by "sinking" the sit target down well below the ball set.
Sparky Forcella
Registered User
Join date: 11 Feb 2007
Posts: 3
06-01-2007 11:35
Probably the most accurate description of anything I've exactly wanted to do do ever!


Thanks very much!!!!
AWM Mars
Scarey Dude :¬)
Join date: 10 Apr 2004
Posts: 3,398
06-12-2007 05:22
Not being a SL scripter, but understanding the basics, is there a way to have the inventory comand look only into a specific folder, rather than wait for sl to read all poses/animations available?

This is just so that when a model uses the stand, if each model has specific poses they want to use for a shoot, they don't have to trawl through long lists.
_____________________
*** Politeness is priceless when received, cost nothing to own or give, yet many cannot afford -

Why do you only see typo's AFTER you have clicked submit? **
http://www.wba-advertising.com
http://www.nex-core-mm.com
http://www.eml-entertainments.com
http://www.v-innovate.com
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-12-2007 06:12
From: AWM Mars
Not being a SL scripter, but understanding the basics, is there a way to have the inventory comand look only into a specific folder, rather than wait for sl to read all poses/animations available?

This is just so that when a model uses the stand, if each model has specific poses they want to use for a shoot, they don't have to trawl through long lists.


If you mean animations in the Inventory of the stand: Object Inventories can't have folders--although one could create a dialog hierarchy that traverses some notecard-defined tree of categorized animations.
AWM Mars
Scarey Dude :¬)
Join date: 10 Apr 2004
Posts: 3,398
06-12-2007 07:50
Perhaps I was getting lost in terminologies, I was thinking Inventories as being ermm the Inventory, not the contents of the prim. My train of thought would be to have the scripted pose stand/prim look for poses from a specific folder inside the wearers inventory.
_____________________
*** Politeness is priceless when received, cost nothing to own or give, yet many cannot afford -

Why do you only see typo's AFTER you have clicked submit? **
http://www.wba-advertising.com
http://www.nex-core-mm.com
http://www.eml-entertainments.com
http://www.v-innovate.com
Yakumo Masukami
Registered User
Join date: 7 Sep 2006
Posts: 22
04-19-2008 20:41
Hi, great script!
However, I would like to be albe to change the seated position so that it is closer to the ball. When I try to change "llSitTarget(<0,0,.1>,ZERO_ROTATION);" to move closer, it ignores the animation I have dropped in, and sits the avi in a standard sit pose. I have tried resetting the script, but it still doesn't pick the correct anim up.
Please can anyone help?
Thanks.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-19-2008 20:55
From: Yakumo Masukami
Hi, great script!
However, I would like to be albe to change the seated position so that it is closer to the ball. When I try to change "llSitTarget(<0,0,.1>,ZERO_ROTATION);" to move closer, it ignores the animation I have dropped in, and sits the avi in a standard sit pose. I have tried resetting the script, but it still doesn't pick the correct anim up.
Please can anyone help?
Thanks.

You can not use the values <0,0,0> as a sit target. Using those numbers tells the simulator that there effectively is no sit target and the changed/changed_link event is never triggered.

If you want to move down then try using <0,0,-.1> for example, anything but all zeroes.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Yakumo Masukami
Registered User
Join date: 7 Sep 2006
Posts: 22
04-19-2008 21:17
From: Jesse Barnett
You can not use the values <0,0,0> as a sit target. Using those numbers tells the simulator that there effectively is no sit target and the changed/changed_link event is never triggered.

If you want to move down then try using <0,0,-.1> for example, anything but all zeroes.


Thanks Jesse, however that is exactly what I have tried and every time it resets the sit animation back to the standard one and ignores the one I added, even after doing a reset. :(
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-19-2008 21:38
OK, No problem, back to the basics. Make sure that the script is actually running and that you are on land that allows scripts.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Yakumo Masukami
Registered User
Join date: 7 Sep 2006
Posts: 22
04-19-2008 21:50
Ok, checked that, , the script is running, it just seems to fail with 0,0,0 I have tried it with 0,0,.01 and the script works with that, however, it isn't moving the avi any nearer the poseball. Very strange behviour,
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-19-2008 21:52
From: Yakumo Masukami
Ok, checked that, , the script is running, it just seems to fail with 0,0,0 I have tried it with 0,0,.01 and the script works with that, however, it isn't moving the avi any nearer the poseball. Very strange behviour,

OK, Look again at my first response. You can never, ever use <0,0,0> as a sit target, anything but all zeroes. But you can also use negative numbers so try maybe <0,0,-0.2> for example.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
1 2