Difference between revisions of "Phantom Child"

From Second Life Wiki
Jump to navigation Jump to search
(Adding a new library script)
 
Line 1: Line 1:
{{LSL Header}}
{{LSL Header}}
=== Phantom Child ===
=== Phantom Child ===
This easy to use code when put into a child prim of a linkset will make it phantom, even when taken into inventory and re-rezzed.
This easy to use code when put into a child prim of a linkset will make thay child and only that child phantom, even when taken into inventory and re-rezzed. You can use multiple copies of this script to make multiple children of a linkset phantom.
This code relies on a bug in Secondlife and may not function in later versions (currently server version 1.24). This script was created in part by [[User:Aeron Kohime|Aeron Kohime]] and documents this useful bug (which like invis-prims, has countless applications).
This code relies on a bug in Secondlife and may not function in later versions (currently server version 1.24). This script was created in part by [[User:Aeron Kohime|Aeron Kohime]] and documents this useful bug (which like invis-prims, has countless applications).



Revision as of 13:20, 29 August 2008

Phantom Child

This easy to use code when put into a child prim of a linkset will make thay child and only that child phantom, even when taken into inventory and re-rezzed. You can use multiple copies of this script to make multiple children of a linkset phantom.

This code relies on a bug in Secondlife and may not function in later versions (currently server version 1.24). This script was created in part by Aeron Kohime and documents this useful bug (which like invis-prims, has countless applications).

You may use the follow script in any manner you like, excluding claiming you made it (unless your Strife Onizuka, in which case you made the hard part) and individually reselling it without change in function (its on the wiki silly). Otherwise you can sell it as part of a product, modify it, remove my comments, etc etc.

<lsl> //Phantom Child Script by Aeron Kohime //WARNING: When used on the root prim it makes the entire object phantom, it // also does not function correctly on tortured prims. (Sorry.) //GetPrimitiveParams function contributed by Strife Onizuka list GetPrimitiveParams(list input) {//Returns a list that can be fed to llSetPrimitiveParams

   list output;
   integer c = ~llGetListLength(input);
   while(0x80000000 & (c = - ~c))
   {
       list flag = (list)llList2Integer(input, c);
       if(~llListFindList([PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT, PRIM_TEXGEN, PRIM_GLOW], flag ))
       {
           integer side = llList2Integer(input, (c = - ~c));
           if(~side)//pop the stack
               output += flag + side + llGetPrimitiveParams( flag + side );
           else
           {
               side = llGetNumberOfSides();
               do //we return the sides in reverse order, easier to code; runs faster.
                   output += flag + side + llGetPrimitiveParams( flag + (side = ~ -side) );
               while(side);
           }
       }
       else
           output += flag + llGetPrimitiveParams( flag );
   }
   return output;

}

default {

   state_entry() {
       list prim = GetPrimitiveParams([PRIM_TYPE]);
       llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX,
           0, <0,1,0>, 0, <0,0,0>, <1,1,0>, <0,0,0>,
           PRIM_FLEXIBLE, TRUE, 0, 0, 0, 0, 0, <0,0,0>] + prim);
   }
   on_rez(integer s) {
       llResetScript();
   }

} </lsl>