Attachment Hide/Show Visibility
|
|
Absinthe Sautereau
Registered User
Join date: 26 Mar 2007
Posts: 86
|
05-17-2007 07:08
Forgive me if this has been asnwered already but I haven' t been abel to find it.
I have built an attachment, and wanted to script it to basically hide or show it. This was a simple enough script, however, being that the attachment is made of several parts, it only hid/showed one piece of it. To overocme this, I merely copied the script into each of the included parts.
My knee-jerk reaction is that I should have been able to do this with just one script in the root prim, but I coudln't figure out how.
|
|
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
|
05-17-2007 07:30
heyas; you want llsetlinkedalpha. http://rpgstats.com/wiki/index.php?title=LlSetLinkAlpha read the info carefully to see if this funtion has the ever-so-helpful built in delay. if so, your object may appear/disappear faster if you use separate scripts anyway.
_____________________
Why Johnny Can't Rotate: http://forums.secondlife.com/showthread.php?t=94705
|
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
05-17-2007 07:32
If you want to show or hide the entire attachement, you can simply use // To hide the entire object: llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES ); // To show the entire object: llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES );
If you want to selectively show or hide only parts of the object, you can use multiple calls of llSetLinkAlpha in a single script, using the actual link numbers instead of LINK_SET. Hope that helps, if not post again and we'll see what we can do .
|
|
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
|
05-17-2007 07:35
Use the above code, I didn't realize that you could use LINK_SET for this function. llSetLinkPrimitiveParams could be used also though.
|
|
Absinthe Sautereau
Registered User
Join date: 26 Mar 2007
Posts: 86
|
05-17-2007 07:37
I will play with that, but from the reading it appears that I can do all of the prims in the set, or all the prims except the one the script is in. But can I access specific prims in the link set?
|
|
Absinthe Sautereau
Registered User
Join date: 26 Mar 2007
Posts: 86
|
05-17-2007 07:39
From: RobbyRacoon Olmstead If you want to show or hide the entire attachement, you can simply use // To hide the entire object: llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES ); // To show the entire object: llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES );
If you want to selectively show or hide only parts of the object, you can use multiple calls of llSetLinkAlpha in a single script, using the actual link numbers instead of LINK_SET. Hope that helps, if not post again and we'll see what we can do . Ok, now i am getting somewhere, where do I get the link numbers? Can I set them somehow or are they determined by how somethign is linked?
|
|
Absinthe Sautereau
Registered User
Join date: 26 Mar 2007
Posts: 86
|
05-17-2007 07:45
More clarification is that the item has 9 prims in it. it has 3 basic states on, off, invisible. In the On state 3 "base" prims are visible and 3 "On" prims are visible and 3 "Off" prims are invisible. In the off state, the 3 "base" prims are visible and 3 "Off" prims are visible and 3 "On" prims are invisible. Then in invisible mode all of them are invisible.
So I can llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES ); to do invisible mode, However, if I do llSetLinkAlpha( LINK_SET, 1.0, ALL_SIDES ); I still have to hide the 3 on prims or 3 Off prims depending on which state I am shooting for.
|
|
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
|
05-17-2007 07:45
llGetLinkNumber From: someone Links are numbered in the reverse order in which they were linked -- if you select a box, a sphere and a cylinder in that order, then link them, the cylinder is 1, the sphere is 2 and the box is 3. The last selected prim has the lowest link number.
|
|
Absinthe Sautereau
Registered User
Join date: 26 Mar 2007
Posts: 86
|
05-17-2007 07:50
Ok so I could link the on prims first, the off prims second and the base prims last. Then use llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES ); -- for invis state --for off state llSetLinkAlpha( LINK_SET, 1.0, 1 ); llSetLinkAlpha( LINK_SET, 1.0, 2 ); llSetLinkAlpha( LINK_SET, 1.0, 3 ); llSetLinkAlpha( LINK_SET, 1.0, 4 ); llSetLinkAlpha( LINK_SET, 1.0, 5 ); llSetLinkAlpha( LINK_SET, 1.0, 6 ); llSetLinkAlpha( LINK_SET, 0.0, 7 ); llSetLinkAlpha( LINK_SET, 0.0, 8 ); llSetLinkAlpha( LINK_SET, 0.0, 9 ); --for on state llSetLinkAlpha( LINK_SET, 1.0, 1 ); llSetLinkAlpha( LINK_SET, 1.0, 2 ); llSetLinkAlpha( LINK_SET, 1.0, 3 ); llSetLinkAlpha( LINK_SET, 0.0, 4 ); llSetLinkAlpha( LINK_SET, 0.0, 5 ); llSetLinkAlpha( LINK_SET, 0.0, 6 ); llSetLinkAlpha( LINK_SET, 1.0, 7 ); llSetLinkAlpha( LINK_SET, 1.0, 8 ); llSetLinkAlpha( LINK_SET, 1.0, 9 ); Am I thinking correctly?
|
|
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
|
05-17-2007 08:04
From: Absinthe Sautereau Ok so I could link the on prims first, the off prims second and the base prims last. Then use
llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES ); -- for invis state
--for off state llSetLinkAlpha( LINK_SET, 1.0, 1 ); llSetLinkAlpha( LINK_SET, 1.0, 2 ); llSetLinkAlpha( LINK_SET, 1.0, 3 ); llSetLinkAlpha( LINK_SET, 1.0, 4 ); llSetLinkAlpha( LINK_SET, 1.0, 5 ); llSetLinkAlpha( LINK_SET, 1.0, 6 ); llSetLinkAlpha( LINK_SET, 0.0, 7 ); llSetLinkAlpha( LINK_SET, 0.0, 8 ); llSetLinkAlpha( LINK_SET, 0.0, 9 );
--for on state llSetLinkAlpha( LINK_SET, 1.0, 1 ); llSetLinkAlpha( LINK_SET, 1.0, 2 ); llSetLinkAlpha( LINK_SET, 1.0, 3 ); llSetLinkAlpha( LINK_SET, 0.0, 4 ); llSetLinkAlpha( LINK_SET, 0.0, 5 ); llSetLinkAlpha( LINK_SET, 0.0, 6 ); llSetLinkAlpha( LINK_SET, 1.0, 7 ); llSetLinkAlpha( LINK_SET, 1.0, 8 ); llSetLinkAlpha( LINK_SET, 1.0, 9 );
Am I thinking correctly? You're thinking is right, but the implementation is not. //Set all links to OFF llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); //Set specific ones to ON - In this case #4 llSetLinkAlpha(4, 1.0, ALL_SIDES); //Set specitic to OFF - #8 llSetLinkAlpha(8, 0.0, ALL_SIDES);
|
|
Absinthe Sautereau
Registered User
Join date: 26 Mar 2007
Posts: 86
|
05-17-2007 08:21
OOps, you are right, I mistyped that for sure!
//Set mode Invis llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
//Set mode On llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); llSetLinkAlpha(1, 1.0, ALL_SIDES); llSetLinkAlpha(2, 1.0, ALL_SIDES); llSetLinkAlpha(3, 1.0, ALL_SIDES); llSetLinkAlpha(7, 1.0, ALL_SIDES); llSetLinkAlpha(8, 1.0, ALL_SIDES); llSetLinkAlpha(9, 1.0, ALL_SIDES);
or possibly //Set mode On llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); llSetLinkAlpha(4, 0.0, ALL_SIDES); llSetLinkAlpha(5, 0.0, ALL_SIDES); llSetLinkAlpha(6, 0.0, ALL_SIDES);
//Set mode Off llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); llSetLinkAlpha(1, 1.0, ALL_SIDES); llSetLinkAlpha(2, 1.0, ALL_SIDES); llSetLinkAlpha(3, 1.0, ALL_SIDES); llSetLinkAlpha(4, 1.0, ALL_SIDES); llSetLinkAlpha(5, 1.0, ALL_SIDES); llSetLinkAlpha(6, 1.0, ALL_SIDES);
or possibly //Set mode Off llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); llSetLinkAlpha(7, 0.0, ALL_SIDES); llSetLinkAlpha(8, 0.0, ALL_SIDES); llSetLinkAlpha(9, 0.0, ALL_SIDES);
Or of course just setting all 9 to their particular state. Apparently there is no "llGetLinkedAlpha()" otherwise I guess I could only flip them if they were wrong.
I am not sure which would be better, as far as flashing, efficiency lag and other such stuff goes.
|
|
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
|
05-17-2007 12:41
Easiest method to show/hide only part of a linkset is to use llMessageLinked, or something like that, to send a meccage from a control script in the root prim to listener scripts in each of the dependant prims. I have some scripts that Starchaser Webb created for his 3-way wings. They had 7 prims. The root prim stayed invisible, and had the control script. Each pair of wings (spread, mantled, and closed) had a different listener script. So you gave a command, and one pair would show, and the others would all hide.
Contact me in-world and I can get you specific code samples. I can't get in-world for at least another 3 hours or so.
_____________________
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.
|