Jump to content

Issue with llStopAnimation


gwenavive
 Share

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

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

Recommended Posts

I've hunted around for an answer but can't seem to find anything.

My situation is that if someone has sat on my object and is being animated and they TP somewhere else before standing, crash or just log off, the next person trying to sit gets the llStopAnimation error as it can't find the person to stop for and comes up with the error pop up.

I did read somewhere perhaps running a timer to check if they're still there but seems an overkill especially if i have 50 of these running on a sim or more for lag.

Wondering if anyone has a solution or if that can't be handled, is there a way to stop the error showing and quietly get on with letting the next person sit?

Edited by gwenavive
Link to comment
Share on other sites

3 hours ago, gwenavive said:

My situation is that if someone has sat on my object and is being animated and they TP somewhere else before standing, crash or just log off, the next person trying to sit gets the llStopAnimation error as it can't find the person to stop for and comes up with the error pop up.

In another thread on these forums it was mentioned that it is no longer necessary to stop animations when somebody stands or crashes or TPs away.

I'm not sure how exactly you are trying to stop an animation and getting it held there for such a long time. Typically, this is what I do in the changed event...

 

changed (integer change)
{
	if( change & CHANgeD_LINK)
	{
		key sitter = llAvatarOnSitTarget();
		if( sitter != NULL_KEY)
		{
			// we start doing stuff to/with them
			llRequestPermissions(sitter, PERMISSION_TRIGGER_ANIMATION);
		}
		else
		{
			// the sitter has left the building
			// clear out any globals that were used for them
			// set up for the next sitter, which is usually preparing to stop the "sit" aniimation
			// and starting one of a sequence of animations
		}

I used to try stopping the last applied animation right inside the else construct in the hope it would prevent animations continuing to play on the deer-departed, but with mixed results, getting permission errors with TPV's that revoked permissions on stand, etc.

I suggest you try only stopping an animation inside the run_time_permissions event when you are then going to start a fresh animation and see if this makes the error cease.

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

I'm only calling stop when another animation starts whether that's from the current person or a new person like this. 

so if the last person has left, the next person trying to start one has the error

setAnimation(integer num) {
    //llOwnerSay("Start Animation - " + (string)num);
    if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) {
        llStopAnimation(current_animation);
    }
    current_animation = llList2String(list_animations,num);
    llRequestPermissions(claimed_key,PERMISSION_TRIGGER_ANIMATION);
    llStartAnimation(current_animation);    
}
 

I also find the change event integer change is always 32 for every change no matter what that is?

    changed(integer change)
    {
        integer info; 

        if (previous_key != llAvatarOnSitTarget()) {
            claimed_key = llAvatarOnSitTarget();
            previous_key = claimed_key;
        }

        info = llGetAgentInfo(claimed_key); 

        if (AGENT_SITTING) 
        { 
            if (info) 
            { 
                addMainButtons();
                addBodyButtons();
                addPoseButtons();
                isSitting = TRUE;
                setAnimation(0);
                showMenu();
            } 
            else 
            { 
                llRegionSay(tmo_channel, "DETACH|" + (string)claimed_key);
                isSitting = FALSE;
            } 
        } 
    }
 

Edited by gwenavive
Link to comment
Share on other sites

36 minutes ago, gwenavive said:

Thanks Rolig, that would be running over and over on a timer right?

Simply check if the avatar is still there like this:

if(llGetAgentSize(uuid)) {
    //uuid is an avatar in the region
} else {
    //uuid is not an avatar in the region
}

On your last question you could just check if the animation is running to make your life easy: http://wiki.secondlife.com/wiki/LlGetAnimationList
(get list of animation... search if key in list)

Link to comment
Share on other sites

Doesn't seem to matter what i do i keep getting the llStopAnimation: Script trying to stop animations but agent not found error

looks like the llGetAnimationList is only for the person on it at that time so it's always true when anyone sits.

At a loss here. would be easier for there to be stand event even when they crash or log out or, just mute the error dialog?

Link to comment
Share on other sites

10 minutes ago, gwenavive said:

Doesn't seem to matter what i do i keep getting the llStopAnimation: Script trying to stop animations but agent not found error

looks like the llGetAnimationList is only for the person on it at that time so it's always true when anyone sits.

At a loss here. would be easier for there to be stand event even when they crash or log out or, just mute the error dialog?

Well you have to fix your code to get the animations of the person who got off the object after checking if they are still there.

Also you don't really need llGetAgentInfo.

You can simply do:

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

            if(av == NULL_KEY){ // no sit
                // stop animation etc
                
            }else{ // sitting  
                // do sitting stuff                
            }            
        }
}

 

Link to comment
Share on other sites

1 hour ago, gwenavive said:

I'm only calling stop when another animation starts whether that's from the current person or a new person

OK, I think that you only need to call stop animation before starting a new animation if it's the same person, so when somebody stands or TPs away there is no need to stop anything. when a new person arrives you obviously have to stop the sit animation, and any changed ones for them.

 

ETA, are you dealing with multiple sitters?

 

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

44 minutes ago, gwenavive said:

Doesn't seem to matter what i do i keep getting the llStopAnimation: Script trying to stop animations but agent not found error

as bobskneif mentions the error is occurring because the script is trying to apply llStopAnimation to an avatar/agent which is not present on the region

a way to help understand how to work with permissions is to wrap the permission query in a function. Example:

integer hasPerm(key id, integer perm)
{
   // return TRUE when all 3 conditions are met, else return FALSE
   return
      (llGetPermissions() & perm == perm) &   // script has this permission
      (llGetPermissionsKey() == id) &          // agent id has granted this permission
      (llGetAgentSize(id) != ZERO_VECTOR);    // agent id is present on the region
}


key agent = lAvatarOnSitTarget();

if (hasPerm(agent, PERMISSION_TRIGGER_ANIMATION) == FALSE)
{
   llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION);
}

if (hasPerm(agent, PERMISSION_TRIGGER_ANIMATION) == TRUE)
{
   llStartAnimation("anim");
}

if (hasPerm(agent, PERMISSION_TRIGGER_ANIMATION) == TRUE)
{
   llStopAnimation("anim");
}

 edit: typo

add: when we get more experience and understanding of the conditions that have to be met, then we can forego using a wrapper function and begin inlining the conditions in our code

Edited by Mollymews
Link to comment
Share on other sites

1 hour ago, gwenavive said:

also find the change event integer change is always 32 for every change no matter what that is?

    changed(integer change)
    {
        integer info; 

I just noticed this, you have to test for specific changes in the way I illustrated above

if( change & CHANGED_LINK) ) will test for a specific bit set in the integer to show that somebody has joined or left the linkset.

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

interesting, i tested by removing the llStopAnimation all together and no more errors and also seems to go through each animation for each sitter, get off, crash and a new sitter, all works. So no idea what llStopAnimation is for then :)

It's a new pose stand i have for my store that lets people sit and it puts an outfit on for them and lets them go through poses to see how they look in that outfit. So there are multiple stands in the store. who needs to grab a demo anymore lol.

Finaly past this point and on to the next annoying bit :) thanks everyone for the help and advice. appreciated

Edited by gwenavive
  • Like 1
Link to comment
Share on other sites

34 minutes ago, gwenavive said:

So no idea what llStopAnimation is for then

What it says :). If you are only dealing with a single avatar at a time it's quite straightforward, once the CHANGED_LINK condition had been detected and a non-null UUID found on the sit target, the very first thing you're likely to need to do is to stop the "sit" animation to replace it with one of your ones. So you request animation permissions for that avatar, and once assured, stop "sit" and start the desired one.

If you are cycling though several animations for an avatar you can play more than one on them at a time, for example a hands animation juggling a chicken, fox and a bat, and legs animation for the unicycle they are riding. If you then want them to stop jugging and switch to patting their head and rubbing their stomach at the same time, you want to stop the upper body animation and replace it with a new one, but not stop the legs animation.

With more than one avatar it gets slightly more complicated in that you have to keep track of the uuid AND the animations, and which one you last grabbed perms for, because when you come to stop an animation, it will be for the last avatar you started an animation for, and if that is a different avatar you have to get to the right avatar by requesting perms again for them, then call llStopAnimattion.

It therefore pays to keep track of which animation(s) you have started on which UUID. Just another bit of list work.

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

Thanks for the explanation Profaitchikenz. Must be it because there's only ever 1 sitter on them at any given time so when the last gets off and no stopanim is called, it just starts a new anim with perms for the next person.

makes sense with multiple people on it at the same time :)

now to get llDeleteSubList to work properly to remove multiple items from the avatar. will probably be a new question soon no doubt lol

Edited by gwenavive
Link to comment
Share on other sites

I don't know if this is relevant but I'm a bit puzzled by 

setAnimation(integer num) {
    //llOwnerSay("Start Animation - " + (string)num);
    if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) {
        llStopAnimation(current_animation);
    }
    current_animation = llList2String(list_animations,num);
    llRequestPermissions(claimed_key,PERMISSION_TRIGGER_ANIMATION);
    llStartAnimation(current_animation);    
}
 

I would set the value of the variable current_animation and then request animations permissions, and then, in the run_time_permissions event,  call llStartAnimation(current_animation) there, at a point when there's no question whether the script has  animation perms or not.

I guess you could also make assurance doubly sure by checking who llGetPermissionsKey is, but I really would try moving llStartAnimation and see it that improves anything.

Edited by Innula Zenovka
Link to comment
Share on other sites

55 minutes ago, gwenavive said:

interesting, i tested by removing the llStopAnimation all together and no more errors and also seems to go through each animation for each sitter, get off, crash and a new sitter, all works. So no idea what llStopAnimation is for then :)

the main thing is that you got it to work without getting errors.  Is a real sense of achievement, joy and happiness even, when we get to stuff to work. Might not be the most efficient script ever written but I will take working every time over not working. So good on you!

on the technicals that you have noticed

when a person stands, teleports away, crashes, or logs off while sitting on a object then the system tidies up (stops) all animations started by the object's script automagically. We don't have to script for when this happens

about animation priorities

when we start an animation, it plays over the top of any animation already playing  which has a lower or equal priority. What we see is the animation that has the highest priority, or we see the animation which was last started when the animations are of equal priority. In your case If all of your animations play as expected when you pick them from the pose stand controls then the animations have equal priority. They are all playing, you just see the last one started

when animations have different priorities then we have to stop them.  Like if a Priority 4 animation is playing and we want to change to a Level 3 animation then we have to stop the Prriority 4 animation so we can see the Priority 3 animation

the wiki entry about animation priority is here: http://wiki.secondlife.com/wiki/Animation_Priority

Link to comment
Share on other sites

Thanks Innula, i removed the llStopAnimation bit and all working now but also moved the start to the perms as suggested. Seems a lot cleaner i think :)

setAnimation(integer num) {
    current_animation = llList2String(list_animations,num);
    llRequestPermissions(claimed_key,PERMISSION_TRIGGER_ANIMATION);
    llStartAnimation(current_animation);    
}
 

    run_time_permissions (integer perm)
    {
        if(perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation(current_animation);      
        }
    }

 

  • Like 1
Link to comment
Share on other sites

Thanks Mollymews, well that could cause an issue as this will be for other makers to use and who knows what their animations are when the drop them in so best i sort this out with a stop then and also handle if someone tp's or crashes and that.

i know i can have a timer going to check each stand and probably from the server item but i was hoping to avoid that if at all possible due to what i think could cause more lag than required?

In a store there could easily be over 100 of these running at the same time. Currenly i only have about 15 in my store so small fry lol

Edited by gwenavive
Link to comment
Share on other sites

1 hour ago, gwenavive said:

Thanks Innula, i removed the llStopAnimation bit and all working now but also moved the start to the perms as suggested. Seems a lot cleaner i think :)

setAnimation(integer num) {
    current_animation = llList2String(list_animations,num);
    llRequestPermissions(claimed_key,PERMISSION_TRIGGER_ANIMATION);
   // llStartAnimation(current_animation);    
}
 

    run_time_permissions (integer perm)
    {
        if(perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation(current_animation);      
        }
    }

 

I would take it out of setAnimation completely, as indicated above.

I was trying to think of where permissions errors could come from, and that seemed an obvious place where, under particular circumstances, the script could try to start an animation without holding the necessary permissions from the right avatar.

Link to comment
Share on other sites

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