Difference between revisions of "Phantom Child"

From Second Life Wiki
Jump to navigation Jump to search
m (→‎Phantom Child: Using GetPrimitiveParams is overkill in this case (so I simplified it out), but thanks for the props =^_^=)
Line 5: Line 5:
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).


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.
You may use the follow script in any manner you like, excluding claiming you made it 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>
<lsl>
Line 11: Line 11:
//WARNING: When used on the root prim it makes the entire object phantom, it
//WARNING: When used on the root prim it makes the entire object phantom, it
//        also does not function correctly on tortured prims. (Sorry.)
//        also does not function correctly on tortured prims. (Sorry.)
//GetPrimitiveParams function contributed by Strife Onizuka
//Reset on Sim restart added by Void Singer
//Reset on Sim restart added by Void Singer
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 {
default {
     state_entry() {
     state_entry() {
         list prim = GetPrimitiveParams([PRIM_TYPE]);
         list prim = PRIM_TYPE + llGetPrimitiveParams([PRIM_TYPE]);
         llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX,
         llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX,
             0, <0,1,0>, 0, <0,0,0>, <1,1,0>, <0,0,0>,
             0, <0,1,0>, 0, <0,0,0>, <1,1,0>, <0,0,0>,

Revision as of 17:00, 5 April 2009

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 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.) //Reset on Sim restart added by Void Singer

default {

   state_entry() {
       list prim = PRIM_TYPE + llGetPrimitiveParams([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();
   }
   changed (integer vBitChanges){
       if (CHANGED_REGION_START & vBitChanges){
           llResetScript();
       }
   }

} </lsl>