Difference between revisions of "Phantom Child"

From Second Life Wiki
Jump to navigation Jump to search
Line 15: Line 15:
//Reset on Sim restart added by Void Singer
//Reset on Sim restart added by Void Singer
//Strife Onizuka was here doing simplification
//Strife Onizuka was here doing simplification
// reset on collision added by Taff Nouvelle(my stairs kept reverting)
//Reset on collision added by Taff Nouvelle (my stairs kept reverting)


default {
default {
Line 40: Line 40:
         llResetScript();
         llResetScript();
          
          
    }
}
</lsl>
Addition to this script, a switchable version that is useful for a phantom door.
<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
//Strife Onizuka was here doing simplification
//Phantom door idea added by Taff Nouvelle
integer a = 1;
 
default
{
    state_entry()
    {
    }
    touch_start(integer total_number)
    {
    a*=-1;
    if(a == 1)
    {
        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_TYPE] + llGetPrimitiveParams([PRIM_TYPE]));
            llOwnerSay ("Phantom");
    }
    else
    {
        llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
        llOwnerSay ("Solid");
    }
}
    on_rez(integer s) {
        llResetScript();
    }
    changed (integer vBitChanges){
        if (0x400 & vBitChanges){
            llResetScript();
        }
     }
     }
}
}

Revision as of 18:13, 13 July 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.

It needs to be reset on sim restarts. one possible solution is included below (though it may not be live yet). checking llGetTime in a timer may be another.

<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 //Strife Onizuka was here doing simplification //Reset on collision added by Taff Nouvelle (my stairs kept reverting)

default {

   state_entry() {
       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_TYPE] + llGetPrimitiveParams([PRIM_TYPE]));
   }

   on_rez(integer s) {
       llResetScript();
   }

   //-- If/when CHANGED_REGION_START(0x400) is
   //-- live on the main grid, this event/test
   //-- will reset the script on sim restart.
   changed (integer vBitChanges){
       if (0x400 & vBitChanges){
           llResetScript();
       }
   }
   collision_start(integer num_detected){
       llResetScript();
       
   }

} </lsl>

Addition to this script, a switchable version that is useful for a phantom door.

<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 //Strife Onizuka was here doing simplification //Phantom door idea added by Taff Nouvelle

integer a = 1;

default

{
   state_entry()
   {
   }
   touch_start(integer total_number)
   {
   a*=-1;
   if(a == 1)
   {
       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_TYPE] + llGetPrimitiveParams([PRIM_TYPE])); 
           llOwnerSay ("Phantom");
   }
   else
   {
       llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
       llOwnerSay ("Solid");
   }

}

   on_rez(integer s) {
       llResetScript();
   }
   changed (integer vBitChanges){
       if (0x400 & vBitChanges){
           llResetScript();
       }
   }

} </lsl>