Jump to content
  • 0

Sound for each animation Script


Sunbleached
 Share

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

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

Question

Hello! I want to create a script that allows you to make sounds for each animation. Running, jumping, swimming, walking etc. Like a simple walker, only more animations/sounds. I was advised to use this script http://wiki.secondlife.com/wiki/LlGetAnimation. But I did not quite manage to adapt it for sounding. Please tell where the error is. I wrote on the forum. Thanks for any help.

string SOUND_WALK = "34eae688-8b2d-d86c-5c1e-4e3eb865ca0d";
string SOUND_RUN = "b1c0f5e2-45e5-e0b2-926a-fd60520ed4ee";
 
key gOwner;
string gLastAnimation;
 

 
Initialize(key id) {
    if (id == NULL_KEY) {
        llSetTimerEvent(0.0); 
    }
    else { 
        llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
        gOwner = id;
    }
}
 
 

 
default
{
    state_entry() {
        
        if (llGetAttached() != 0) {
            Initialize(llGetOwner());
        }
    }
 
    attach(key id) {
        Initialize(id);
    }
 
    run_time_permissions(integer perm) {
        if (perm & PERMISSION_TRIGGER_ANIMATION) {
            llSetTimerEvent(0.25); 
        }
    }
 
    timer() {
        string newAnimation = llGetAnimation(gOwner);
 
        if (gLastAnimation != newAnimation) 
        { 
            if (newAnimation == "Walking") 
            {
                llLoopSound( SOUND_WALK, 1.0);
            }
             if (gLastAnimation == "Running") 
             
             { 
                llLoopSound( SOUND_RUN, 1.0);
            }
            
          else
            {
                llStopSound();
                }
 
            gLastAnimation = newAnimation;
        }
    }
}
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

The function llGetAgentInfo is used to find when the avatar is walking, running, flying, sitting, etc. The script has to continually poll the system to know when state changes, You can look at an older AO script to get the polling code.

The script you have is pretty much useless for your need.

I suggest you post in the Tech section where scripters are likely to see your request. Not many scripters in Answers.

Builder's Brewery may have a script in their library that will do the job. Plus there are several LSL libraries on the web.

  • Like 2
Link to comment
Share on other sites

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