Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

how do I add prim glow to this script?

Trixie Svoboda
Registered User
Join date: 2 Jul 2008
Posts: 10
07-06-2008 20:43
Hi there. I have an object that when pressed rezzes another object a bit away from itself, and then (hopefully) sets itself ready to tell the object to destroy itself when it's pressed again.

Now I'd like this switch-object and another child prim of the switch-object to glow slightly when clicked the first time and then stop glowing when clicked the second time (to show the on/off state).

How do I add that into the script below Please?

Thank You.


CODE

//Rez an object on touch
string object = "Lightbulb";//Object in inventory
integer start_param = 10;
rotation rot;

integer switch = FALSE;

default
{
state_entry()
{
rot = llEuler2Rot(< 0, 90, 90> * DEG_TO_RAD);
}
touch_start(integer a)
{
if (switch == FALSE)
{
vector vec = llGetPos() + < 0.0, 0.0, 2.5>; // 2.5 meter above this
vector speed = llGetVel();
llRezAtRoot(object, vec, speed, rot, start_param);
switch = TRUE;
}
else if (switch == TRUE)
{
llSay(-369693, "die");
switch = FALSE;
}

}
}
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
07-06-2008 23:19
You will need:

llSetLinkPrimitiveParams()
llSetPrimitiveParams()

first one for the child prim, second one for the prim the script is in.

and you will want to look up PRIM_GLOW on
http://wiki.secondlife.com/wiki/LlSetPrimitiveParams
for the required parameters.

If you are on a client version less than the 1.20 series, replace PRIM_GLOW in your script with 25 to get the desired result.
Trixie Svoboda
Registered User
Join date: 2 Jul 2008
Posts: 10
07-07-2008 08:59
From: Squirrel Wood
You will need:

llSetLinkPrimitiveParams()
llSetPrimitiveParams()

first one for the child prim, second one for the prim the script is in.

and you will want to look up PRIM_GLOW on
http://wiki.secondlife.com/wiki/LlSetPrimitiveParams
for the required parameters.

If you are on a client version less than the 1.20 series, replace PRIM_GLOW in your script with 25 to get the desired result.


I've got the prims parameters ok. my problem Is I have no idea how to add the set prim params and set link prim params into the script above in the if statements. do I just add the lines in or do I need some sort of subsection inside the if statements?
Daten Thielt
Registered User
Join date: 1 Dec 2006
Posts: 104
07-07-2008 09:32
Just do this

CODE

//Rez an object on touch
string object = "Lightbulb";//Object in inventory
integer start_param = 10;
rotation rot;

integer switch = FALSE;

default
{
state_entry()
{
rot = llEuler2Rot(< 0, 90, 90> * DEG_TO_RAD);
}
touch_start(integer a)
{
if (switch == FALSE)
{
vector vec = llGetPos() + < 0.0, 0.0, 2.5>; // 2.5 meter above this
vector speed = llGetVel();
llRezAtRoot(object, vec, speed, rot, start_param);
llSetPrimitiveParams([PRIM_GLOW,0.5,ALL_SIDES]);
llSetLinkPrimitiveParams(LINK_SET,[PRIM_GLOW,0.5,ALL_SIDES]);

switch = TRUE;
}
else if (switch == TRUE)
{
llSetPrimitiveParams([PRIM_GLOW,0.0,ALL_SIDES]);
llSetLinkPrimitiveParams(LINK_SET,[PRIM_GLOW,0.0,ALL_SIDES]);
llSay(-369693, "die");
switch = FALSE;
}

}
}
Trixie Svoboda
Registered User
Join date: 2 Jul 2008
Posts: 10
07-07-2008 09:53
Thanks! I wasn't sure that I could just add them all into the if statements but I see that I can.

My last question is how do I tell only one child to get it's prim params set and not all the others? The child's number is 3.
Daten Thielt
Registered User
Join date: 1 Dec 2006
Posts: 104
07-07-2008 10:03
replace LINK_SET with the number 3
Trixie Svoboda
Registered User
Join date: 2 Jul 2008
Posts: 10
07-07-2008 10:15
From: Daten Thielt
replace LINK_SET with the number 3


heh so simple, thanks :)
Trixie Svoboda
Registered User
Join date: 2 Jul 2008
Posts: 10
07-07-2008 10:24
well it does make the objects glow but i get an error and the second object takes time to change color and glow :/

LightBlub Object: llSetPrimitiveParams error running rule #2 (PRIM_GLOW): arg #1 (face number) integer expected but float given.

llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <1.0,1.0,0.0>, 1.0, //sets yellow
PRIM_GLOW, 0.5, ALL_SIDES]);
llSetLinkPrimitiveParams(3,[PRIM_COLOR, ALL_SIDES, <1.0,1.0,0.0>, 1.0, //sets yellow
PRIM_GLOW, 0.5, ALL_SIDES]);
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
07-07-2008 15:09
[PRIM_COLOR, ALL_SIDES, <1.0,1.0,0.0>, 1.0, PRIM_GLOW, ALL_SIDES, 0.5]

It is PRIM_GLOW, Face, Intensity. You had it the wrong way around ;)
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Trixie Svoboda
Registered User
Join date: 2 Jul 2008
Posts: 10
07-07-2008 18:36
ah ok :) I also found that i had to add a ; after the interger at the top.