Difference between revisions of "Punkysnippets"

From Second Life Wiki
Jump to navigation Jump to search
Line 123: Line 123:
         llSleep(10); //sleep and send the message once more to make sure it's locked on.
         llSleep(10); //sleep and send the message once more to make sure it's locked on.
         llOwnerSay("@detach=n");
         llOwnerSay("@detach=n");
    }
}
</lsl>
===Non-prim strip-prevention!===
Ever get tired of being stripped and you would rather keep your clothes on?!
Well this is the script for you!
<lsl>
default
{
    state_entry()
    {
        llOwnerSay("@remoutfit=n");
    }
    on_rez(integer r)
    {
        llOwnerSay("@remoutfit=n");
        llSleep(10);
        llOwnerSay("@remoutfit=n");
     }
     }
}
}
</lsl>
</lsl>

Revision as of 19:25, 22 July 2008

Basic Scripts!


Below are some small example scripts and misc useful codes for inserts!


Simple leashing script

This is mearly an example for a leash, you will need to change the on/off to fit your need, the length and etc. <lsl> string texturename = "08d5770f-d3c4-7d4a-5a2b-2a1c126643d9"; string nullstr = ""; key nullkey = NULL_KEY; key posekey = nullkey; float age = 3; float gravity = 1.0; key currenttarget = nullkey; string ourtarget = nullstr; integer line; key loadkey; UpdateParticles(key leashtarget) {

   currenttarget = leashtarget;
   llParticleSystem( [
   PSYS_PART_START_SCALE,(vector) <0.075,0.075,0>,
   PSYS_PART_END_SCALE,(vector) <1,1,0>,
   PSYS_PART_START_COLOR,(vector) <1,1,1>,
   PSYS_PART_END_COLOR,(vector) <1,1,1>,
   PSYS_PART_START_ALPHA,(float) 1.0,
   PSYS_PART_END_ALPHA,(float) 1.0,
   PSYS_SRC_TEXTURE,(string) texturename,
   PSYS_SRC_BURST_PART_COUNT,(integer) 1,
   PSYS_SRC_BURST_RATE,(float) 0.0,
   PSYS_PART_MAX_AGE,(float) age,
   PSYS_SRC_MAX_AGE,(float) 0.0,
   PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,
   PSYS_SRC_BURST_RADIUS,(float) 0.5,
   PSYS_SRC_INNERANGLE,(float) 0.0,
   PSYS_SRC_OUTERANGLE,(float) 0.0,
   PSYS_SRC_OMEGA,(vector) <0,0,0>,
   PSYS_SRC_ACCEL,(vector) <0,0,-gravity>,
   PSYS_SRC_BURST_SPEED_MIN,(float) 1000.0,
   PSYS_SRC_BURST_SPEED_MAX,(float) 1000.0,
   PSYS_SRC_TARGET_KEY,(key) leashtarget,
   PSYS_PART_FLAGS,
    PSYS_PART_FOLLOW_VELOCITY_MASK |
    PSYS_PART_FOLLOW_SRC_MASK |
    PSYS_PART_TARGET_POS_MASK | 0
   ] );

} integer isKey(key in) {

   if(in) return 2;
   return (in == nullkey);

} ///// /////Leash Vari ///// vector target; vector subpos; float dist; integer leash_length = 2; key ptarget; key owner; string targetN; default {

   on_rez(integer r)
   {
       owner = llGetOwner();
   }
   state_entry()
   {
       llParticleSystem([]);
       owner = llGetOwner();
       llListen(0, "", owner, "");
   }
   listen(integer chan, string name, key id, string msg)
   {
       list parse = llParseString2List(msg, ["|"], []);
       if(llList2String(parse, 0) == "leash")
       {
           llSensorRepeat("", (key)llList2String(parse, 1), AGENT, 96, PI, 0.2);
       }
   }
   sensor(integer s)
   {
       target = llDetectedPos(0);
       ptarget = llDetectedKey(0);
       subpos = llGetPos();
       dist = llVecDist(subpos, target);
       UpdateParticles(ptarget);
       if(dist >= (leash_length + 1))
       {
           llMoveToTarget(target, 0.75);
       }
       if(dist <= leash_length)
       {
           llStopMoveToTarget();
       }
   }
   no_sensor()
   {
       llParticleSystem([]);
       llStopMoveToTarget();
   }

} </lsl>

RLV Scripts

This section is devoted to scripts used for the RLV (RestrainedLife Viewer)


Simple welder

<lsl> default {

   state_entry()
   {
       llOwnerSay("@detach=n");
   }
   on_rez(integer r)
   {
       llOwnerSay("@detach=n");
       llSleep(10); //sleep and send the message once more to make sure it's locked on.
       llOwnerSay("@detach=n");
   }

} </lsl>

Non-prim strip-prevention!

Ever get tired of being stripped and you would rather keep your clothes on?! Well this is the script for you! <lsl> default {

   state_entry()
   {
       llOwnerSay("@remoutfit=n");
   }
   on_rez(integer r)
   {
       llOwnerSay("@remoutfit=n");
       llSleep(10);
       llOwnerSay("@remoutfit=n");
   }

} </lsl>