Stop Scripts

Expired

//Script to clear text, animation, and particles from a prim.
//by Robin Sojourner
 
// When you remove the scripts for effects, such as floating text, texture animation, or particles, from a prim it doesn't stop the effect.
 
// To do that, you need to reset it, which you can do by changing the code, or by using another script - this one!
 
// Just drop this script into a scriptless prim that has lingering effets you don't want, click Reset, and they will all stop. Remove this script, and they will stay stopped.
 
//If you only want to clear some of these effects, just type '//' in front of the line for the effect you want to KEEP. This turns the command into a comment, which will be ignored, and is referred to as "commenting out" the line.
 
// To keep floating text, comment out 11SetText
// To keep animatied textures, comment out llSetTextureAnim
// To keep particles, comment out llParticleSystem
 
default
{
        state_entry()
        {
                llSetText("",<0,0,0>,0);
                llSetTextureAnim(FALSE, ALL_SIDES,0,0,0.0, 1,0.3);
                llParticleSystem([]);
        }
}

 

Buddy Builder Base

Expired

//////////START MULTI SCRIPT
 
////SCRIPT START ////MAIN
// Builders' Buddy 1.0 (Base Prim)
//
// by Newfie Pendragon, March 2006
//
// This script is distributed with permission that it may be used in
// any way, or may be further modified/included in resale items.
// HOWEVER, if this script is used as part of a for-sale product,
// it is required that appropriate credit be given to Newfie for
// the script (or portions used in derivatives).  That's a fair price
// in exchange for unlimited use of this script, dontcha think?
 
//INSTRUCTIONS
//(These instructions use channel 1234 in the examples, but can be
//  changed further down in the code to whatever channel you wish.)
//
// This is the *Base Prim* half of the Builders' Buddy system.  Drop
// it into the prim that will be the container/box that will be used
// to store the building once completed.  Drop the *Component* scripts
// into each 'piece' of the building.
//
// QUICK USE:
// - Drop this script in the Base.
// - Drop the "Component" Script in each building part.
// - Type: /12345 RECORD
// - Take all building parts into inventory
// - Drag building parts from inventory into Base Prim
// - Type /12345 BUILD
//
// OTHER COMMANDS
// - To reposition, move/rotate Base Prim Type: /12345 MOVE
// - To lock into position (removes scripts) Type: /12345 DONE
// - To delete building pieces: /12345 CLEAN
 
//////////////////////////////////////////////////////////////////////////////////////////
// Configurable Settings
integer CHAN = 12345;        //Channel used to talk to Base Prim; change if you want
integer PRIMCHAN = 12346;    //Channel used by Base Prim to talk to Component Prims;
// This must match in both scripts
 
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
default
{
        //////////////////////////////////////////////////////////////////////////////////////////
        state_entry()
        {
                llListen(CHAN, "", llGetOwner(), "");
        }
 
        //////////////////////////////////////////////////////////////////////////////////////////
        listen(integer iChan, string sName, key kID, string sText)
        {
                //////////////////////////////////////////////////////////////////////////////////////////
                sText = llToUpper(sText);
                if( sText == "RECORD" )
                {
                        llOwnerSay("Recording positions...");
                        llShout(PRIMCHAN, "RECORD " + llDumpList2String([ llGetPos(), llGetRot() ], "|"));
                        return;
                }
 
                //////////////////////////////////////////////////////////////////////////////////////////
                if( sText == "BUILD" )
                {
                        vector vThisPos = llGetPos();
                        rotation rThisRot = llGetRot();
                        integer i;
                        integer iCount = llGetInventoryNumber(INVENTORY_OBJECT);
 
                        //Loop through backwards (safety precaution in case of inventory change)
                        llOwnerSay("Rezzing build pieces...");
                        for( i = iCount - 1; i >= 0; i-- )
                        {
                                llRezObject(llGetInventoryName(INVENTORY_OBJECT, i), vThisPos, ZERO_VECTOR, rThisRot, PRIMCHAN);
                        }
 
                        llOwnerSay("Positioning");
                        llShout(PRIMCHAN, "MOVE " + llDumpList2String([ vThisPos, rThisRot ], "|"));
                        return;
                }
 
                //////////////////////////////////////////////////////////////////////////////////////////
                if( sText == "MOVE" )
                {
                        llOwnerSay("Positioning");
                        vector vThisPos = llGetPos();
                        rotation rThisRot = llGetRot();
                        llShout(PRIMCHAN, "MOVE " + llDumpList2String([ vThisPos, rThisRot ], "|"));
                        return;
                }
 
                //////////////////////////////////////////////////////////////////////////////////////////
                if( sText == "CLEAN" )
                {
                        llShout(PRIMCHAN, "CLEAN");
                        return;
                }
 
                //////////////////////////////////////////////////////////////////////////////////////////
                if( sText == "DONE" )
                {
                        llShout(PRIMCHAN, "DONE");
                        //llDie();
                        llOwnerSay("Removing mover scripts.");
                        return;
                }
        }
}
 
///////END BASE SCRIPT

 

Buddy Builder Object

Expired

/////START SCRIPT //// COMPONET
 
// Builders' Buddy 1.0 (Component Pieces)
//
// by Newfie Pendragon, March 2006
//
// This script is distributed with permission that it may be used in
// any way, or may be further modified/included in resale items.
// HOWEVER, if this script is used as part of a for-sale product,
// it is required that appropriate credit be given to Newfie for
// the script (or portions used in derivatives).  That's a fair price
// in exchange for unlimited use of this script, dontcha think?
 
//INSTRUCTIONS
//(These instructions use channel 1234 in the examples, but can be
//  changed further down in the code to whatever channel you wish.)
//
// This is the *Component Piece* half of the Builders' Buddy system.
// Drop it into each 'piece' of the building.  Drop the Base Prim Script
// into the prim  that will be the container/box that will be used to
// store the building once completed.  It can be in each individual
// prim, but if you link as much as possible (and put the script in the link
// set), it'll be much more neighbourly and less strain on the sim.
//
// QUICK USE:
// - Drop this script in the Base.
// - Drop the "Component" Script in each building part.
// - Type: /12345 RECORD
// - Take all building parts into inventory
// - Drag building parts from inventory into Base Prim
// - Type /12345 BUILD
//
// OTHER COMMANDS
// - To reposition, move/rotate Base Prim Type: /12345 MOVE
// - To lock into position (removes scripts) Type: /12345 DONE
// - To delete building pieces: /12345 CLEAN
 
//////////////////////////////////////////////////////////////////////////////////////////
// Configurable Settings
integer PRIMCHAN = 12346;    //Channel used by Base Prim to talk to Component Prims;
// This must match in both scripts
 
//////////////////////////////////////////////////////////////////////////////////////////
// Runtime Variables (Dont need to change below here unless making a derivative)
vector vOffset;
rotation rRotation;
 
////////////////////////////////////////////////////////////////////////////////
string first_word(string In_String, string Token)
{
        //This routine searches for the first word in a string,
        // and returns it.  If no word boundary found, returns
        // the whole string.
        if(Token == "") Token = " ";
        integer pos = llSubStringIndex(In_String, Token);
 
        //Found it?
        if( pos >= 1 )
        return llGetSubString(In_String, 0, pos - 1);
        else
        return In_String;
}
 
////////////////////////////////////////////////////////////////////////////////
string other_words(string In_String, string Token)
{
        //This routine searches for the other-than-first words in a string,
        // and returns it.  If no word boundary found, returns
        // the an empty string.
        if( Token == "" ) Token = " ";
 
        integer pos = llSubStringIndex(In_String, Token);
 
        //Found it?
        if( pos >= 1 )
        return llGetSubString(In_String, pos + 1, llStringLength(In_String));
        else
        return "";
}
 
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
default
{
        //////////////////////////////////////////////////////////////////////////////////////////
        state_entry()
        {
                //Open up the listener
                llListen(PRIMCHAN, "", NULL_KEY, "");
        }
 
        //////////////////////////////////////////////////////////////////////////////////////////
        on_rez(integer iStart)
        {
                //Set the channel to what's specified
                if( iStart != 0 )
                {
                        PRIMCHAN = iStart;
                        state reset_listeners;
                }
        }
 
        //////////////////////////////////////////////////////////////////////////////////////////
        listen(integer iChan, string sName, key kID, string sText)
        {
                string sCmd = llToUpper(first_word(sText, " "));
 
                if( sCmd == "RECORD" )
                {
                        sText = other_words(sText, " ");
                        list lParams = llParseString2List(sText, [ "|" ], []);
                        vector vBase = (vector)llList2String(lParams, 0);
                        rotation rBase = (rotation)llList2String(lParams, 1);
 
                        vOffset = llGetPos() - vBase;
                        rRotation = llGetRot() / rBase;
                        llOwnerSay("Recorded position.");
                        return;
                }
 
                //////////////////////////////////////////////////////////////////////////////////////////
                if( sCmd == "MOVE" )
                {
                        //Calculate our destination position
                        sText = other_words(sText, " ");
                        list lParams = llParseString2List(sText, [ "|" ], []);
                        vector vBase = (vector)llList2String(lParams, 0);
                        rotation rBase = (rotation)llList2String(lParams, 1);
 
                        //Calculate our destination position
                        vector vDestPos = (vOffset * rBase) + vBase;
                        rotation rDestRot = rRotation * rBase;
 
                        llOwnerSay("Pos: " + (string)vDestPos + ", Rot: " + (string)rDestRot);
                        integer i = 0;
                        vector vLastPos = ZERO_VECTOR;
                        while( (i <25) && (llGetPos() != vDestPos) )
                        {
                                //If we're not there....
                                if( llGetPos() != vDestPos )
                                {
                                        //We may be stuck on the ground...
                                        //Did we move at all compared to last loop?
                                        if( llGetPos() == vLastPos )
                                        {
                                                //Yep, stuck...move straight up 10m (attempt to dislodge)
                                                llSetPos(llGetPos() + <0, 0, 10.0>);
                                        } else {
                                                //Record our spot for 'stuck' detection
                                                vLastPos = llGetPos();
                                        }
                                }
                                i++;
 
                                //Try to move to destination
                                llSetPos(vDestPos);
                                llSleep(0.1);
                        }
 
                        //Set rotation
                        llSetRot(rDestRot);
                        return;
                }
 
                //////////////////////////////////////////////////////////////////////////////////////////
                if( sCmd == "DONE" )
                {
                        //We are done, remove script
                        llRemoveInventory(llGetScriptName());
                        return;
                }
 
                //////////////////////////////////////////////////////////////////////////////////////////
                if( sCmd == "CLEAN" )
                {
                        //Clean up
                        llDie();
                        return;
                }
        }
}
 
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
state reset_listeners
{
        //////////////////////////////////////////////////////////////////////////////////////////
        state_entry()
        {
                state default;
        }
}
 
///////END SCRIPT COMPONET

 

Buddy Builder Arrow

Expired

//////START SCRIPT ////// Arrow prim
 
///a little script that shapes your prim into an arrow (good for orienting front/back/etc) - not needed, but might be handy
default
{
        state_entry()
        {
                llSetPrimitiveParams([
                PRIM_TYPE, PRIM_TYPE_SPHERE, PRIM_HOLE_DEFAULT, <0.45, 0.55, 0.0>, 0.0, ZERO_VECTOR, <0.35, 0.65, 0.0> ]);
                llSetRot(ZERO_ROTATION);
                llRemoveInventory(llGetScriptName());
        }
}
////END ARROW PRIM SCRIPT