|
Yenyoju Doowangle
Registered User
Join date: 1 Feb 2006
Posts: 2
|
09-28-2007 09:10
Hi, I'm trying to write a script for a glowing orb on the top a of staff. What I'm trying to do is detect the colour of the orb(the staff already has a working colour change script for the orb) and then set a soft light based on the colour of it. I know roughly how to detect the colour of a prim, but can't seem to work out how to pass a vector into the llSetLinkPrimitiveParams.
Is it possible to use something like (LINK_THIS,[PRIM_POINT_LIGHT,TRUE,(vector)detected_colour,1,2,0.5]); ??
I just need a script that will work in the link the script is inside (as is a 50 prim linked set with multiple pieces/colours) that detects that links color (1 sided sphere) and then based on that sets a soft pin point light. If poss a way to also update the light when the colour is changed via another script (possibly use linked message to llResetScript?)
Thanks in advance
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
09-28-2007 09:56
If, as I understand it, there are multiple scripts that may be changing the orb's color, probably the least painful approach would be to embed a script inside the orb prim that does something like: default { changed(integer change) { if (change & CHANGED_COLOR) { vector detectedColor = llGetColor(0); llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, detectedColor, 1, 2, 0.5]); } } }
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
09-28-2007 10:14
EDIT: meh post lag, Qie got it first... and better if the user is coloring the globe manually you'll need a script in the globe to pick up the current color... something like llSetPrimitiveParams( [PRIM_POINT_LIGHT, TRUE, llGetColor( ALL_SIDES ), vFltIntensity, vFltRadius, vFltFalloff] ); if you already know the color (because you set it w/ the script) you can use llSetLinkPrimitiveParams and just have the color you used saved as a variable of type vector (saves conversion) alternately you could ignore it's actual color, set fullbright and make the light white regardless....
|
|
Yenyoju Doowangle
Registered User
Join date: 1 Feb 2006
Posts: 2
|
09-28-2007 11:43
Thanks Qie & Void..i knew it wasn't difficult  works perfect thankyou!
|