Great remote with menu for a light switch.
Light:
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(788, "", NULL_KEY, "" );
}
on_rez(integer num)
{
llResetScript();
}
listen(integer number, string name, key id, string message)
{ //--------------LightEffects----------
if(message=="redl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, red, 1.0, 20.0, 0.75]);
}
if(message=="greenl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, green, 1.0, 20.0, 0.75]);
}
if(message=="whitel")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, white, 1.0, 20.0, 0.75]);
}
if(message=="blackl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, black, 1.0, 20.0, 0.75]);
}
if(message=="steell")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, steel, 1.0, 20.0, 0.75]);
}
if(message=="bluel")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, blue, 1.0, 20.0, 0.75]);
}
if(message=="orangel")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, orange, 1.0, 20.0, 0.75]);
}
if(message=="yellowl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, yellow, 1.0, 20.0, 0.75]);
}
if(message=="brownl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, brown, 1.0, 20.0, 0.75]);
}
if(message=="pinkl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, pink, 1.0, 20.0, 0.75]);
}
if(message=="purplel")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, purple, 1.0, 20.0, 0.75]);
}
if(message=="limel")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, lime, 1.0, 20.0, 0.75]);
}
if(message=="skyl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, sky, 1.0, 20.0, 0.75]);
}
if(message=="lavanderl")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, lavander, 1.0, 20.0, 0.75]);
}
if(message=="off")
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <0,0,0>, 1.0, 0.0, 0.0]);
}
}
}
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 = 788;//-----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");
}
}
}}
>
>