Difference between revisions of "Deed Tools"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL Header}}
{{LSL Header}}
==Description==
This script allows you some limited control over objects onces they have been deeded to group.  This is helpful if you do not wish to re-create the object, or you do not have permissions to return deeded objects.
==Directions==
==Directions==
Put the following script in the root prim of the item you are about to Deed to Group.<br/>
Put the following script in the root prim of the item you are about to Deed to Group.<br/>
Line 11: Line 14:


===Help===
===Help===
Command: '''help'''
Command: '''help'''<br/>
Lists the commands via Instant Message.
Lists the commands via Instant Message.
===Move/Rotation===
Command: '''move''' ''<Position>''<br/>
Command: '''rmove''' ''<Relative Position>''<br/>
Command: '''rot''' ''<Rotation>''<br/>
Command: '''rrot''' ''<Relative Rotation>''<br/>
These commands move and rotate the Deeded object.  Positions are given in region coordinates, rotation is in Degrees.
The '''rmove''' and '''rrot''' commands move and rotate the prim relative to its current position and rotation.


===Kill===
===Kill===
Command: '''kill'''
Command: '''kill'''<br/>
Instantly Kills the Deeded Object
Instantly Kills the Deeded Object


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


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


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


Command: '''unpin'''
Command: '''unpin'''<br/>
Disables remotely loaded scripts.
Disables remotely loaded scripts.


===Drop===
===Drop===
Command: '''drop'''
Command: '''drop'''<br/>
Allows items to be dropped into the Deeded object's inventory.
Allows items to be dropped into the Deeded object's inventory.


Command: '''undrop'''
Command: '''undrop'''<br/>
Disables items from being dropped into the Deeded object's inventory
Disables items from being dropped into the Deeded object's inventory


===Reset===
===Reset===
Command: '''reset''' ''<Script>''
Command: '''reset''' ''<Script>''<br/>
Resets the <Script> inside the Deeded object.
Resets the <Script> inside the Deeded object.


===Run===
===Run===
Command: '''run''' ''<Script>''
Command: '''run''' ''<Script>''<br/>
Set the <Script> inside the Deeded object to Running.
Set the <Script> inside the Deeded object to Running.


===Stop===
===Stop===
Command: '''stop''' ''<Script>''
Command: '''stop''' ''<Script>''<br/>
Stops the <Script> inside the Deeded object.
Stops the <Script> inside the Deeded object.
===Remove===
Command: '''remove''' ''<Inventory>''<br/>
Deletes <Inventory> inside the Deeded object.


==Example Commands==
==Example Commands==
Line 57: Line 73:
/1MyObject ghost AnotherObject
/1MyObject ghost AnotherObject
/1MyObject reset SomeScript
/1MyObject reset SomeScript
/1
/1MyObject rot <45,90,270>
</pre>
</pre>
==DeedTools Script==
==DeedTools Script==


<lsl>
<source lang="lsl2">integer CHANNEL = 1;
integer CHANNEL = 1;
key gGhostPrim;
key gGhostPrim;
default  
default  
Line 74: Line 90:
     {
     {
         string name = llToLower(llGetObjectName());
         string name = llToLower(llGetObjectName());
        msg = msg;
          
          
         if( llSubStringIndex(llToLower(msg),name) != 0) return;
         if( llSubStringIndex(llToLower(msg),name) != 0) return;
Line 103: Line 118:
         }
         }
          
          
         if( command == "kill" )
         else if( command == "kill" )
         {
         {
             llInstantMessage(id,"Killing " + llGetObjectName() );
             llInstantMessage(id,"Killing " + llGetObjectName() );
Line 109: Line 124:
         }
         }
          
          
         if( command == "move" || command == "rmove")  
         else if( command == "move" || command == "rmove")  
         {
         {
             vector p = (vector)param;
             vector p = (vector)param;
Line 121: Line 136:
         }
         }
          
          
         if( command == "rot" || command == "rrot" )
         else if( command == "rot" || command == "rrot" )
         {
         {
             rotation r = llEuler2Rot((vector)param*DEG_TO_RAD);
             rotation r = llEuler2Rot((vector)param*DEG_TO_RAD);
Line 128: Line 143:
             llSetRot(r);
             llSetRot(r);
         }
         }
         if( command == "pin" )
         else if( command == "pin" )
         {
         {
             llSetRemoteScriptAccessPin((integer)param);
             llSetRemoteScriptAccessPin((integer)param);
         }
         }
         if( command == "unpin" )
         else if( command == "unpin" )
         {
         {
             llSetRemoteScriptAccessPin(0);
             llSetRemoteScriptAccessPin(0);
         }
         }
         if( command == "drop" ) llAllowInventoryDrop(TRUE);
         else if( command == "drop" ) llAllowInventoryDrop(TRUE);
         if( command == "undrop") llAllowInventoryDrop(FALSE);
         else if( command == "undrop") llAllowInventoryDrop(FALSE);
       
        else if( command == "reset" ) llResetOtherScript(param);
        else if( command == "run" ) llSetScriptState(param,TRUE);
        else if( command == "stop") llSetScriptState(param,FALSE);
          
          
         if( command == "reset" ) llResetOtherScript(param);
         else if(command == "remove") {
        if( command == "run" ) llSetScriptState(param,TRUE);
            if( llGetInventoryType(param) != INVENTORY_NONE) {
        if( command == "stop") llSetScriptState(param,FALSE);
                llRemoveInventory(param);
            }
        }
          
          
         if( command == "ghost" )
         else if( command == "ghost" )
         {
         {
             gGhostPrim = param;
             gGhostPrim = param;
Line 153: Line 174:
             }
             }
         }
         }
         if( command == "unghost" )
         else if( command == "unghost" )
         {
         {
             llSetTimerEvent(0.0);
             llSetTimerEvent(0.0);
Line 180: Line 201:
         }
         }
     }
     }
}
}</source>
</lsl>

Latest revision as of 19:52, 24 January 2015

Description

This script allows you some limited control over objects onces they have been deeded to group. This is helpful if you do not wish to re-create the object, or you do not have permissions to return deeded objects.

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.

Move/Rotation

Command: move <Position>
Command: rmove <Relative Position>
Command: rot <Rotation>
Command: rrot <Relative Rotation>

These commands move and rotate the Deeded object. Positions are given in region coordinates, rotation is in Degrees. The rmove and rrot commands move and rotate the prim relative to its current position and rotation.

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
/1MyObject rot <45,90,270>

DeedTools Script

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());
        
        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>"
            );            
        }
        
        else if( command == "kill" )
        {
            llInstantMessage(id,"Killing " + llGetObjectName() );
            llDie();
        }
        
        else 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);}
        }
        
        else if( command == "rot" || command == "rrot" )
        {
            rotation r = llEuler2Rot((vector)param*DEG_TO_RAD);
            if( command == "rrot" ) r = llGetRot() * r;
            
            llSetRot(r);
        }
        else if( command == "pin" )
        {
            llSetRemoteScriptAccessPin((integer)param);
        }
        else if( command == "unpin" )
        {
            llSetRemoteScriptAccessPin(0);
        }
        else if( command == "drop" ) llAllowInventoryDrop(TRUE);
        else if( command == "undrop") llAllowInventoryDrop(FALSE);
        
        else if( command == "reset" ) llResetOtherScript(param);
        else if( command == "run" ) llSetScriptState(param,TRUE);
        else if( command == "stop") llSetScriptState(param,FALSE);
        
        else if(command == "remove") {
            if( llGetInventoryType(param) != INVENTORY_NONE) {
                llRemoveInventory(param);
            }
        }
        
        else if( command == "ghost" )
        {
            gGhostPrim = param;
            if( llGetOwnerKey(param) == NULL_KEY ) 
            {
                llSensor(gGhostPrim,"",ACTIVE|PASSIVE,20.0,PI);
            } else {
                llSetTimerEvent(1.0);
            }
        }
        else 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));
        }
    }
}