Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

on/off for track lighting

Roobus Newt
Registered User
Join date: 9 Oct 2006
Posts: 40
01-04-2008 12:04
built some track lighting, and want to have the 3 bulbs light whenever the linked prims are touch. I have searched and can't find what I am looking for. Could someone please point me in the right direction.

Also, built a chandelier that rotates and want to be able to turn the rotation on/off also.

Any help is appreciated. Thank.s
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
01-04-2008 13:06
For the track ligts, the script is the same, in general, as any other touch-activated lamp switch. Simply put the script in each bulb for the lighting action, and use llLinkMessage to send the commands to the linked bulbs.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Roobus Newt
Registered User
Join date: 9 Oct 2006
Posts: 40
thanks
01-05-2008 10:58
all right... i'll research the linkmessage since I obviously know very little LSL. Thanks for the info.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-05-2008 12:11
the root script would look like
CODE

integer gBooLightOn;

default{
touch_start( integer vIntNull ){
gBooLightOn = !gBooLightOn;
llMessageLinked( LINK_ALL, gBooLightOn, "Control Message", "" );
}
}


the light script would look something like
CODE

default{
link_message( integer vIntNull, integer vBooState, string vStrCommand, key vKeyNull ){
if ("Control Message" == vStrCommand){
llSetPrimitiveParams( [PRIM_FULLBRIGHT, vBooState, ALL_SIDES,
PRIM_POINT_LIGHT, vBooState, <1, 1, 1> * vBooState, vBooState, 10 * vBooState, !vBooState] );
}
}
}


set prim parameters can be changed to suit, but was provided as a complex example
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
01-05-2008 15:18
I put a simple example of how to use MessageLinked and LinkedMessage in the library here:

/15/4c/138878/1.html#post1291918
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
03-26-2008 09:45
From: Void Singer
the root script would look like
CODE

integer gBooLightOn;

default{
touch_start( integer vIntNull ){
gBooLightOn = !gBooLightOn;
llMessageLinked( LINK_ALL, gBooLightOn, "Control Message", "" );
}
}


the light script would look something like
CODE

default{
link_message( integer vIntNull, integer vBooState, string vStrCommand, key vKeyNull ){
if ("Control Message" == vStrCommand){
llSetPrimitiveParams( [PRIM_FULLBRIGHT, vBooState, ALL_SIDES,
PRIM_POINT_LIGHT, vBooState, <1, 1, 1> * vBooState, vBooState, 10 * vBooState, !vBooState] );
}
}
}


set prim parameters can be changed to suit, but was provided as a complex example

void, i used this script, the light goes on and off as it should, but it gives this error each time it's clicked:
Object: llSetPrimitiveParams error running rule #1 (PRIM_FULLBRIGHT): bounds error; -1 is not in (0, 1).
and also in the root script, it should say LINK_ALL_OTHERS, not LINK_ALL
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-26-2008 19:54
well I did say it should look somthing like that....

you could filter gBooLightOn when it changes to make sure it stays positive using

gBooLightOn = llAbs( !gBooLightOn );

good catch on the link msg, depending on usage it could also be LINK_SET (assuming the root is a light and has the relevant script)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -