Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Hide Normal parts when PJs are invisible & visa versa.
- //Complete version that will work with parts with mixed alpha.
- integer ChannelB = -123322;
- list LinkOpacities;
- integer LinkCount;
- list BaseAlphas;
- integer Visible;
- default {
- state_entry() {
- LinkCount = llGetNumberOfPrims( );
- llListen(ChannelB, "", NULL_KEY,"");
- Visible = TRUE;
- BaseAlphas = [];
- integer link = 0; while( ++link <= LinkCount) {
- integer faceCount = llGetLinkNumberOfSides( link );
- integer face = -1; while( ++face < faceCount )
- BaseAlphas += llList2Float( llGetLinkPrimitiveParams(link, [PRIM_COLOR, face]), 1 );
- }
- }
- listen(integer chan, string name, key id, string msg){
- // llOwnerSay(msg);
- if(msg == "Visible") {
- integer index = 0;
- integer link = 0; while( ++link <= LinkCount) {
- integer faceCount = llGetLinkNumberOfSides( link );
- integer face = -1; while( ++face < faceCount )
- llSetLinkAlpha( link, llList2Float( BaseAlphas, index++), face );
- }
- Visible = TRUE;
- }else if(msg == "Invisible") {
- if(Visible) { //Avoid hiding twice to avoid messing up BaseAlpha list.
- BaseAlphas = [];
- integer link = 0; while( ++link <= LinkCount) {
- integer faceCount = llGetLinkNumberOfSides( link );
- integer face = -1; while( ++face < faceCount )
- BaseAlphas += llList2Float( llGetLinkPrimitiveParams(link, [PRIM_COLOR, face]), 1 );
- }
- llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES );
- Visible = FALSE;
- }
- }//else ignore
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment