Jump to content

script for a drum


Pimiko
 Share

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

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

Recommended Posts

Hello!

I need help with script for a custom tribal drum. I made a drum and get a ball with drumming ao that quite well fits the drum and the sound, but the problem is the following: with ao ball attached the drum can't be transferred and when I inserted script from the ball directly to the drum it didn't work properly at all; also now it is impossible to stop sound so there should be opportunity to stop sound. Please, help.

 

Link to comment
Share on other sites

It's usually not practical to take a script from one object like that and just drop it into another one, especially if your object is supposed to have a sit target to position the av that clicked on it.  It's easier to just write one for yourself.  Basically all you need are the functions to start an animation, and loop a sound.  There's a good basic animation example at http://wiki.secondlife.com/wiki/LlStartAnimation and you can read about looping the sound at http://wiki.secondlife.com/wiki/LlLoopSound .  The only remaining thing is to put a llStopSound command in the script's changed event so that it stops when the av stands up.

Link to comment
Share on other sites

This will play either as an attatched drum, or if it is rezzed.

**assumes one sound and one animation in the drum's contents**

 

integer isPlaying = FALSE;
string anim;
integer tog;
default
{
    state_entry()
    {   anim = llGetInventoryName(INVENTORY_ANIMATION,0);          
    }     
    touch_start(integer total_number)
    { if( llGetAttached() )
      {  llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        if(isPlaying)
        {    llStopSound();
             llStopAnimation(anim);                         
             isPlaying = FALSE;
             llResetScript();
        }        
        else
        {   llLoopSound(llGetInventoryName(INVENTORY_SOUND, 0), 1.0);
            isPlaying = TRUE;
        }
      }
      else
      {  if(tog = !tog)
          llLoopSound(llGetInventoryName(INVENTORY_SOUND, 0), 1.0);
         else
           llStopSound();
      }
    }    
     run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {   llStartAnimation(anim);           
        }
    }
}

Link to comment
Share on other sites

If you are looking for someone to write a script for you, post in the InWorld Employment forum. This forum, the LSL Scripting forum, is a place for scripters to compare notes on things that they are writing, look for advice about how to solve specific problems, and trade ideas about better ways to write LSL scripts.  We do not post complete scripts except as examples, and we assume that we are posting for other scripters.

Link to comment
Share on other sites

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