Deed Tools

From Second Life Wiki
Jump to navigation Jump to search

Directions

Put the following script in the root prim of the item you are about to Deed to Group.
Note: Make sure you are the Creator of the object you are deeding.

Syntax

/1<Name> <Command> <Parameters...>

Commands

Help

Command: help
Lists the commands via Instant Message.

Kill

Command: kill
Instantly Kills the Deeded Object

Ghost

Command: ghost <Name/UUID>
The deeded object will follow the object specified either by Name or UUID. Useful for repositioning the Deeded Object.

Command: unghost'
Stops the Deeded object from following the other object.
Note: If the other object is deleted this command is auto-ran.

Pin

Command: pin <Number>
Sets the Remote Load Script Pin to <Number>. Allows other scripts to load running scripts into the deeded object.

Command: unpin
Disables remotely loaded scripts.

Drop

Command: drop
Allows items to be dropped into the Deeded object's inventory.

Command: undrop
Disables items from being dropped into the Deeded object's inventory

Reset

Command: reset <Script>
Resets the <Script> inside the Deeded object.

Run

Command: run <Script>
Set the <Script> inside the Deeded object to Running.

Stop

Command: stop <Script>
Stops the <Script> inside the Deeded object.

Remove

Command: remove <Inventory>
Deletes <Inventory> inside the Deeded object.

Example Commands

/1MyObject kill
/1MyObject ghost AnotherObject
/1MyObject reset SomeScript
/1

DeedTools Script

<lsl> integer CHANNEL = 1; key gGhostPrim; default {

   state_entry() 
   {
       llListen(CHANNEL,"",llGetCreator(),"");
       llInstantMessage(llGetCreator(),"For help, type: /" + (string)CHANNEL + llGetObjectName() + " help\n");
   }
   listen(integer channel, string name, key id, string msg) 
   {
       string name = llToLower(llGetObjectName());
       msg = msg;
       
       if( llSubStringIndex(llToLower(msg),name) != 0) return;
       msg = llStringTrim(llGetSubString(msg,llStringLength(name),-1),STRING_TRIM);
       list params = llParseString2List(msg,[" "],[]);
       string command = llToLower(llList2String(params,0));
       string param = llDumpList2String(llDeleteSubList(params,0,0)," ");
       
       params = [];
       if( command == "help" )
       {
           llInstantMessage(id,"\nSyntax: /"+ (string)CHANNEL + llGetObjectName() + " <command> <params>\n\n" +
               "kill: Kills the object\n" +
               "ghost <name/UUID>: Follow the object and rotate along with in\n" +
               "unghost: Stop following an object\n" +
               "pin #: Sets script loading pin to <#>\n" +
               "unpin: Removes loading script pin"
           );
           llInstantMessage(id,"\n"+
               "drop: Allows objects to be dropped into the prim\n" +
               "undrop: Prevents objects from being dropped into the prim\n" +
               "reset <script>: Resets the script named <script>\n" +
               "run <script>: Starts the script named <script>\n" +
               "stop <script>: Stopts the script named <script>"
           );            
       }
       
       if( command == "kill" )
       {
           llInstantMessage(id,"Killing " + llGetObjectName() );
           llDie();
       }
       
       if( command == "move" || command == "rmove") 
       {
           vector p = (vector)param;
           if( command == "rmove" ) p += llGetPos();
           if( llVecMag( p - llGetPos() ) > 100 ) 
           {
               llInstantMessage(id,"Unable to move: Distance is too great");
               return;
           }
           while( llGetPos() != p ) {llSetPos(p);}
       }
       
       if( command == "rot" || command == "rrot" )
       {
           rotation r = llEuler2Rot((vector)param*DEG_TO_RAD);
           if( command == "rrot" ) r = llGetRot() * r;
           
           llSetRot(r);
       }
       if( command == "pin" )
       {
           llSetRemoteScriptAccessPin((integer)param);
       }
       if( command == "unpin" )
       {
           llSetRemoteScriptAccessPin(0);
       }
       if( command == "drop" ) llAllowInventoryDrop(TRUE);
       if( command == "undrop") llAllowInventoryDrop(FALSE);
       
       if( command == "reset" ) llResetOtherScript(param);
       if( command == "run" ) llSetScriptState(param,TRUE);
       if( command == "stop") llSetScriptState(param,FALSE);
       
       if(command == "remove") {
           if( llGetInventoryType(param) != INVENTORY_NONE) {
               llRemoveInventory(param);
           }
       }
       
       if( command == "ghost" )
       {
           gGhostPrim = param;
           if( llGetOwnerKey(param) == NULL_KEY ) 
           {
               llSensor(gGhostPrim,"",ACTIVE|PASSIVE,20.0,PI);
           } else {
               llSetTimerEvent(1.0);
           }
       }
       if( command == "unghost" )
       {
           llSetTimerEvent(0.0);
       }
   }
   sensor(integer i)
   {
       gGhostPrim = llDetectedKey(0);
       llSetTimerEvent(1.0);            
   }
   no_sensor()
   {
       llInstantMessage(llGetCreator(),(string)gGhostPrim + " not found");
   }
       
   timer() 
   {
       list p = llGetObjectDetails(gGhostPrim,[OBJECT_POS,OBJECT_ROT]);
       if( llGetListLength(p) == 0 ) 
       {
           llSetTimerEvent(0.0);
           llInstantMessage(llGetCreator(),"Object Lost..");
       } else {
           llSetPos(llList2Vector(p,0));
           llSetRot(llList2Rot(p,1));
       }
   }

} </lsl>