Jump to content

Hold script?


Catwise Yoshikawa
 Share

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

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

Recommended Posts

Hi,

I'm looking for a script to hold attachment objects that keeps animating even when using AO. I was searching around this forum and couldn't find it, not sure if it even exist ^^'
The object animation and the AO animations are in 4 priority, so guess I'll need an script that reset itself after few seconds or something like that. Right now when I'm holding a glass sometimes is right and sometimes I'm keeping the glass in my belly :p

thanx

Link to comment
Share on other sites


Catwise Yoshikawa wrote:

OK, so there is no hold script better than the one every attached object has already ^^' Just wanted to be sure
:P

thanx

Void was right, a timer should solve your problem (except for the odd priority 4 animation that refuses to be overriden by any other priority 4 animation). The script could look something like this:

 

startup()

{

    llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);

    llSetTimerEvent(1);

}

default

{

    state_entry()

    {

        startup();

    }

    on_rez(integer nevermind)

    {

        startup();

    }   

    timer()

    {

        string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);

        llStopAnimation(anim);

        llStartAnimation(anim);

    }

}

Link to comment
Share on other sites

Extending on Ishtara's suggestion, one could perfect "The War of Animations", you could make sure the unruly other prio 4 animations gets killed on a regular basis :smileywink:

 

 

string anim;startup(){    llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);    anim = llGetInventoryName(INVENTORY_ANIMATION, 0);    llSetTimerEvent(1);}default{    state_entry()    {        startup();    }    on_rez(integer nevermind)    {        startup();    }       timer()    {        list vlAnim = llGetAnimationList(llGetOwner());        integer viI 0;        for (; viT < llGetListLength(vlAnim); ++viI) {	    llStopAnim(llList2String(vlAnim, viI));        }        llStartAnimation(anim);    }}

 

 

Link to comment
Share on other sites

This is perfect, except for a few typos in the timer event :)

 

    timer()
    {
        list vlAnim = llGetAnimationList(llGetOwner());
        integer viI = 0;
        for (; viI < llGetListLength(vlAnim); ++viI) {
        llStopAnimation(llList2String(vlAnim, viI));
        }
        llStartAnimation(anim);
    }

 

Link to comment
Share on other sites

Thanks for fixing the typos - though I meant it as a bad example of how to do it, having the two anims to struggle over control, using two AOs. This will only cause lag - especially since you would have to shorten the timer to 0.2 or 0.1 to get good results - most AOs will fight back on a 0.25 sec basis ;)

Two ways that are much better that I can think off:

 

  • switch off your AO while at a cocktail party.
  • since most AO's can be configured to play different sets of animations, just add one configuration that only has the glass holding as the only standing animation
Link to comment
Share on other sites

if one really wanted to dive into the depths, they could add a bit of code to the AO that spouts the animation state on a particular channel, and attachments could listen for it and play their own animations to go with that state.... and by default they'd happen after, so could override the AO animations in a timely fashion.

.... not that i haven't suggested the idea before...

Link to comment
Share on other sites

  • 8 years later...

So this is an old old topic and maybe the people who were in the conversation so long ago are no longer active, but it seems to address the scripting topic I need.  Having said that, I am a totally novice scripter (that is to say, green as grass!) and I am sure my total ignorance is all that's in my way  :)
 

So I have an object which, when it is attached to my hand, I want my hand to stretch out with the object attached, as if holding it.  And I have added a script file containing the data provided above by Ishtara Rothschild:

startup()

{

    llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);

    llSetTimerEvent(1);

}

default

{

    state_entry()

    {

        startup();

    }

    on_rez(integer nevermind)

    {

        startup();

    }   

    timer()

    {

        string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);

        llStopAnimation(anim);

        llStartAnimation(anim);

    }

}

And when I then attach the object to my hand, even when not wearing an AO, nothing at all happens.  So please, what am I not understanding?

 

 

Link to comment
Share on other sites

I gave this a quick test with no AO and using a random animation - and it worked for the most part (setting aside the lack of a run_time_permissions event for now). I can think of four possible reasons why you might not be seeing anything even without your AO running:

Firstly, are you in an area that has scripts enabled? Land owners can disable outside scripts from running (with a few exceptions). You can check in the About Land popup (right click the terrain) and look at the options tab to see if "Run Scripts" is checked for Everyone. Or look in the top URL bar on the viewer and see if the parcel properties icons are visible (if not, right click the bar > show parcel properties). Those will show you what options are disabled.

Secondly, are you sure you've removed all other objects that can potentially animate your avatar? To be absolutely sure, remove all attachments and even click the menu option Me > Movement > Stop Animating Me. This should help ensure you're in a clean state with no animations playing. After doing that, attach your test object.

Did you place your animation into the object's inventory? The animation must exist in the same prim as the script in order for the script to find it. Though it's pretty obvious if this is the problem because you'll get a torrent of Script Waring/Error messages saying it "Could not find animation ''."

The other possibility is that the holding animation you are starting isn't a single frame pose - or it has a lengthy ease-in period. Meaning it might be taking longer for the animation to actually visibly affect your avatar. Since you are running on such a short timer, you may be stopping it before it has a chance to visibly play. As a test, try lengthening the timer duration

It should be noted that you may still encounter problems when running with an AO due to the animations' priorities. If the AO animation's priorities are higher than your hold animation, it won't show through regardless.

Edited by Fenix Eldritch
Link to comment
Share on other sites

12 hours ago, Fenix Eldritch said:

Did you place your animation into the object's inventory? The animation must exist in the same prim as the script in order for the script to find it. Though it's pretty obvious if this is the problem because you'll get a torrent of Script Waring/Error messages saying it "Could not find animation ''."

Oops!  I think I may be starting to understand what's wrong with what I am doing.  This script is not an animation, then?  It's just a script to make an animation run in a certain way?  Oh dear...  though I didn't get any messages saying "Could not find animation..."   But anyway...  I think I need to find a holding animation to run with the script!

Could this be an appropriate animation?  It seems to hold with two hands, but that's ok.  https://marketplace.secondlife.com/p/Hold-Animations-full-perm/13416484

I'm VERY new at this, so don't laugh toooo hard  *giggle*  

Link to comment
Share on other sites

Yes indeed.  That is an animation.  You may buy anims in Marketplace or from shops in world.   Personally, I prefer shopping in world because most merchants have vendors that allow you to sample many anims, one after another, to see how well they work for your avatar.  Just as in RL, you will find that a set of motions that looks natural and attractive for one person is inappropriate or clumsy-looking when someone else uses it.  An animation is as much an expression of your personality as your skin and clothing preferences, so it makes sense to shop for ones that feel right for you.

Animations can be activated without a script (by double clicking in them in your inventory to open the anim's control panel and then clicking the button to make it visible in world) but most anims are activated by scripts or gestures.  You can put anims into a a scripted HUD called an Animation Overrider (AO), or into scripted furniture or other objects.  If you are already using an AO for other standard animations (like walking, sitting, flying ...), you will often need to turn the AO off to keep it from interfering with other animations.

Study this Knowledge Base article for other information:

 

Link to comment
Share on other sites

5 hours ago, Rolig Loon said:

Yes indeed. 

Thank you SO much for all that detail, Rolig, I learned a lot and I will check out the Knowledge Base article too.  I have an AO but it was already made so I didn't have to know much about it, so this is my chance to really learn a few things now.  I will, as you suggest, look around in world too.  And I will keep coming back to what you have said here.  I really appreciate it all, and hopefully others will find this useful in the future too (which is how I came across this old thread with a google search in the first place!)

Link to comment
Share on other sites

The script shown in this thread has a couple bugs in it too.

  • It requests permissions when the script starts.
    • It will not check whether or not the object is attached to an avatar.
  • It does not rely on the run_time_permissions event.
    • It will assume the script will be automatically granted permissions.

If the an object with that script in it is rezzed on the ground, it will make a permission request and try to play an animation 1 second later (because of the timer), causing an error that repeats every second until the permissions are accepted.

Link to comment
Share on other sites

  • 3 months later...
On 3/9/2020 at 12:18 AM, Wulfie Reanimator said:

The script shown in this thread has a couple bugs in it too.

  • It requests permissions when the script starts.
    • It will not check whether or not the object is attached to an avatar.
  • It does not rely on the run_time_permissions event.
    • It will assume the script will be automatically granted permissions.

If the an object with that script in it is rezzed on the ground, it will make a permission request and try to play an animation 1 second later (because of the timer), causing an error that repeats every second until the permissions are accepted.

Yes, I tried the script and faced both the issues.

I tried with a priority 4 animation with my AO in both  ON and OFF condition.

It tries to animate also when the object is rezzed to ground. Also the animation starts whether or not permission is granted.

Is there a fix ?

Link to comment
Share on other sites

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