Detect a Ghost Prim

from Sindy Tsure:

Just a little script to tell you about the first thing it collides with. Useful for figuring out what a ghost prim is. Had to dig around for this last night so I figure I'll post it here - easier to find next time.

Put the script in a cube, move the cube a few meters over the suspected ghost, touch the cube.

default
{
     state_entry()
     {
          llSetStatus(STATUS_PHYSICS, FALSE);
     }

     touch_start(integer total_number)
     {
          llSetStatus(STATUS_PHYSICS, TRUE);
     }

     land_collision(vector position)
     {
          llOwnerSay ("hit land! no objects here..");
          llResetScript();
     }
     
     collision_start(integer count)
     {

          // todo: notice llDO returing a key and spit out web link to profile instead
          llOwnerSay ("hit '" + llDetectedName(0) + "' owned by " +
               llKey2Name((llDetectedOwner(0))));
          llResetScript();
     }
}

 

Add a comment

HTML Page From a Notecard on a Prim

// Example to show how a basic HTML page can be read
// from a notecard and then displayed on the face of a prim.
//
// Will also request a tinyurl to give to users on touch
// - useful for non-viewer 2.0 clients - they can still
// see the data/page but in an external browser instead.
//
// Kimm Paulino, Jan 2011
 
// Note that the HTML can only be 1024 characters long - no more!
integer HTML_FACE_DISPLAY = 2;    // See http://wiki.secondlife.com/wiki/Face
string   HTML_DEFAULT = "

HTML on a Prim Example

Kimm Paulino, Jan 2011

"; // Used when processing notecard-based questions only string HTML_NOTECARD_NAME="htmlpage"; key gNCQueryId; integer gNCLine; string gHtmlPage=""; string gTinyUrl = ""; key gUrlReqId; check_notecards() { integer nccount = llGetInventoryNumber (INVENTORY_NOTECARD); integer i; string htmlnote; gHtmlPage = ""; for (i=0 ; i Add a comment

Simple Door Script

// Was asked to modify an existing door script.  I was just given
// this to update so afraid I can't give credit, but if you know where
// the original came from, do let me know.
//
// Swinging door LSL script #1
// Handles the touch event.
// Handles the collision event.
// Handles closing the door automatically via a timer event.
// Triggers sounds when the door opens or closes.
//
// Updated by Kimm Paulino, April 2010, for Synonyme Toll,
// to use local coords for the rotations instead of global
// coords.
//
// Updated by Kimm Paulino, May 2010, for Synonyme Toll,
// to use messages to link two doors together.
//
// Note: For this to work, you need a door with a path cut
//       of 0.375 to 0.875 and a width that is twice as wide
//       as you need (the cut brings it back down to the right
//       size).  Without this, it will just rotate on the spot,
//       not swing at the edge.
//
 
// Parameters you might want to change
 
float  delay = 3.0;             // time to wait before automatically closing door
                                // set to 0.0 to not automatically close
float  direction = 1.0;         // set to 1.0 or -1.0 to control direction the door swings
float  volume = 0.5;            // 0.0 is off, 1.0 is loudest
integer linked_doors = 0;       // set to 1 if using this script in a linked set of doors
float  angle = 90.0;            // angle to open in degrees
integer coll_detect = 1;        // set to 1 to make door open on approach
 
// Variables you will most likely leave the same
 
key    open_sound  = "cb340647-9680-dd5e-49c0-86edfa01b3ac";
key    close_sound = "e7ff1054-003d-d134-66be-207573f2b535";
 
// KP: Link send/recv functions
// IMPORTANT
// If you only have one pair of doors using this script, then
// these will be fine.  If you have several doors using this
// script that you don't want all opening together, then
// you'll have to change these to something unique.
//
integer LINK_MSG_NUM = 452345;
string LINK_MSG_STR_OPEN = "Open the door";
string LINK_MSG_STR_CLOSE = "Close the door";
 
linkSend (string dir)
{
    if (linked_doors)
    {
        // Note: Could try to work out the link numbers of the doors,
        // but simplest is to send to all other prims in the build.
        llMessageLinked (LINK_ALL_OTHERS, LINK_MSG_NUM, dir, NULL_KEY);
    }
}
 
integer linkRecv (integer sender_num, integer num, string str, key id, string str_to_check)
{
    if (linked_doors)
    {
        // Check it really is a message for these doors
        if (num == LINK_MSG_NUM)
        {
            if (str == str_to_check)
            {
                // All good
                return 1;
            }
        }
    }
 
    // not for us
    return 0;
}
 
// Processing for the script when it first starts up
 
default {
    // What we do when we first enter this state
 
    state_entry() {
        state open;                        // Move to the open state
    }
}
 
// Processing for the script when it is in the closed state
 
state closed {
    // What we do when we first enter this state
 
    state_entry() {
        llTriggerSound(close_sound, volume); // Trigger the sound of the door closing
        llSetLocalRot(llEuler2Rot(<0, 0, direction * angle * DEG_TO_RAD>) * llGetLocalRot());
 
    }
 
    // What we do when the door is clicked (”touched”) with the mouse
 
    touch_start(integer total_number) {
        linkSend (LINK_MSG_STR_OPEN);  // KP: Tell everyone else we are now in the open state
        state open;                        // Move to the open state
    }
 
    // What to do when something hits the door 
 
    collision_start(integer total_number)
    {
        if (coll_detect != 0)
        {
            linkSend (LINK_MSG_STR_OPEN);  // KP: Tell everyone else we are now in the open state
            state open;                        // Move to the open state
        }
    }
 
    // KP: Handle link messages
 
    link_message (integer sender_num, integer num, string str, key id)
    {
        if (linkRecv (sender_num, num, str, id, LINK_MSG_STR_OPEN))
        {
            state open;                    // Move to the open state
        }
    }
 
    // What to do when the timer goes off
 
    timer()
    {
        llSetTimerEvent(0.0);              // Set the timer to 0.0 to turn it off
    }
}
 
// Processing for the script when it is in the open state
 
state open {
    // What we do when we first enter this state
 
    state_entry() {
        llTriggerSound(open_sound, volume);// Trigger the sound of the door opening
        llSetLocalRot(llEuler2Rot(<0, 0, -direction * angle * DEG_TO_RAD>) * llGetLocalRot());
 
        llSetTimerEvent(delay);            // Set the timer to automatically close it
    }
 
    // What do do when pulling the door from Inventory if it was saved while open
 
    on_rez(integer start_param) {
        state closed;
    }
 
    // What we do when the door is clicked (”touched”) with the mouse
 
    touch_start(integer total_number) {
        linkSend (LINK_MSG_STR_CLOSE);  // KP: Tell everyone else we are now in the open state
        state closed;                      // Move to the closed state
    }
 
    // What to do when something hits the door 
 
    collision_start(integer total_number)
    {
        // Do nothing, the door is already open
    }
 
    // KP: Handle link messages
 
    link_message (integer sender_num, integer num, string str, key id)
    {
        if (linkRecv (sender_num, num, str, id, LINK_MSG_STR_CLOSE))
        {
            state closed;                    // Move to the open state
        }
    }
 
    // What to do when the timer goes off
 
    timer()
    {
        llSetTimerEvent(0.0);             // Set the timer to 0.0 to turn it off
        state closed;                     // Move to the closed state
    }
}

 

Add a comment

Prim Size Reducer

// Reducing Script
//
// Kimm Paulino
// Written for Stewart Bosatsu, Sept 2010
 
integer TIMER_STEPS = 18;
float   REDUCING_STEPS = 20;        // If this >= TIMER_STEPS then prim will disappear
float   TIMER_INTERVAL = 2.0;       // In seconds
integer gCount;
vector  gReducingFactor;
 
default
{
    on_rez (integer start_param)
    {
        llResetScript();
    }
 
    state_entry()
    {
        gCount = 0;
        vector size = llGetScale();
        float scaling = 1.0 / REDUCING_STEPS;
        gReducingFactor = size * scaling;
 
    }
 
    touch_start(integer total_number)
    {
        llSetTimerEvent (TIMER_INTERVAL);
    }
 
    timer ()
    {
        // Reduce the size by 1/TIMER_STEPS % each time
        gCount ++;
        if (gCount > TIMER_STEPS)
        {
            // disable and quit
            llSetTimerEvent (0.0);
            llDie();
            return;
        }
 
        // Reduce prim
        vector size = llGetScale();
 
        size = size - gReducingFactor;
        llSetScale (size);
    }
}

 

Add a comment

Linked Prim Scrubber

This gadget will clean linked prims of particles, text, Rotations objects inventory: items and scripts to use just put root base and linked scrubber in obects main (root) prim the base script will put the scrubber in all linked prims after putting scripts in the root prim. will be cleaned then take object into inventory rerez object edit object go to tools menu choose set scripts to running and poof linked object will have nothing no inventory or any particles, movement or text in (LinkedScrubber) script edjust sleep event for object prim size 2-50 prim object sleep for 0.5-1.5 seconds 51-100 prims 1.5-3.0 101-150 prims 3.0-4.5 seconds 151-256 prims 4.5-6.5 seconds

There are 3 scripts included in this post

Linked Scrubber:

string scriptName;
default  
{         
state_entry()     
{ 
        llSleep(1.5);
        llSetSitText( "" );
        llSetTouchText( "" );
        llParticleSystem( [ ] );
        llSetText( "", ZERO_VECTOR, 1.0 );
        llTargetOmega( ZERO_VECTOR, 0, 0 );
        llSetCameraAtOffset( ZERO_VECTOR );
        llSetCameraEyeOffset( ZERO_VECTOR );
        llSitTarget( ZERO_VECTOR, ZERO_ROTATION );
        llSetTextureAnim( FALSE , ALL_SIDES, 1, 1, 0, 0, 0.0 );
        llStopSound();
        llOwnerSay("This Prim is Clean... ");        
        llSetObjectName((string)llGetLinkNumber()); 
        llOwnerSay("" + (string)llGetLinkNumber()); 
        integer total = llGetInventoryNumber(INVENTORY_ALL);
        integer i;
        for (i = 0; i 

 Linked Scrubber Base Script 2.0:

string script = "LinkedScrubber";  
default 
{   
state_entry()
    {
  
       integer i;     
       for(i = 2; i <= llGetNumberOfPrims(); i++) 
       {            
        key k = llGetLinkKey(i);             
        llGiveInventory(k, script);
    
    }
}

        changed(integer mask)
         {
           if(mask & (CHANGED_INVENTORY))
           llResetScript();  
              
         }    
    }

 

Single Prim Scrubber:

string scriptName;
default  
{         
state_entry()     
{ 
        llSleep(1.5); //change per object link size
        llSetSitText( "" );
        llSetTouchText( "" );
        llParticleSystem( [ ] );
        llSetText( "", ZERO_VECTOR, 1.0 );
        llTargetOmega( ZERO_VECTOR, 0, 0 );
        llSetCameraAtOffset( ZERO_VECTOR );
        llSetCameraEyeOffset( ZERO_VECTOR );
        llSitTarget( ZERO_VECTOR, ZERO_ROTATION );
        llSetTextureAnim( FALSE , ALL_SIDES, 1, 1, 0, 0, 0.0 );
        llStopSound();
        llOwnerSay("This Prim is Clean... ");        
       // llSetObjectName((string)llGetLinkNumber()); 
        llOwnerSay("" + (string)llGetLinkNumber()); 
        integer total = llGetInventoryNumber(INVENTORY_ALL);
        integer i;
        for (i = 0; i 

 

Add a comment