Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: AO Overriding Pose Ball

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-09-2006 10:52
Animation Overrider Overrider Pose Ball

I have always thought it kind of silly that we have to type "/ao off" when we sit on a pose ball and "/ao on" when we stand back up. Well, maybe it isn't as silly as having to make an overrider for an overrider:-) But now I have come far enough along in my scripting to cobble together my own pose ball script. Per the wiki it is not possible to start an animation by it's key BUT you can stop one with it's key. You can use llGetAnimationList to get that key.

Just make a pose ball and texture as desired, drop an animation in it and this script.

pose ball script:
CODE

//AO Overrider Pose Ball Script V 2.0
//Updated 10/11/07
//Created by Jesse Barnett
//Edited to check if there is an animation to stop
//and Sit Position is stored in Object Description
//Drop this in a prim along with an animation. Store the sit position in the Object description
//Example; <0.0, 0.0, 1.0>
//If you change this, then reset the script by using right click/reset for changes to apply immediately. If you forget then it will display
//"reset script" when you sit. Just stand and sit again for changes to take effect

integer idebug = FALSE;//if TRUE then llOwnerSay sdebugs
string sdebug;
integer perm;//permissions
string anim2run;//animation in inventory
vector sit_pos;//adjust as needed in object description Example: <0.0, 0.0, 1.0>
list anims2stop;//default or AO sit animation
float sleep = 0.5;//duration of llSleep in seconds

debug(){
if(idebug == 1)
llOwnerSay(sdebug);
}

sit_desc_change(){
if((sit_pos + (vector)llGetObjectDesc()) != (sit_pos* 2))
llResetScript();
//This checks to see if the description field matchs the stored position
else
llSitTarget(sit_pos, ZERO_ROTATION);
}

stop_anim(){
integer list_pos = 0;
integer list_length = llGetListLength(anims2stop);
sdebug = (string)list_length;
debug();
if(list_length > 0){
while(list_pos < list_length){
llStopAnimation(llList2String(anims2stop, list_pos));
sdebug = (string)list_pos;
debug();
list_pos++;
}
}
}

default{
state_entry(){
llSetTouchText("Reset");
llOwnerSay("Script Reset.");
anim2run=llGetInventoryName(INVENTORY_ANIMATION,0) ;
sit_pos = (vector)llGetObjectDesc();
sit_desc_change();
perm=llGetPermissions();
}

touch_start(integer num_detected) {
llResetScript();
}

changed(integer change){
if (change & CHANGED_LINK)
if (llAvatarOnSitTarget() != NULL_KEY){
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}

else{
perm=llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(anim2run)>0)
llStopAnimation(anim2run);
llSetAlpha(1.0, ALL_SIDES);
}
}
run_time_permissions(integer perm){
if (perm & PERMISSION_TRIGGER_ANIMATION)
anims2stop = [];//Clears the list
sdebug = "perms granted";
llStopAnimation("sit");
llSleep(sleep);//need sleep to give avatar time to cycle from stand to default sit to AO sit
anims2stop = llGetAnimationList(llAvatarOnSitTarget());
sdebug = llList2CSV(anims2stop);
debug();
stop_anim();//This runs the subroutine up top .
llSetAlpha(0.0, ALL_SIDES);
llStartAnimation(anim2run);
sdebug = "anim2run started";
debug();
}
}
_____________________
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
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
10-10-2006 12:20
/15/d3/142207/1.html
_____________________
i've got nothing. ;)
Ishtara Rothschild
Do not expose to sunlight
Join date: 21 Apr 2006
Posts: 569
10-10-2006 15:58
Thank you :):) that comes very handy. I'm crafting a lot of poseballs atm.

I already downgraded from a full ao to a simple walk replacer and decided to rather live with air-typing, only because of this problem which isn't a problem anymore now
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-10-2006 16:38
Shameless plug :) You could also use a ZHAO, which lets you leave all other overrides on and turn off just the sit override.
Silje Russell
lsl geek
Join date: 2 Oct 2005
Posts: 63
10-11-2006 15:13
if you looking at lockmeister booton/bootoff function you can see that can be used in ao script to.

I use it to turn off my ao when collar running a animiation.

exsemple from wiki
CODE

<avatar key>booton/bootoff = commands sent by collar objects, askin for the shoes animation overrider to be stopped
ex: "748bb591-0d9d-4907-8287-dc27b8267e24booton" activate the animation overrider
ex: "748bb591-0d9d-4907-8287-dc27b8267e24bootoff" deactivate the animation overrider
_____________________
Yes i know i got typos..
I got writing and reading problems.
but i am still a humen!!
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-13-2006 07:34
I ran into one problem with my script. It works fine if your AO is active but throws out an error if your AO is off. So I threw in a If statement to check if the active animations list is empty. Also to make it easier for the scripting handicapped have put the sit position in the Object Description. If anyone encounters a problem with it please send me some feedback. I'll transfer is to the library in a few days after giving a chance for more feedback.

CODE

//AO Overrider Pose Ball Script V 1.1
//Created by Jesse Barnett
//Edited to check if there is an animation to stop
//and Sit Position is stored in Object Description
//Drop this in a prim along with an animation. Store the sit position in the Object description
//Example; <0.0, 0.0, 1.0>
//If you change this then reset the script by using right click/reset for changes to apply immediately. If you forget then it will display
//"reset script" when you sit. Just stand and sit again for changes to take efect

integer perm;//permissions
string anim2run;//animation in inventory
vector sit_pos;//adjust as needed in object description Example: <0.0, 0.0, 1.0>
list anim2stop;//default or AO sit animation
float sleep = 0.5;//duration of llSleep in seconds

sit_desc_change(){
if((sit_pos + (vector)llGetObjectDesc()) != (sit_pos* 2))
llResetScript();
//This checks to see if the description field matchs the stored position
else
llSitTarget(sit_pos, ZERO_ROTATION);
}

stop_anim(){
if(llGetListLength(anim2stop) > 0)
llStopAnimation((string)anim2stop);
//If there is a name in the list then it stops that animation
}

default{
state_entry(){
llSetTouchText("Reset");
llOwnerSay("Script Reset.");
anim2run=llGetInventoryName(INVENTORY_ANIMATION,0);
sit_pos = (vector)llGetObjectDesc();
perm=llGetPermissions();
}

touch_start(integer num_detected) {
llResetScript();
}

changed(integer change){
if (change & CHANGED_LINK)
if (llAvatarOnSitTarget() != NULL_KEY){
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
sit_desc_change();
}

else{
perm=llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(anim2run)>0)
llStopAnimation(anim2run);
llSetAlpha(1.0, ALL_SIDES);
}
}
run_time_permissions(integer perm){
if (perm & PERMISSION_TRIGGER_ANIMATION)
anim2stop = [];//Clears the list
llStopAnimation("sit");
llSleep(sleep);//need sleep to give avatar time to cycle from stand to default sit to AO sit
anim2stop = llGetAnimationList(llAvatarOnSitTarget());
stop_anim();//This runs the subroutine up top .
llSetAlpha(0.0, ALL_SIDES);
llStartAnimation(anim2run);
}
}
_____________________
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
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-09-2006 11:15
Updated the script in the library today.

CODE

//AO Overrider Pose Ball Script V 1.2
//Updated 11/09/2006
//Created by Jesse Barnett
//Edited to check if there is an animation to stop
//and Sit Position is stored in Object Description
//Drop this in a prim along with an animation. Store the sit position in the Object description
//Example; <0.0, 0.0, 1.0>
//If you change this then reset the script by using right click/reset for changes to apply immediately. If you forget then it will display
//"reset script" when you sit. Just stand and sit again for changes to take efect

integer perm;//permissions
string anim2run;//animation in inventory
vector sit_pos;//adjust as needed in object description Example: <0.0, 0.0, 1.0>
list anim2stop;//default or AO sit animation
float sleep = 0.5;//duration of llSleep in seconds

sit_desc_change(){
if((sit_pos + (vector)llGetObjectDesc()) != (sit_pos* 2))
llResetScript();
//This checks to see if the description field matchs the stored position
else
llSitTarget(sit_pos, ZERO_ROTATION);
}

stop_anim(){
if(llGetListLength(anim2stop) > 0)
llStopAnimation((string)anim2stop);
//If there is a name in the list then it stops that animation
}

default{
state_entry(){
llSetTouchText("Reset");
llOwnerSay("Script Reset.");
anim2run=llGetInventoryName(INVENTORY_ANIMATION,0) ;
sit_pos = (vector)llGetObjectDesc();
sit_desc_change();
perm=llGetPermissions();
}

touch_start(integer num_detected) {
llResetScript();
}

changed(integer change){
if (change & CHANGED_LINK)
if (llAvatarOnSitTarget() != NULL_KEY){
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}

else{
perm=llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(anim2run)>0)
llStopAnimation(anim2run);
llSetAlpha(1.0, ALL_SIDES);
}
}
run_time_permissions(integer perm){
if (perm & PERMISSION_TRIGGER_ANIMATION)
anim2stop = [];//Clears the list
llStopAnimation("sit");
llSleep(sleep);//need sleep to give avatar time to cycle from stand to default sit to AO sit
anim2stop = llGetAnimationList(llAvatarOnSitTarget());
stop_anim();//This runs the subroutine up top .
llSetAlpha(0.0, ALL_SIDES);
llStartAnimation(anim2run);
}
}
_____________________
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
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
11-09-2006 12:06
CODE

list anim2stop = llGetAnimationList(llAvatarOnSitTarget());
animstring = (string)anim2stop;
llStopAnimation(animstring);

Just a note, but casting list into a string causes all elements of the list to be merged together... meaning, if your AV is playing more than one animation (fairly common occurence), this script will be trying to stop a non-existing animation, as the name of this animation will be generated by merging all animation keys into single string...
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-09-2006 12:20
From: Joannah Cramer
CODE

list anim2stop = llGetAnimationList(llAvatarOnSitTarget());
animstring = (string)anim2stop;
llStopAnimation(animstring);

Just a note, but casting list into a string causes all elements of the list to be merged together... meaning, if your AV is playing more than one animation (fairly common occurence), this script will be trying to stop a non-existing animation, as the name of this animation will be generated by merging all animation keys into single string...


While testing I had it saying the animation list and never came across an occurence of two animations playing at once. Under what circumstances could more then one animation be active? I am always curious and willing to learn more. Once I can replicate it then it will be easy enough to modify the script.
_____________________
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
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
11-09-2006 12:28
From: Jesse Barnett
Under what circumstances could more then one animation be active?

Sometimes low and high priority animations are combined to provide effect like a missing limb or a bag being held properly at all time no matter what walk animation etc the AV is playing. The more common occurence is probably someone using attachment to control AV's facial animations, i.e. playing in a loop one or more of the stock "..._emote" animations in addition to regular sit/stand/walk/whatever ^^;;
IC Fetid
Registered User
Join date: 19 Oct 2005
Posts: 145
11-09-2006 12:32
I suppose the next evolution in animations would be an AO that overrides the AO overrider on the pose ball. ;) Disableable, of course, for when you want to use the pose ball's animation
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-09-2006 12:50
From: IC Fetid
I suppose the next evolution in animations would be an AO that overrides the AO overrider on the pose ball. ;) Disableable, of course, for when you want to use the pose ball's animation

Yes it is silly but it is also something much more. One of the first things that a noob asks is "Why do I walk like something is stuck up my b*tt and you don't?" I don't know the numbers but a large majorty of the population uses AO's and they contribute a lot to lag. Each AO uses over .100 ms of script time and it adds up. Each of them also fire off a sensor every 0.1 seconds or so, some even more frequent. I checked an old one I had and it was firing up every 0.001 seconds!!!!!!!!!!! Aakanaar (excuse me if I misspelled) said something along the lines of getting LL to add more states like walking for instance. Even better, if LL made it possible to change the default animations, especially if they allowed multiple stands, Then there would be no need for AO's at all. This would free up a considerable amount of processing power. In thier ongoing and not very successfull fight to control lag, I do not understand why they haven't done that.

Thank you for clarifying that Joannah. I will work on that tonight.
_____________________
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
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-09-2006 14:03
From: someone
I don't know the numbers but a large majorty of the population uses AO's and they contribute a lot to lag. Each AO uses over .100 ms of script time and it adds up. Each of them also fire off a sensor every 0.1 seconds or so, some even more frequent. I checked an old one I had and it was firing up every 0.001 seconds!!!!!!!!!!!


Try a modern AO :) What you said used to be true, but isn't really true any more. There are old threads where someone tested this, and found complex prim hair to cause more lag than, say, a recent version of the ZHAO.

To the best of my memory (it's been a while), the ZHAO uses a 0.25s timer, no listens, no sensors. Fuschio Mfume did some pretty extensive testing of commonly used attachments, and posted the results here:

/54/8f/145472/1.html

Quoting:

CODE

Active Script
Scripts Time (ms) Device Name
------- --------- -----------------------------------------

...

16 .063 ZHAO


So... it's not all doom and gloom when it comes to AOs :) But yes, I wish LL would implement the ability for users to change the default animations, and then we wouldn't need AOs at all.
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
10-08-2007 08:51
From: Jesse Barnett
Under what circumstances could more then one animation be active?


I was testing some anim-related scripts, and I used a utility that gave all my animations whenever I touched it. It often gave more than one. I suspect that one of them might have been the pointing that happens when we touch.

No doubt there are plenty of other cases. Your function to stop animations needs to iterate through all the entries in the list, and not just cast it to a string.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-08-2007 11:09
I can confirm that the most recent version of WetIkon (one.8?) supports (encourages?) multi-part animations (give the arms x priority, head y priority, etc) played simultaneously

love the whole re-override idea though.... I'm thinking of adding it to a hugger script =)
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
10-08-2007 12:34
From: Jesse Barnett
I checked an old one I had and it was firing up every 0.001 seconds!!!!!!!!!!!


No, it was only *asking* to fire up that often. There is a limit to the number of times a script will be invoked per second. Timer event values below about 0.1 don't speed up the frequency as much as they should (i.e. linearly), and below 0.05 don't make any difference I can measure. Practically speaking, the most an AO can sample is 10 times per second.

Still, your point is still valid, and AOs do a lot of busy work. There is a Jira entry for a fix for this: to provide a notification when animation state changes so that scripts don't need to poll. Keep your fingers crossed. However, even if it's implemented, how long will it take before all the old AOs disappear from the grid?
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-08-2007 12:39
From: someone
I don't know the numbers but a large majorty of the population uses AO's and they contribute a lot to lag.


This comes up every now and then. They contribute to lag, but not as much as they used to (IMO). And the current scheduler makes it impossible for scripts to affect physics, so the lag you'll experience is the slowing down of scripts.

Some recent discussions:

/327/26/211402/1.html
/327/12/211070/1.html

And some tests done on script load from popular attachments:

/54/8f/145472/1.html

From: someone
Each of them also fire off a sensor every 0.1 seconds or so, some even more frequent.


What AO did you test with? I haven't seen any AO with a sensor. They all have a timer, some of them at 0.1s (ZHAO-II uses a 0.25s timer), but that is used to check the av's state, not to run a sensor.

From: someone
I checked an old one I had and it was firing up every 0.001 seconds!!!!!!!!!!!


Yes, some of the old ones did that. I know that current versions of Wet Ikon and ZHAO are much less resource intensive than that. And as Lear said, the events don't really come in that fast.

Of course, that doesn't mean there aren't several of these old AOs still in use.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
10-08-2007 12:45
From: Lear Cale
... There is a Jira entry for a fix for this: to provide a notification when animation state changes so that scripts don't need to poll.
Cool. Looks like two or three related Jira entries, linked together. One that seemed particularly useful--and for other things besides AOs--is .
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-08-2007 12:51
Ah, an event driven AO. That would be sweet. Hopefully some day :)
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
10-10-2007 12:25
From: Ziggy Puff
This comes up every now and then. They contribute to lag, but not as much as they used to (IMO). And the current scheduler makes it impossible for scripts to affect physics, so the lag you'll experience is the slowing down of scripts.

Some recent discussions:

/327/26/211402/1.html
/327/12/211070/1.html

And some tests done on script load from popular attachments:

/54/8f/145472/1.html



What AO did you test with? I haven't seen any AO with a sensor. They all have a timer, some of them at 0.1s (ZHAO-II uses a 0.25s timer), but that is used to check the av's state, not to run a sensor.



Yes, some of the old ones did that. I know that current versions of Wet Ikon and ZHAO are much less resource intensive than that. And as Lear said, the events don't really come in that fast.

Of course, that doesn't mean there aren't several of these old AOs still in use.


I'm pretty sure he meant timer not sensor. :)
_____________________
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-10-2007 13:58
Have keyboard, will nit-pick :)
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-10-2007 18:29
OMG All of you are sooooo baaaaad!. Making me look at one of my scripts from a year ago. My eyes are burning!!!!!!!!

But yes I did mean a timer. I still wish SL would allow us to specify the animations we want to play when walking, flying etc, instead of having to use AO's. I know it needs a list instead of a string and turn off the anims one after the other. But what is amazing is that I still haven't seen anyone adapt this widely to poseballs etc. This works just as good now as back then. You don't have to do the annoying as heck "AO on" and "AO off" whenever you sit down or get up. And finally she not he.

Shwwwwwww, am I done yet? I'll get around to making it so multiple anims are turned off this weekend.

Still love all of you though :-)
_____________________
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
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-11-2007 10:33
LOL, totally didn't notice the 2006 date on your post. My apologies :)
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
10-11-2007 12:49
From: Jesse Barnett
And finally she not he.

Still love all of you though :-)


hehe, sorry, When i see anyone named Jesse, I always think of Jesse James, the outlaw. :)
_____________________
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
10-11-2007 13:31
mea culpa -- saw a link to this one from elsewhere and forgot to check the date before posting.

Anyone got a dead horse we could beat?
1 2