Rainbow Color Changer

// Place in contents of a prim. Touch to start or stop

integer ON = FALSE;
integer loop;
float x;
default
{
    touch_start(integer total_number)
    {
        llSetTimerEvent(0.5*(ON = !ON));
        loop = 1;
        x = 0;
    }

    timer()
    {
        if(loop == 1)
        {
            llSetColor(<1 ,0.2*x,0>,ALL_SIDES);
            x = x+0.25;
            if (x > 5)
            {
                loop = 2;
                x = 5;
            }
        }
        else if (loop ==2)
        {
            llSetColor(<0.2*x,1,0>,ALL_SIDES);
            x = x-0.25;
            if(x <0)
            {
                loop = 3;
                x = 1;
            }
        }
        else if (loop == 3)
        {
            llSetColor(<0,1.0-(0.2*x),0.2*x>,ALL_SIDES);
            x = x+0.25;
            if(x > 5)
            {
                loop = 4;
                x = 5;
            }
        }
        else if (loop == 4)
        {
            llSetColor(<1 .0-(0.2*x),0,1>,ALL_SIDES);
            x = x-0.25;
            if(x <0)
            {
                loop = 5;
                x = 1;
            }
        }
        else if (loop == 5)
        {
            llSetColor(<1,0,1.0-(0.2*x)>,ALL_SIDES);
            x = x+0.25;
            if (x > 5)
            {
                loop = 1;
                x = 0;
            }
        }
    }
}

 

Add a comment

Quick Change Color Changer

From Hank Ramos on the LSL script forum: Here is an extremely laggy version, but cool looking..

 

default
{
    state_entry()
    {
        while (TRUE)
        {
            llSetColor(, ALL_SIDES);
        }
    }
}

 

Add a comment

Color change Script with Timer

vector FIRST_COLOR = <1 .0,0.0,0.0>;
vector SECOND_COLOR = <0.0,1.0,0.0>;

float TIMER_INTERVAL = 1.0;

default {
   state_entry() {
      //
      //   all states will hear this timer until one of them
      //   stops it using llSetTimerEvent( 0.0 )
      //
      llSetTimerEvent( TIMER_INTERVAL );
      //
      // start the color cycle
      //
      state first_color;
   }
}

state first_color {
     state_entry() {
        llSetColor( FIRST_COLOR, ALL_SIDES );
     }

     timer() {
        state second_color;
     }
}

state second_color {
     state_entry() {
        llSetColor( SECOND_COLOR, ALL_SIDES );
     }

     timer() { 
        state first_color;
     }
}

 

Add a comment

Tint on Touch

// Simple opacity level changing script.
// Script cycles through the values on touch.
//
// Kimm Paulino
// Written for Tanisha Benoir, Feb 2012
 
integer gLowestLevel = 0;    // This is the most transparent setting (0, 1, 2, etc)
integer gSteps = 4;          // This is the number of steps to support
 
// Do not change below here
integer gOpacityLevel = 0;  
 
default
{
    on_rez (integer start_param)
    {
        llResetScript();
    }
 
    touch_start(integer num_detected)
    {
        gOpacityLevel++;
        if (gOpacityLevel > gSteps)
        {
            gOpacityLevel = gLowestLevel;
        }
        float opacity = (1.0/(float)gSteps) * gOpacityLevel;
        llSetAlpha(opacity, ALL_SIDES);
    }
}

 

Add a comment