Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

blink light on / off

Darkwolf Allen
Registered User
Join date: 11 Feb 2007
Posts: 10
06-18-2008 11:02
Ok, working on a light set, got the lights where they will change color via remote, but how the heck do ya get them to blink on/off?

Any help appreciated.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-18-2008 11:16
Depends what "on" and "off" means. Assuming this is supposed to be more than just darker and brighter colors, some relevant parameters to llSetPrimitiveParams or llSetLinkPrimitiveParams might be PRIM_FULLBRIGHT, PRIM_GLOW, and possibly PRIM_POINT_LIGHT. (If they're really *blinking* constantly, might consider using texture animation instead, to minimize lag.)
_____________________
Archived for Your Protection
Cryas Tokhes
Great Googley Moogley...
Join date: 8 Feb 2006
Posts: 124
06-18-2008 11:23
Qie is correct, though PRIM_GLOW hasn't been implemented on all Clients yet. So some of the client compilers will not allow it.
Darkwolf Allen
Registered User
Join date: 11 Feb 2007
Posts: 10
06-18-2008 11:24
Basically, right now, ive got a script that changes the colors of the lights, but what I need is for them to go on/off ( basically remove the prim being used for the lights, then rerez it?) but not sure how to get that to work.
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
06-18-2008 11:28
From: Darkwolf Allen
...not sure how to get that to work.
Reread post #2.
Darkwolf Allen
Registered User
Join date: 11 Feb 2007
Posts: 10
06-18-2008 11:30
Ya, trying to find the wiki so i can look them up lol .. formatted comp, and lost my link to the wiki, and cant find it
Atom Burma
Registered User
Join date: 30 May 2006
Posts: 685
06-18-2008 11:33
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
{
on_rez(integer param){
llResetScript();
}
state_entry()
{
llSetTimerEvent(0.03);
}

timer()
{
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, white, 3.0, 3.0, 0.0]);
llSleep(0.01);
llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, black, 3.0, 3.0, 0.0]);
llSleep(0.1);
}
}

That's how I made a strobe light, just switch from white to black, don't use die and rez, thats crazy for what you need really. If black isn't dark anough then just switch the variable to false
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
06-18-2008 11:34
Here's an example of setting various prim attributes to a light on, and light off, effect...

On:

llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1.0, 1.0, 1.0>, 10.0, 5.0, 0.25,
PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, llGetAlpha(ALL_SIDES),
PRIM_GLOW, ALL_SIDES, 1.0]);


Off:

llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <0, 0, 0>, 0.0, 0.0, 0.0,
PRIM_COLOR, ALL_SIDES, <0.0, 0.0, 0.0>, llGetAlpha(ALL_SIDES),
PRIM_GLOW, ALL_SIDES, 0.0]);

...and 'removing a prim' can be simply achieved with llSetAlpha(0.0, ALL_SIDES)...which will make it invisible.

However, the Wiki at: looks a bit Tom and Dick right now.
Liznwiz Wei
Registered User
Join date: 9 Dec 2006
Posts: 69
06-18-2008 11:34
I think this is the link to the Wiki

http://rpgstats.com/wiki/index.php?title=Main_Page
_____________________
Visit Travitown for a new shopping experience

http://slurl.com/secondlife/Travitown/156/62/22
Darkwolf Allen
Registered User
Join date: 11 Feb 2007
Posts: 10
06-18-2008 11:44
Ok, reviewing what everyone has posted, llSetAlpha(0.0, ALL_SIDES) , gets the effect im looking for, just have to figure out how to work it into my current script.

Currently the script "listens" for my remote to tell it what color it should use, then it stays that color. Now I need to work in the llSetAlpha(0.0, ALL_SIDES) so that it will "blink" on off.

Current script:


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(500, "remote button 1", NULL_KEY, "" ); //Channel, and sending prim name
}

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);
}

}

}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-18-2008 12:11
Might I suggest a list-based approach rather than the huge number of consecutive if statements? Like so:

CODE

vector WHITE = <1.0, 1.0, 1.0>;
list COLORS =
[ "redl", <0.86,0.0,0.14>,
"greenl", <0,0.9,0>,
"whitel", WHITE,
"blackl", <0.12,0.1,0.12>,
"steell", <0.27,0.51,0.71>,
"bluel", <0.1,0.31,0.98>,
"orangel", <1,.6,0>,
"yellowl", <1,1,0.1>,
"brownl", <0.5,0.25,0>,
"pinkl", <0.85,0,0.75>,
"purplel", <0.8,0.21,0.8>,
"limel", <0.18,0.75,0.34>,
"skyl", <0.53,0.81,0.92>,
"lavanderl", <0.2,0.2,0.4>
];

default
{
state_entry()
{
llSetStatus(STATUS_PHANTOM, TRUE);
llListen(500, "remote button 1", NULL_KEY, "" ); //Channel, and sending prim name
}

on_rez(integer num)
{
llResetScript();
}

listen(integer number, string name, key id, string message)
{ //--------------LightEffects----------
integer colorIndex = llListFindList(COLORS, [ message ]);
if (colorIndex >= 0)
{
vector color = llList2Vector(COLORS, colorIndex+1);
llSetColor(color, ALL_SIDES);
} else if(message=="off")
{
llSetColor(WHITE, ALL_SIDES);
}
}
}
Darkwolf Allen
Registered User
Join date: 11 Feb 2007
Posts: 10
06-18-2008 12:14
Figured it out as a separate script, that I can put into the same prim.


integer USE_COLOR_1;

default {
state_entry() {
USE_COLOR_1 = FALSE;
llSetTimerEvent( .2);// change blink speed here.. it's set to blink every .2 seconds
}

timer() {
if (USE_COLOR_1)
llSetAlpha(1.0, ALL_SIDES);
else
llSetAlpha(0.0, ALL_SIDES);


USE_COLOR_1 = !USE_COLOR_1;
}
}

Thanks all, if anyone has any ideas on how to integrate into the previous script ( few scripts = less lag) please advise
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
06-18-2008 23:49
Instead of using fixed color names just send the color vector you want to set.

Then you won't need to use lists or bloated if constructs.
Darkwolf Allen
Registered User
Join date: 11 Feb 2007
Posts: 10
06-19-2008 08:51
Im in the process of making "something" (not sure what to call it other then a complicated light system) that will allow the owners to change the colors.

Its a bit complicated, but will be trying out what Hewee has said ( which may work).