Remote Color Control

Written by: Headmaster

Remote color control with menu"

Object:

vector red = <0.86,0.0,0.14>; 
vector green  = <0,0.9,0>; 
vector white  = <1,1,1>;
vector black  = <0.12,0.1,0.12>;
vector steel  = <0.27,0.51,0.71>;
vector blue  = <0.1,0.31,0.98>;
vector orange  = <1,.6,0>;
vector yellow  = <1,1,0.1>;
vector brown  = <0.5,0.25,0>;
vector pink  = <0.85,0,0.75>;
vector purple  = <0.8,0.21,0.8>;
vector lime  = <0.18,0.75,0.34>;
vector sky  = <0.53,0.81,0.92>;
vector lavander  = <0.2,0.2,0.4>;

default
{
    state_entry()
    {
                llSetStatus(STATUS_PHANTOM, TRUE);
 llListen(913, "", NULL_KEY, "" );
    }
    
    on_rez(integer num)
    {
        llResetScript();
    }

    listen(integer number, string name, key id, string message)
    {        //--------------LightEffects----------
       
if(message=="redl")
        {
            llSetColor(red, ALL_SIDES);
        }
        if(message=="greenl")
        {
            llSetColor(green, ALL_SIDES);
        }
        if(message=="lavanderl")
        {
            llSetColor(lavander, ALL_SIDES);
        }
        if(message=="skyl")
        {
            llSetColor(sky, ALL_SIDES);
        }
        if(message=="purplel")
        {
            llSetColor(purple, ALL_SIDES);
        }
        if(message=="limel")
        {
            llSetColor(lime, ALL_SIDES);
        }
        if(message=="brownl")
        {
            llSetColor(brown, ALL_SIDES);
        }
        if(message=="orangel")
        {
            llSetColor(orange, ALL_SIDES);
        }
        if(message=="steell")
        {
            llSetColor(steel, ALL_SIDES);
        }
        if(message=="whitel")
        {
            llSetColor(white, ALL_SIDES); 
        }
        if(message=="blackl")
        {
            llSetColor(black, ALL_SIDES);
        }
        if(message=="bluel")
        {
            llSetColor(blue, ALL_SIDES);
        }
        if(message=="yellowl")
        {
            llSetColor(yellow, ALL_SIDES);
        }
        if(message=="pinkl")
        {
            llSetColor(pink, ALL_SIDES);
        }
        if(message=="greenl")
        {
            llSetColor(green, ALL_SIDES); 
        }  
                if(message=="off")
        {
            llSetColor(white, ALL_SIDES); 
        }

        }

}

 

Remote:

integer menu_handler;
integer menu_channel;

menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
    menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,buttons,menu_channel);
    llSetTimerEvent(5.0);
}

default
{
state_entry()
    { llSetTouchText("Remote!");
    }
    touch_start(integer t)
    {
        menu(llDetectedKey(0),"Choose a color from the List below...",["white","red","green","blue","steel","orange","yellow","pink","purple","sky","lavander","OFF"]);
    }
    timer() //so the menu timeout and close its listener
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) //in case you have others listeners
        {
           integer c_channel = 913;//-----THIS IS THE CHANNEL FOR COMMANDS----
            if(message == "white")
            {
        llShout(c_channel, "whitel");
            }
            else if(message == "red")
            {
        llShout(c_channel, "redl");
            }

            else if(message == "green")
            {
        llShout(c_channel, "greenl");
            }        
            else if(message == "blue")
            {
        llShout(c_channel, "bluel");
            }
            else if(message == "black")
            {
        llShout(c_channel, "blackl");
            }                
            else if(message == "steel")
            {
        llShout(c_channel, "steell");
            }
            else if(message == "orange")
            {
        llShout(c_channel, "orangel");        
            }
            else if(message == "yellow")
            {
        llShout(c_channel, "yellowl");                                
            }
            else if(message == "purple")
            {
        llShout(c_channel, "purplel");                                                                      }                                                              
            else if(message == "pink")
            {
        llShout(c_channel, "pinkl");                                                                      }                 
            else if(message == "lime")
            {
        llShout(c_channel, "limel");                                                                      }                         
            else if(message == "sky")
            {
        llShout(c_channel, "skyl");                                                                      }                                 
            else if(message == "lavander")
            {
        llShout(c_channel, "lavanderl");                                                                      }        
                                  else if(message == "OFF")
            {
        llShout(c_channel, "off");                                                                                                
                                                                 
        }
    }
}}

 

Category: