SungAli

Untitled

Oct 29th, 2025
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. //Hide Normal parts when PJs are invisible & visa versa.
  2. //Complete version that will work with parts with mixed alpha.
  3.  
  4. integer ChannelB = -123322;
  5. list LinkOpacities;
  6. integer LinkCount;
  7. list BaseAlphas;
  8. integer Visible;
  9.  
  10. default {
  11. state_entry() {
  12. LinkCount = llGetNumberOfPrims( );
  13. llListen(ChannelB, "", NULL_KEY,"");
  14. Visible = TRUE;
  15. BaseAlphas = [];
  16. integer link = 0; while( ++link <= LinkCount) {
  17. integer faceCount = llGetLinkNumberOfSides( link );
  18. integer face = -1; while( ++face < faceCount )
  19. BaseAlphas += llList2Float( llGetLinkPrimitiveParams(link, [PRIM_COLOR, face]), 1 );
  20. }
  21. }
  22.  
  23. listen(integer chan, string name, key id, string msg){
  24. // llOwnerSay(msg);
  25. if(msg == "Visible") {
  26. integer index = 0;
  27. integer link = 0; while( ++link <= LinkCount) {
  28. integer faceCount = llGetLinkNumberOfSides( link );
  29. integer face = -1; while( ++face < faceCount )
  30. llSetLinkAlpha( link, llList2Float( BaseAlphas, index++), face );
  31. }
  32. Visible = TRUE;
  33. }else if(msg == "Invisible") {
  34. if(Visible) { //Avoid hiding twice to avoid messing up BaseAlpha list.
  35. BaseAlphas = [];
  36. integer link = 0; while( ++link <= LinkCount) {
  37. integer faceCount = llGetLinkNumberOfSides( link );
  38. integer face = -1; while( ++face < faceCount )
  39. BaseAlphas += llList2Float( llGetLinkPrimitiveParams(link, [PRIM_COLOR, face]), 1 );
  40. }
  41. llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES );
  42. Visible = FALSE;
  43. }
  44. }//else ignore
  45. }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment