Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Voice control light feature color

Jesseaitui Petion
king of polynesia :P
Join date: 2 Jan 2006
Posts: 2,175
10-29-2006 05:33
Is there a script floating around anywhere that can voice control the light feature COLOR? (Or if not, where one can click something to specify which color shines?)


For instance, currently I have an object that lights up blue; I would like for someone to be able to say "color pink" and the object to light up pink. Is this around anywhere?

If not im willing to pay for the script and I need it to be copy and transferrable.


I look fwd to a response... :D



(Now that I think about it, the ability to turn the light feature OFF via the same command route would be awesome too although I believe that one probably already exists; atleast I know it does by touch to turn on or off.)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
10-29-2006 06:50
I have a colour server script that would be useable. IM me if you'd like to talk about it, I'm not often on but can coem in if you wish to talk.
Thanto Usitnov
Lord Byron wannabe
Join date: 4 Aug 2006
Posts: 68
10-29-2006 10:32
This should do it:

CODE
//notes: the fields for PRIM_POINT_LIGHT are: TRUE/FALSE, vector color, float intensity, float radius, float falloff
//you can mess with the color, intensity, radius, and falloff as you wish.
//vector color is is <RED,GREEN,BLUE> from 0.0 to 1.0. That is, each value is a float.


default
{
state_entry()
{
llListen( 0, "", NULL_KEY, "" ); //listen for anything on channel 0
}
listen(integer channel, string name, key id, string message)
{
vector color; //color to be emitted
string colorStr;
if(llGetSubString(message,0,4)=="color")
{
colorStr = llToLower(llGetSubString(message,6,-1)); //color user says
integer toggle=TRUE; //whether light is on or off, defaults to on.
if (colorStr=="pink")
color=<1.0,0.5,0.5>;
else if (colorStr=="red")
color=<1,0.0,0.0>;
else if (colorStr=="orange")
color=<1.0,0.5,0.0>;
else if (colorStr=="yellow")
color=<1.0,1.0,0.0>;
else if (colorStr=="green")
color=<0.0,1.0,0.0>;
else if (colorStr=="blue")
color=<0.0,0.0,1.0>;
else if (colorStr=="purple" || color=="violet" || color=="magenta")
color=<1.0,0.0,1.0>;
else if (colorStr=="cyan")
color=<0.0,1.0,1.0>;
else if (colorStr=="off")
{
toggle=FALSE; //off
color=<0,0,0>; //doesn't really matter what it is, so long as its defined
}
//I think you get the idea now.
//this sets the light for the prim:
llSetPrimitiveParams([PRIM_POINT_LIGHT,toggle,color,1.0,1.0,0.5]);
}
}
}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
10-29-2006 15:43
Yep but I use lists.
Personally I wouldnt use chat activation, I prefer touch and menu/dialog not just because of the sim performance but also because its more self contained.

The script is a quick n dirty version, wouldnt use as is if I was selling it.
It is set up on Channel 9 and Owner Only.
i.e. /9Red will set it to Red.

Could easily be extened to support setting of radius, fall off etc.


CODE



float intensity = 1.0;
float radius = 10.0;
float falloff = 0.75;

vector on = <1.0,1.0,1.0>;
vector off = <0.0,0.0,0.0>;

key owner;


list lNames;
list lColours;

Init()
{
lNames = ["Alice Blue", "Antique White", "Aqua", "Aquamarine", "Azure", "Beige",
"Bisque", "Black", "Blanched Almond", "Blue", "Blue Violet",
"Brown", "Burly Wood", "Cadet Blue", "Chartreuse", "Chocolate",
"Coral", "Cornflower Blue", "Cornsilk", "Crimson", "Cyan",
"Dark Blue", "Dark Cyan", "Dark Golden Rod", "Dark Gray", "Dark Green",
"Dark Khaki", "Dark Magenta", "Dark Olive Green", "Dark Orange", "Dark Orchid",
"Dark Red", "Dark Salmon", "Dark Sea Green", "Dark Slate Blue", "Dark Slate Gray",
"Dark Turquoise", "Dark Violet", "Deep Pink", "Deep Sky Blue", "Dim Gray",
"Dodger Blue", "Feldspar", "Fire Brick", "Floral White", "Forest Green",
"Fuchsia", "Gainsboro", "Ghost White", "Gold", "Golden Rod",
"Gray", "Green", "Green Yellow", "Honey Dew", "Hot Pink",
"Indian Red", "Indigo", "Ivory", "Khaki", "Lavender",
"Lavender Blush", "Lawn Green", "Lemon Chiffon", "Light Blue", "Light Coral"] +
[ "Light Cyan", "Light Golden Rod Yellow", "Light Grey", "Light Green", "Light Pink",
"Light Salmon", "Light Sea Green", "Light Sky Blue", "Light Slate Blue", "Light Slate Gray",
"Light Steel Blue", "Light Yellow", "Lime", "Lime Green", "Linen",
"Magenta", "Maroon", "Medium Aqua Marine", "Medium Blue", "Medium Orchid",
"Medium Purple", "Medium Sea Green", "Medium Slate Blue", "Medium Spring Green", "Medium Turquoise",
"Medium Violet Red", "Midnight Blue", "Mint Cream", "Misty Rose", "Moccasin",
"Navajo White", "Navy", "Old Lace", "Olive", "Olive Drab",
"Orange", "Orange Red", "Orchid", "Pale Golden Rod", "Pale Green",
"Pale Turquoise", "Pale Violet Red", "Papaya Whip", "Peach Puff", "Peru",
"Pink", "Plum", "Powder Blue", "Purple", "Red",
"Rosy Brown", "Royal Blue", "Saddle Brown", "Salmon", "Sandy Brown",
"Sea Green", "Sea Shell", "Sienna", "Silver", "Sky Blue"] +
[ "Slate Blue", "Slate Gray", "Snow", "Spring Green", "Steel Blue",
"Tan", "Teal", "Thistle", "Tomato", "Turquoise",
"Violet", "Violet Red", "Wheat", "White", "White Smoke",
"Yellow", "Yellow Green" ];

lColours = [ <0.941176,0.972549,1.000000>, // Alice Blue
<0.980392,0.921569,0.843137>, // Antique White
<0.000000,1.000000,1.000000>, // Aqua
<0.498039,1.000000,0.831373>, // Aquamarine
<0.941176,1.000000,1.000000>, // Azure
<0.960784,0.960784,0.862745>, // Beige
<1.000000,0.894118,0.768627>, // Bisque
<0.000000,0.000000,0.000000>, // Black
<1.000000,0.921569,0.803922>, // Blanched Almond
<0.000000,0.000000,1.000000>, // Blue
<0.541176,0.168627,0.886275>, // Blue Violet
<0.647059,0.164706,0.164706>, // Brown
<0.870588,0.721569,0.529412>, // Burly Wood
<0.372549,0.619608,0.627451>, // Cadet Blue
<0.498039,1.000000,0.000000>, // Chartreuse
<0.823529,0.411765,0.117647>, // Chocolate
<1.000000,0.498039,0.313725>, // Coral
<0.392157,0.584314,0.929412>, // Cornflower Blue
<1.000000,0.972549,0.862745>, // Cornsilk
<0.862745,0.078431,0.235294>, // Crimson
<0.000000,1.000000,1.000000>, // Cyan
<0.000000,0.000000,0.545098>, // Dark Blue
<0.000000,0.545098,0.545098>, // Dark Cyan
<0.721569,0.525490,0.043137>, // Dark Golden Rod
<0.662745,0.662745,0.662745>, // Dark Gray
<0.000000,0.392157,0.000000>, // Dark Green
<0.741176,0.717647,0.419608>, // Dark Khaki
<0.545098,0.000000,0.545098>, // Dark Magenta
<0.333333,0.419608,0.184314>, // Dark Olive Green
<1.000000,0.549020,0.000000>, // Dark Orange
<0.600000,0.196078,0.800000>, // Dark Orchid
<0.545098,0.000000,0.000000>, // Dark Red
<0.913725,0.588235,0.478431>, // Dark Salmon
<0.560784,0.737255,0.560784>, // Dark Sea Green
<0.282353,0.239216,0.545098>, // Dark Slate Blue
<0.184314,0.309804,0.309804>, // Dark Slate Gray
<0.000000,0.807843,0.819608>, // Dark Turquoise
<0.580392,0.000000,0.827451>, // Dark Violet
<1.000000,0.078431,0.576471>, // Deep Pink
<0.000000,0.749020,1.000000>, // Deep Sky Blue
<0.411765,0.411765,0.411765>, // Dim Gray
<0.117647,0.564706,1.000000>, // Dodger Blue
<0.819608,0.572549,0.458824>, // Feldspar
<0.698039,0.133333,0.133333>, // Fire Brick
<1.000000,0.980392,0.941176>, // Floral White
<0.133333,0.545098,0.133333>, // Forest Green
<1.000000,0.000000,1.000000>, // Fuchsia
<0.862745,0.862745,0.862745>, // Gainsboro
<0.972549,0.972549,1.000000>, // Ghost White
<1.000000,0.843137,0.000000>, // Gold
<0.854902,0.647059,0.125490>, // Golden Rod
<0.501961,0.501961,0.501961>, // Gray
<0.000000,0.501961,0.000000>, // Green
<0.678431,1.000000,0.184314>, // Green Yellow
<0.941176,1.000000,0.941176>, // Honey Dew
<1.000000,0.411765,0.705882>, // Hot Pink
<0.803922,0.360784,0.360784>, // Indian Red
<0.294118,0.000000,0.509804>, // Indigo
<1.000000,1.000000,0.941176>] + // Ivory
[<0.941176,0.901961,0.549020>, // Khaki
<0.901961,0.901961,0.980392>, // Lavender
<1.000000,0.941176,0.960784>, // Lavender Blush
<0.486275,0.988235,0.000000>, // Lawn Green
<1.000000,0.980392,0.803922>, // Lemon Chiffon
<0.678431,0.847059,0.901961>, // Light Blue
<0.941176,0.501961,0.501961>, // Light Coral
<0.878431,1.000000,1.000000>,// Light Cyan
<0.980392,0.980392,0.823529>, // Light Golden Rod Yellow
<0.827451,0.827451,0.827451>, // Light Grey
<0.564706,0.933333,0.564706>, // Light Green
<1.000000,0.713725,0.756863>, // Light Pink
<1.000000,0.627451,0.478431>, // Light Salmon
<0.125490,0.698039,0.666667>, // Light Sea Green
<0.529412,0.807843,0.980392>, // Light Sky Blue
<0.517647,0.439216,1.000000>, // Light Slate Blue
<0.466667,0.533333,0.600000>, // Light Slate Gray
<0.690196,0.768627,0.870588>, // Light Steel Blue
<1.000000,1.000000,0.878431>, // Light Yellow
<0.000000,1.000000,0.000000>, // Lime
<0.196078,0.803922,0.196078>, // Lime Green
<0.980392,0.941176,0.901961>, // Linen
<1.000000,0.000000,1.000000>, // Magenta
<0.501961,0.000000,0.000000>, // Maroon
<0.400000,0.803922,0.666667>, // Medium Aqua Marine
<0.000000,0.000000,0.803922>, // Medium Blue
<0.729412,0.333333,0.827451>, // Medium Orchid
<0.576471,0.439216,0.847059>, // Medium Purple
<0.235294,0.701961,0.443137>, // Medium Sea Green
<0.482353,0.407843,0.933333>, // Medium Slate Blue
<0.000000,0.980392,0.603922>, // Medium Spring Green
<0.282353,0.819608,0.800000>, // Medium Turquoise
<0.780392,0.082353,0.521569>, // Medium Violet Red
<0.098039,0.098039,0.439216>, // Midnight Blue
<0.960784,1.000000,0.980392>, // Mint Cream
<1.000000,0.894118,0.882353>, // Misty Rose
<1.000000,0.894118,0.709804>, // Moccasin
<1.000000,0.870588,0.678431>, // Navajo White
<0.000000,0.000000,0.501961>, // Navy
<0.992157,0.960784,0.901961>, // Old Lace
<0.501961,0.501961,0.000000>, // Olive
<0.419608,0.556863,0.137255>, // Olive Drab
<1.000000,0.647059,0.000000>, // Orange
<1.000000,0.270588,0.000000>, // Orange Red
<0.854902,0.439216,0.839216>, // Orchid
<0.933333,0.909804,0.666667>, // Pale Golden Rod
<0.596078,0.984314,0.596078>, // Pale Green
<0.686275,0.933333,0.933333>, // Pale Turquoise
<0.847059,0.439216,0.576471>, // Pale Violet Red
<1.000000,0.937255,0.835294>, // Papaya Whip
<1.000000,0.854902,0.725490>, // Peach Puff
<0.803922,0.521569,0.247059>, // Peru
<1.000000,0.752941,0.796078>, // Pink
<0.866667,0.627451,0.866667>, // Plum
<0.690196,0.878431,0.901961>, // Powder Blue
<0.501961,0.000000,0.501961>, // Purple
<1.000000,0.000000,0.000000>, // Red
<0.737255,0.560784,0.560784>, // Rosy Brown
<0.254902,0.411765,0.882353>, // Royal Blue
<0.545098,0.270588,0.074510>]+ // Saddle Brown
[<0.980392,0.501961,0.447059>, // Salmon
<0.956863,0.643137,0.376471>, // Sandy Brown
<0.180392,0.545098,0.341176>, // Sea Green
<1.000000,0.960784,0.933333>, // Sea Shell
<0.627451,0.321569,0.176471>, // Sienna
<0.752941,0.752941,0.752941>, // Silver
<0.529412,0.807843,0.921569>, // Sky Blue
<0.415686,0.352941,0.803922>, // Slate Blue
<0.439216,0.501961,0.564706>, // Slate Gray
<1.000000,0.980392,0.980392>, // Snow
<0.000000,1.000000,0.498039>, // Spring Green
<0.274510,0.509804,0.705882>, // Steel Blue
<0.823529,0.705882,0.549020>, // Tan
<0.000000,0.501961,0.501961>, // Teal
<0.847059,0.749020,0.847059>, // Thistle
<1.000000,0.388235,0.278431>, // Tomato
<0.250980,0.878431,0.815686>, // Turquoise
<0.933333,0.509804,0.933333>, // Violet
<0.815686,0.125490,0.564706>, // Violet Red
<0.960784,0.870588,0.701961>, // Wheat
<1.000000,1.000000,1.000000>, // White
<0.960784,0.960784,0.960784>, // White Smoke
<1.000000,1.000000,0.000000>, // Yellow
<0.603922,0.803922,0.196078>]; // Yellow Green
}
LightOn()
{
llSetColor(on,ALL_SIDES);

llSetPrimitiveParams([

PRIM_FULLBRIGHT, ALL_SIDES, TRUE,
// PRIM_MATERIAL, PRIM_MATERIAL_LIGHT,
//PRIM_COLOR, 0, on,
PRIM_POINT_LIGHT, TRUE, on, intensity, radius, falloff
]);

}

LightOff()
{
llSetColor(off,ALL_SIDES);
llSetPrimitiveParams([

PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
// PRIM_MATERIAL, PRIM_MATERIAL_LIGHT,
//PRIM_COLOR, 0, off,
PRIM_POINT_LIGHT, FALSE, off, intensity, radius, falloff
]);

}


default
{
state_entry()
{
Init();
owner = llGetOwner();
llListen(9,"",owner,"");
}

on_rez(integer number) { llResetScript();}

changed(integer change) { if (change & CHANGED_OWNER) llResetScript();}

listen(integer channel, string name, key id, string message)
{
string m = llToLower(message);
if (m == "on")
{
LightOn();
}
else if (m == "off")
{
LightOff();
}
else
{
integer selection = llListFindList(lNames, [message]);
if(selection >= 0)
{
on = llList2Vector(lColours,selection);
LightOn();
}
}
}
}
Jesseaitui Petion
king of polynesia :P
Join date: 2 Jan 2006
Posts: 2,175
10-29-2006 15:48
Thanks alot you guys! I`ll try to go through and see if I can edit to my exact needs; im not too good with scripting but atleast I have something to work with!

Thanks again






Edit Thanto- I got a type mismatch error with yours.

Should be:

CODE

//notes: the fields for PRIM_POINT_LIGHT are: TRUE/FALSE, vector color, float intensity, float radius, float falloff
//you can mess with the color, intensity, radius, and falloff as you wish.
//vector color is is <RED,GREEN,BLUE> from 0.0 to 1.0. That is, each value is a float.


default
{
state_entry()
{
llListen( 0, "", NULL_KEY, "" ); //listen for anything on channel 0
}
listen(integer channel, string name, key id, string message)
{
vector color; //color to be emitted
string colorStr;
if(llGetSubString(message,0,4)=="color")
{
colorStr = llToLower(llGetSubString(message,6,-1)); //color user says
integer toggle=TRUE; //whether light is on or off, defaults to on.
if (colorStr=="pink")
color=<1.0,0.5,0.5>;
else if (colorStr=="red")
color=<1,0.0,0.0>;
else if (colorStr=="orange")
color=<1.0,0.5,0.0>;
else if (colorStr=="yellow")
color=<1.0,1.0,0.0>;
else if (colorStr=="green")
color=<0.0,1.0,0.0>;
else if (colorStr=="blue")
color=<0.0,0.0,1.0>;
else if (colorStr=="purple")
color=<1.0,0.0,1.0>;
else if (colorStr=="cyan")
color=<0.0,1.0,1.0>;
else if (colorStr=="off")
{
toggle=FALSE; //off
color=<0,0,0>; //doesn't really matter what it is, so long as its defined
}
//I think you get the idea now.
//this sets the light for the prim:
llSetPrimitiveParams([PRIM_POINT_LIGHT,toggle,color,1.0,1.0,0.5]);
}
}
}