Deed Tools
Revision as of 21:07, 29 May 2008 by Falados Kapuskas (talk | contribs) (New page: <lsl> integer CHANNEL = 1; key gGhostPrim; default { state_entry() { llListen(CHANNEL,"",llGetCreator(),""); llInstantMessage(llGetCreator(),"For help, type: /" +...)
<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 == "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>