Jump to content

Script for loudspeaker


Sunbleached
 Share

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

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

Recommended Posts

Hello! I'm looking for a script to simulate the work of the loudspeakers. I managed to find two scripts that move the object forward backward. But they do not work on linked objects. I decided to try a method with texture animation. Question is how this script should look like slightly stretching - reducing the picture (speaker)?  Please help!

llSetTextureAnim(ANIM_ON | SMOOTH | SCALE | PING_PONG | LOOP, ALL_SIDES, 1, 1, 1.0, 3.0, 2.0);

As I understand there must be this line. And I can not make it the on / off.

integer textureIsBeingAnimated;
 
default
{
    touch_start(integer num_detected)
    {
        if (textureIsBeingAnimated)
            llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 1, 5, 0.0, 0.0, 1.0);
        else
            llSetTextureAnim(ANIM_ON | SMOOTH, ALL_SIDES, 1, 5, 5.0, 1.0, 1.0);
 
        // toggle back and forth between TRUE (1) and FALSE (0)
        textureIsBeingAnimated = !textureIsBeingAnimated;
    }
}


 
Edited by Sunbleached
  • Thanks 1
Link to comment
Share on other sites

I found answer already but any suggestions are welcome! Thanks!

integer gON;

default

{   

 touch_start(integer num)    
 
 {        gON = !gON;  
 
 //  Here's the switch ...       
  if (gON)   
 //  So, let's test it ....        
 {    llSetTextureAnim(ANIM_ON | SMOOTH | SCALE | PING_PONG | LOOP, ALL_SIDES, 1, 1, 1.0, 3.0, 2.0);        
 //  It's on.        
 }        
 
 else        {    llSetTextureAnim(FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0);      
 //  It's not.        
}   
}
}

 

 

  • Thanks 1
Link to comment
Share on other sites

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