Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Holster with high prim count and glow...

Teap Tomsen
Registered User
Join date: 26 Nov 2007
Posts: 9
07-14-2008 22:31
I'm working on a holster for a bow that I made that has a high amount of prims and glow. The method of changing every prim's alpha to 0 does not work, because the glow is still left behind. Each prim has a different glow, some no glow at all, and I'm wondering if there is any way I can write a script that I can drag onto every prim and have work instead of having to change each variable for every prim... which would be very tedious. Thanks.
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
07-14-2008 23:22
You should be able to use llGetPrimitiveParams() to find out IF it's glowing..and find out the value as well, I believe.

I'm not sure though, as the LSL wiki (Unofficial) has nothing about glow in llgetPrimitiveParams(), only llSetPrimitiveParams().

Just get the params for the glow (PRIM_GLOW), and then use the returned list to find the value, then store that value as a variable. Do this ONLY when the script is first installed (Or when you change the default glow of a piece), otherwise you may accidentally erase that glow variable and have it use the non-glow instead.

Hope this helps.
_____________________
Tutorials for Sculpties using Blender!
Http://www.youtube.com/user/BlenderSL
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
07-14-2008 23:37
Setting 100% alpha will not do the trick. However, setting a full alpha texture on the desired prims will.
Teap Tomsen
Registered User
Join date: 26 Nov 2007
Posts: 9
07-15-2008 00:20
Is there any way to do this by changing the object or something?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-15-2008 14:48
How about something like:

CODE

float GLOW_ALPHA_THRESHOLD = 0.01;

// Set this from default/state_entry if you find that
// llGetPrimitiveParams([ PRIM_GLOW, side ]) works.
list GLOW_VALUES = [ 1.0, 1.0, 0.0, 0.5, 0.5, 1.0 ];

refreshGlow()
{
list primParams = [];

integer side;
for (side = llGetNumberOfSides()-1; side >= 0; --side)
{
float glow = 0.0;
if (llGetAlpha(side) >= GLOW_ALPHA_THRESHOLD)
{
glow = llList2Float(GLOW_VALUES, side);
}

primParams = (primParams=[])+primParams+[ PRIM_GLOW, side, glow ]
}

llSetPrimitiveParams(primParams);
}

default
{
state_entry()
{
refreshGlow();
}

changed(int changes)
{
if (changes & CHANGED_COLOR)
{
refreshGlow();
}
}
}
Teap Tomsen
Registered User
Join date: 26 Nov 2007
Posts: 9
07-15-2008 20:17
Thanks Hewee but that didn't really work. It makes everything alpha and makes the glow disappear but sets the glow to 1, even if there was no glow in the first place.
Beezle Warburton
=o.O=
Join date: 10 Nov 2006
Posts: 1,169
07-15-2008 20:34
For Glow Off:
llSetPrimitiveParams( [ PRIM_GLOW, ALL_SIDES, 0.0 ] );
(or)
llSetPrimitiveParams( [ 25, ALL_SIDES, 0.0 ] );


For Glow On:
llSetPrimitiveParams( [ PRIM_GLOW, ALL_SIDES, 0.1 ] );
(or)
llSetPrimitiveParams( [ 25, ALL_SIDES, 0.1 ] );

I personally find glow very easy to over-do, so I used lower numbers.

Use this in small script in conjunction with linked messages.
_____________________
Though this be madness, yet there is method in't.
-- William Shakespeare

Warburton's Whimsies:
In SL
Apez.biz
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-15-2008 22:01
From: Teap Tomsen
Thanks Hewee but that didn't really work. It makes everything alpha and makes the glow disappear but sets the glow to 1, even if there was no glow in the first place.


1.) The script I posted shouldn't change the alpha values at all.

2.) You must change the values at the top to reflect the actual glows used on the prim. Best would be if you can do something like this, but I haven't confirmed it works yet--hence the comment at the top of the script:

float glowForSide = llList2Float(llGetPrimitiveParams([ PRIM_GLOW, side ]), 0);
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-15-2008 22:06
Okay. Here's my above script modified with the assumption that the llGetPrimitiveParams() works as expected for PRIM_GLOW:

(Not yet compiled or tested.)
CODE

float GLOW_ALPHA_THRESHOLD = 0.01;

list glowValues = [];

refreshGlow()
{
list primParams = [];

integer side;
for (side = llGetNumberOfSides()-1; side >= 0; --side)
{
float glow = 0.0;
if (llGetAlpha(side) >= GLOW_ALPHA_THRESHOLD)
{
glow = llList2Float(glowValues, side);
}

primParams = (primParams=[])+primParams+[ PRIM_GLOW, side, glow ]
}

llSetPrimitiveParams(primParams);
}

default
{
state_entry()
{
integer nSides = llGetNumberOfSides();
integer side;
for (side = 0; side < nSides; ++side)
{
float glow =
llList2Float(llGetPrimitiveParams([ PRIM_GLOW, side ]), 0);
glowValues = (glowValues=[])+glowValues+[ glow ];
}

refreshGlow();
}

changed(int changes)
{
if (changes & CHANGED_COLOR)
{
refreshGlow();
}
}
}