LSL Protocol/LockGuard

From Second Life Wiki
Jump to navigation Jump to search
KBcaution.png Important: This page has been imported from a archived copy of LSL Wiki and may need cleaning up.


LockGuard V2 Specification

LockGuard V2 is a particle chain system designed for creating and linking particle chains from one object to another using the simplest possible method while providing the framework for the most elaborate linking schemes imaginable. Designed to be modular, expandable, and with versatility in mind, LockGuard can link particle chains from one attachment to another, from an attachment to a world object, from a world object to an attachment, or from one world object to another world object. LockGuard can even be told to link from one object to another from an entirely different object or call a whole set of LockGuard particle chains at once..... with very minimal scripting. In fact, in one single line of script you can command the LockGuard V2 Script to configure and link a whole set of particle chains at once, that's the power of LockGuard V2.

LockGuard V2 and the LockGuard V2 Script are free for personal and commercial use with no limitations and no restrictions. The LockGuard Logo is also free for you to use with your product should you choose to use LockGuard (the Logo is available in any LockGuard package in-world).

If you have any questions, comments, or suggestions for LockGuard then send me, Lillani Lowell, a message and I will try my best to assist you.

LockGuard V2 Links

Creating a LockGuard-Enabled Object

LockGuard V2 Script - Open Source

Calling LockGuard V2

So, enough with the babble, let's get right to the code examples:

default
{

   touch_start( integer num )
   {

      llWhisper( -9119, "lockguard " + (string)llDetectedKey(0) + " leftwrist link " + (string)llGetKey() );
      llWhisper( -9119, "lockguard " + (string)llDetectedKey(0) + " rightwrist link " + (string)llGetKey() );

   }

}

Alternatively.....

default
{

   touch_start( integer num )
   {

      llWhisper( -9119, "lockguard " + (string)llDetectedKey(0) + " wrists link " + (string)llGetKey() );

   }

}

The above are two LockGuard V2 compatible calling scripts which you can place into the prim which you want to attach chains to. Once you've done so, put on a pair of LockGuard cuffs, touch the prim, and the LockGuard System will link the respective particle chains from the left and right wrist to the prim. This is a bare bones script for calling a LockGuard particle chain from a LockGuard Item, and it is that easy.

Here are a few more examples which uses multiple commands to perform chain configuration and then link:

default
{

   touch_start( integer num )
   {

      llWhisper( -9119, "lockguard " + (string)llDetectedKey(0) + " wrists life 2 size 0.6 0.6 link " + (string)llGetKey() );

   }

}
default
{

   touch_start( integer num )
   {

      llWhisper( -9119, "lockguard " + (string)llDetectedKey(0) + " wrists gravity 4 life 1.5 color 1 0 0 link " + (string)llGetKey() );

   }

}

LockGuard Commandline

Let's disect this line.....

llWhisper( -9119, "lockguard " + (string)llDetectedKey(0) + " wrists link " + (string)llGetKey() );

.....into its basic components.

The above line, is in essence, a LockGuard commandline which tells the LockGuard V2 Script what to do. It can be broken down into the follow components.....

lockguard [avatarKey/ownerKey] [item] [command] [variable(s)]

Command Action
lockguard The very first thing the LockGuard Library looks for is this command, it does this to validate that the command on the given channel is indeed a LockGuard Command. If the message is not prefixed by lockguard then LockGuard will ignore the entire message.
[avatarKey/ownerKey] The second thing the LockGuard Library will look for is ownership. LockGuard will want to know whose particle chains should be responding to the commandline. In the example above, the key of the avatar is gathered through llDetectedKey during a touch event.
[item] The next thing the LockGuard Library requires is the name of the LockGuard Item from which you wish to call the particle chain from. In the example above, the leftwrist and rightwrist are called, because the example expects you to be wearing a pair of LockGuard cuffs which are defined as leftwrist and rightwrist. If you specify ALL for item, then all nearby LockGuard Items attributed to the avatarKey above will respond.
[command] [variable(s)] The heart of the LockGuard Library is its command set, which allows you to link, unlink, configure, and control the particle chain. The commands are explained a little further below, along with their respective variables. Multiple commands and variables can be places one after the other. So, you can place texture, size, life, and link commands in one single chat block.

So, the best way to explain the line of script above is to compare it to saying, "Hey LockGuard! Yeah, the stuff belonging to Lillani Lowell! I want the wrists to link to me, and here's the key you should link to!"

LockGuard Commands and Variables

The only commands which are necessary for LockGuard to operate are the link and unlink commands which are used to create and break particle chains. All other commands are optional, and only need to be used when you have a use for them. LockGuard Items will automatically revert back to their default settings when unlinked or reattached.

Command Variable Explaination
link key This command will inform LockGuard that it should create a particle chain and link it to the key provided, the key can be any valid object or avatar key.
unlink N/A This command will inform LockGuard to unlink its particle chain. No variables are required.
gravity #grav This command will change the effect gravity has on your particle chains.
life #sec Sending this command will tell LockGuard how long each particle chain link should live in seconds, or in other words, how fast it should move from origin to destination. For instance, a value of 1 will create a faster, tigher particle chain while a value of 5 would create a loose, slower particle chain. Chain life can be modified "on the fly" as needed.
color #r #g #b Sending this command will change the color or tint of your particle chain. The values are red, green, blue, and each one is a value between 0 and 1, with 0 being dark, 0.5 being middle, and 1 being bright.
size #x #y Sending this command will tell LockGuard how large each particle chain link should be. The smaller the value, the smaller the particle links, and the less visible they are from a distance.
texture UUID If you want your furniture to change the default particle chain texture of the LockGuard Library then simply send this command and LockGuard will obediently swap out textures for you. There are two default textures included with LockGuard. One is a chain, the other is a rope. You can choose either of these by sending "rope" or "chain" as the UUID and LockGuard will automatically assign the default UUID for the one you choose.