Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Linked alpha's - totally not getting it

Clinton Bulan
Registered User
Join date: 9 Oct 2006
Posts: 22
02-17-2008 09:06
Scenario:

I have 10 prims linked and 1 script. I'd like 6 of them to go fully invisible on command but the rest to stay visible. I've seen it done and can't figure it out for the life of me.

I know how to do the rest of it, I just can't get the command to go to the right prims with only 1 script.

Advice?
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
02-17-2008 09:39
llSetLinkAlpha allows you to specify the link number as does the more complex llSetLinkPrimitiveParams


Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-17-2008 12:03
Thing is, calling those functions you usually have to do one at a time or all at once. Although it is claimed that llSetAlpha() and llSetLinkAlpha() don't have any delay, they do in fact take quite some time to change a set of prims or faces sequentially. Although it is not the nicest setup in the world, if you want to change the visibility of a large set of prims at once you'll really have to broadcast a link message and have scripts in each prim call llSetAlpha() in parallel.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-17-2008 12:32
or conversely a set of scripts calling llSetLinkAlpha in parallel, no need to tie it to the individual prims in this case...
_____________________
|
| . "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...
| -
Roofus Kit
Registered User
Join date: 12 Dec 2006
Posts: 10
02-17-2008 15:25
From: Clinton Bulan
Scenario:

I have 10 prims linked and 1 script. I'd like 6 of them to go fully invisible on command but the rest to stay visible. I've seen it done and can't figure it out for the life of me.

I know how to do the rest of it, I just can't get the command to go to the right prims with only 1 script.

Advice?


The easiest way is to use a script for each prim, otherwise you have to tell your one script which specific prims to make transparent 1-10 which means figuring out what your prims are numbered. They're numbered by link order, last prim linked is 1, next is 2, etc...

Here's an example of the 1 script per prim method. You just drop the script into the prims you want to change to invisible.


default
{
on_rez(integer sides)
{
//sets the prim to opaque on rez
llSetAlpha(0,ALL_SIDES); //change the 0 to 1 for a transparent on rez
}

link_message(integer sender_num, integer num, string str, key id)
{
if (num == 0)
llSetAlpha(0,ALL_SIDES);//receiving the message 0 set's the prim to opaque
else if (num == 1)
llSetAlpha(1,ALL_SIDES);//receiving the message 1 set's the prim to transparent
}
}


Now all you have to do is add
llMessageLinked(-1, 0, "", "";);
or
llMessageLinked(-1, 1, "", "";);
into your parent script where you want.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
02-17-2008 16:00
You are still really only changing alpha on just 6 prim. All I ever do in a case like that is just a do-while loop, never have noticed any changing before the others with this small anumber of prim:

CODE
integer prim = 4;
integer alpha = 0;
default {
touch_start(integer n) {
integer a = prim;
do{
llSetLinkAlpha(a, alpha, ALL_SIDES);
a++;
}while (a < 10);//sets links 4-9
alpha = !alpha;//switches back and forth between TRUE & FALSE
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Clinton Bulan
Registered User
Join date: 9 Oct 2006
Posts: 22
02-17-2008 16:06
Thanks for all the input folks.

I've got working models of both set up. It's definately a lot more then 10 prims, that was just my scenario to keep the original post nice and concise.

After talking to a few people and seeing both in action on both low (under 100) and high (250+) builds I think I'll be able to put both techniques to use depending on the situation.

:D