LSL Protocol/LockMeister System

From Second Life Wiki
Jump to: navigation, search


The LockMeister System is a keyring of commands used for enhanced functions in bondage toys, its main function is to get the keys needed for particle chains, but as the protocol grow more and more commands are added. This protocol is maintained and designed by Kyrah Abattoir, IM her inworld if you have suggestions.

Return to protocol exchange


  • Simple to use
  • Flexible
  • Fully backward compatible
  • Sensorless key grabbing (possible on child prims too) for particle chains (several mooring points)
  • Boot/shoes animation overrider controlling (on/off)
  • Color propagation in a lockmeister item set

Legacy Functions (LMV1)

Basically, all LockMeister items listen on channel -8888
Its strongly recommended to use only the llWhisper function for sending the commands

When someone sits, click (the interaction model is left to the imagination of the scripter) on a LockMeister compliant item, this one will sequentially send the ping messages to each of the mooring points it needs, for example for a St. Andree Cross we will ping the wrist and ankle cuffs, in our example we see we will have to send the messages lcuff,rcuff,llcuff,rlcuff (which are the ones for these points).
When a LockMeister attachment detects the message corresponding to itself in the channel -8888 it will answer by the same message completed by "ok"

'An item will send the message using this format:
message shape: <avatar key><command> example: "748bb591-0d9d-4907-8287-dc27b8267e24lcuff" (we ping the left wrist cuff attachment of the avatar whose key is positioned before the name of the attachment point, or command)
The concerned attachment will answer:
message shape: <avatar key><command>" ok" example: "748bb591-0d9d-4907-8287-dc27b8267e24lcuff ok" (the concerned object answer on the channel -8888)

In order to draw a chain of particles we need the key of the object. When we used the listener event to get the answer message, the listen event returned us the key of the object that answered in it's key id field. This is the key of the speaking prim, which should be the prim we need to attach the chain to.

The New Extension (LMV2)

The LockMeister protocol version 2 (LMV2) is built over the initial protocol (LMV1) and is designed to allow scripters to create furnitures and attachments without needing a slave script in every anchor prims. Linden Labs declared that they wouldn't be supporting any method for sending chat from a root prim and making it come from a child prim ( no "llLinkSay(integer link_number,integer channel,string message )" for example. ), the LMV2 protocol adds an extra set of commands to get around this problem.

'An item will send the message using this format (same as V1):
message shape: <avatar key><command>
example: "748bb591-0d9d-4907-8287-dc27b8267e24lcuff"
(we ping the left wrist cuff attachment of the avatar whose key is positioned before the name of the attachment point, or command)

The concerned attachment will answer (same as V1):
message shape: <avatar key><command>" ok"
example: "748bb591-0d9d-4907-8287-dc27b8267e24lcuff ok" (the concerned object answer on the channel -8888)

We now have in the listen event 'id' parameter a key, we should start using it as a particle target, if the object is only LMV1 it will be the proper target id, but if the object is LMV2, this will most likely be the root prim of the object. now we can use this id to send the lmv2 messages using llRegionSayTo()


'The item can now send an LMV2 message using this format:
message shape: <avatar key>|LMV2|RequestPoint|<anchor point>
example: "748bb591-0d9d-4907-8287-dc27b8267e24|LMV2|RequestPoint|lcuff"

The concerned attachment will answer (if it is LMV2 compatible):
message shape: <avatar key>|LMV2|ReplyPoint|<anchor point>|<anchor point key>
example: "748bb591-0d9d-4907-8287-dc27b8267e24|LMV2|ReplyPoint|lcuff|636bbccc-0d9d-4907-8287-dc27b8267e24"

If the target object doesn't support LMV2, we won't receive any answer, so it's important to start drawing the particles before the LMV2 reply comes. If the reply DOES arrive, we can grab the new target key and synchronise our particle system.

Complete List of Mooring Points

# name Description
1 rcuff right wrist cuff
2 rbiceps right upperarm cuff
3 lbiceps left upper arm cuff
4 lcuff left wrist cuff
5 lblade left shoulder blade
6 rblade right shoulder blade
7 rnipple right nipple point
8 lnipple left nipple point
9 rfbelt right front of the belt
10 lfbelt left front of the belt
11 rtigh right upper leg cuff
12 ltigh left upper leg cuff
13 rlcuff right ankle cuff
14 llcuff left ankle cuff
15 lbbelt left back of the belt
16 rbbelt right back of the belt
17 pelvis lower front of the pelvis
18 fbelt front of the belt
19 bbelt back of the belt
20 rcollar right of the collar
21 lcollar left of the collar
22 thead top of the head
23 collar front of the collar
24 lbit left corner of mouth/cheek (for pony bits)
25 rbit right corner of mouth/cheek (for pony bits)
26 nose nose
27 bcollar back of the collar
28 back middle of the back
29 lhand left hand (e.g. for mittens)
30 rhand right hand (e.g. for mittens)
31 rbelt right side of the belt
32 lbelt left side of the belt
33 chest center of the chest, on the solar plexus (not currently in the picture)

NOTE: ltigh/rtigh were typos introduced during LM1 so for compatibility reasons we are keeping them as is.


  • handle - type "leash handle" , this is useful for leashing to a leash handle.
  • tether - type "tether point" , this is useful for leashing to some fixed anchor.

Special Commands

<avatar key>col<vector> - order a color change (used in LockMeister collars to tint the cuffs like the collar) OPTIONAL
ex: "748bb591-0d9d-4907-8287-dc27b8267e24col<1.0,1.0,1.0>" will say to an item able to understand it (color yourself in white)

<avatar key>booton/bootoff = commands sent by collar objects, asking that the shoes animation overrider be started or stopped
ex: "748bb591-0d9d-4907-8287-dc27b8267e24booton" activate the animation overrider
ex: "748bb591-0d9d-4907-8287-dc27b8267e24bootoff" deactivate the animation overrider

Amethyst extension commands (LMV1)

The following commands are not part of the main lockmeister protocol, but additions Amethyst Rosencrans made in her sold and free cuff scripts. They are here to document the extensions so others can utilize them.

<avatar key>target|point1|point2 = Connect a chain from mooring point 1 to mooring point 2 ex: "748bb591-0d9d-4907-8287-dc27b8267e24target|lcuff|rcuff" will create a chain from the left cuff to the right cuff

<avatar key>target|point = Remove a chain from mooring point ex: "748bb591-0d9d-4907-8287-dc27b8267e24target|lcuff" will remove a chain from the left cuff

<avatar key>texture|<texture key> = Change the texture of the chains used by the target command ex: "748bb591-0d9d-4907-8287-dc27b8267e24texture|1ffb37fa-2fc1-dbec-d8ea-0607583a03c6" will change the chain texture

<avatar key>gravity|<downward acceleration float> = Change the rate at which the chain particles move down ex: "748bb591-0d9d-4907-8287-dc27b8267e24gravity|0.5" will change the chain texture to move down half a meter a second

<avatar key>age|<age float> = Change how fast the chain particles move from point 1 to point 2 ex: "748bb591-0d9d-4907-8287-dc27b8267e24age|2.0" will change the chain texture to move the distance in 2 seconds

Cool Products extension commands (LMV1)

The following commands are not part of the main lockmeister protocol, but additions Henri Beauchamp made for use by his Cool Products (such as the Cool Collar). They are here to document the extensions so others can utilize them.

<avatar key>point here = Signals that anchoring point "point" just appeared. ex: "748bb591-0d9d-4907-8287-dc27b8267e24handle here" could be emitted by the on_rez event of a leash handle to signal the collars connected to the owner of the leash handle that they should connect to it instead of staying connected to the center of the avatar.

<avatar key>point gone = Signals that anchoring point "point" just disappeared. ex: "748bb591-0d9d-4907-8287-dc27b8267e24handle gone" could be emitted by the a leash handle when it is detached to signal the collars connected to it that they should unleash.

(unknown) extension commands (LMV1)

<toucher key>post ok = Signals that <toucher key> has touched an object. The toy will then issue an "<object key>handle" command to the object, which will return "<object key>handle ok" to activate the leash.

Note about message sending

  • It is recommended to send the LMV1 "ping" messages through llWhisper so only close proximity objects will receive them.
  • Now that llRegionSayTo() is available, it is strongly recommended to send "pong" messages through llRegionSayTo(), because of this, it is NOT recommended to have objects rely on "message snooping", because they won't be able to see message replies with llRegionSayTo().
  • LMV2 Messages should ALWAYS be send using llRegionSayTo().

Seal Of Approval (optional)

The seal of aproval program is currently discontinued.

Example Scripts

Example Attachment Script

//KDC sample LockMeister attachment version 1.1a
//NOTE: This script must be in the root prim of the object for working properly
//      Please ensure that you named the anchor prim properly too, this is the prim the script will look for
//      when sending LMV2 replies.
//      ...
//      in a general way this script is here as an explanation to the LockMeister System so ... WRITE YOUR OWN CODE!!
//KDC, kyrah design concept
string mooring_point = "lcuff";
//write here the mooring point you want to use
string anchor_name   = "";
//write here the name of the child prim that will act as the anchor point, leave blank to use the root.
    attach(key id)
        if(id != NULL_KEY)
        llListen(-8888,"","","");//open the lockmeister channel
    listen(integer channel,string name,key id,string message)
        //This will ensure that we only answer to LockMeister messages when we are attached to an avatar.
        if( !llGetAttached() )
        if (message == (string)llGetOwner()+ mooring_point)
        {   //This part reply to Lockmeister v1 messages
            //message structure:   llGetOwner()+mooring_point ( without the '+' )
            llWhisper(-8888, (string)llGetOwner()+ mooring_point+" ok");//answering it
            //message structure:   llGetOwner()+mooring_point+" ok" ( without the '+' )
        //we parse the message into a list and recover each element.
        list params = llParseString2List( message, ["|"], [] );
        if( llList2List(params,0,3) == [llGetOwner(), "LMV2", "RequestPoint", mooring_point] )
            //this message is for us, it's claiming to be an LMV2 message, it's a "Request" message, and concerns the mooring_point we specified
            //message structure:   llGetOwner()|LMV2|RequestPoint|anchor_name
            //Now that we are certain that the message concerns us, we look for the prim key to insert in our reply.
            if(anchor_name   == "")
                //If there is no anchor set, we assume root prim.
                llRegionSayTo( id, -8888, llDumpList2String( [llGetOwner(), "LMV2", "ReplyPoint", mooring_point, llGetKey()], "|" ) );
                //Otherwise, we loop through the link set looking for a match.
                integer i;
                for( i = 1; i <= llGetNumberOfPrims(); i++)
                    if( llGetLinkName(i) == anchor_name )
                    {   //If this is our anchor prim, we reply
                        //pattern sent:   llGetOwner()|LMV2|ReplyPoint|anchor_name|anchor_key
                        llRegionSayTo( id, -8888, llDumpList2String( [llGetOwner(), "LMV2", "ReplyPoint", mooring_point, llGetLinkKey(i)], "|" ) );

Example Furniture Script

//Copyright (c) 2017 KDC: Kyrah Design Concept
//Lockmeister sample furniture code
//This is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//GNU Affero General Public License for more details.
//You should have received a copy of the GNU Affero General Public License
//along with this program. If not, see <>.
list    LM_TARGETS      = ["lcuff","rcuff"];    //the lm targets you are looking to bind to (the target child prim will have to use the same name).
key     SIT_ANIMATION   = "";                   //put your sit animation name here.
vector  SIT_OFFSET      = <0,0,0.1>;            //change the sitting offset, please note that it cannot be 0,0,0 or sl disable sit targets.
vector  SIT_ROTATION    = <0,0,0>;              //the rotation of the avatar, in degrees, for your convenience.
key     CHAIN_TEXTURE   = TEXTURE_BLANK;        //the chain texture.
integer LM_CHANNEL = -8888;
list    lm_target_states;
integer lm_handle;
key sitting_avatar;
	lm_target_states = [];
	integer max = llGetListLength(LM_TARGETS);
	    lm_target_states += 0;
SetParticles(key target, string lm_code)
	integer max = llGetNumberOfPrims() + 1;
        if(llGetLinkName(max) == lm_code)
            if(target == NULL_KEY)
                                            PSYS_PART_START_SCALE, < 0.05, 0.05, 0.0 >,
                                            PSYS_PART_MAX_AGE, 3.0,
                                            PSYS_SRC_BURST_RATE, 0.001,
                                            PSYS_SRC_TEXTURE, CHAIN_TEXTURE,
                                            PSYS_SRC_TARGET_KEY, target,
                                            PSYS_SRC_BURST_PART_COUNT, 1,
                                            PSYS_SRC_ACCEL, < 0, 0, -0.01 >
        lm_handle = llListen(LM_CHANNEL,"","","");
    changed(integer change)
        if(!(change & CHANGED_LINK))
        if(sitting_avatar == llAvatarOnSitTarget())
        sitting_avatar = llAvatarOnSitTarget();
        if(sitting_avatar != NULL_KEY)
            if(SIT_ANIMATION != "")   //If we have an animation, request animation permission.
            llListenControl(lm_handle,TRUE);    //open listener.
            integer max = llGetListLength(LM_TARGETS);
            while(max--)            //call all the anchors, LMV1 style.
                llRegionSayTo(sitting_avatar,LM_CHANNEL,(string)sitting_avatar + llList2String(LM_TARGETS,max) );
            if(llGetPermissions()) //If we have been granted permissions, stop animating.
    run_time_permissions(integer perms)
        if( (perms & PERMISSION_TRIGGER_ANIMATION) && (SIT_ANIMATION != "") )
            llStopAnimation("Sit");     //Some poses
            llStartAnimation("Stand");  //Work better with these 2 lines
    listen(integer channel,string name,key id,string message)
        if(llGetSubString(message,0,35) != sitting_avatar) //this ensures that the message is for us LMV1 or LMV2 wise.
        if(llGetOwnerKey(id) != sitting_avatar) //reject if the message doesn't come from an attachment owned by the avatar
        if(llGetSubString(message,-3,-1) == " ok")//lmv1 ' ok' received
            string  lmv1_anchor = llGetSubString(message,36,-4);//strip the 'ok' and the 'target key'.
            integer lmv1_index = llListFindList(LM_TARGETS,[lmv1_anchor]);
            if( (lmv1_index != -1) && (llList2Integer(lm_target_states,lmv1_index) == 0) )  //This is for us (LMV1)
                SetParticles(id, lmv1_anchor);
                lm_target_states = llListReplaceList(lm_target_states,[1],lmv1_index,lmv1_index);
        else    //lets see if it's an LMV2 message then.
            list commands     = llParseString2List(message,["|"],[]);
            string target     = llList2String(    commands, 0);
            string protocol   = llList2String(    commands, 1); //for us it should be "lmv2" as in "lockmeister version 2"
            string command    = llList2String(    commands, 2); //"request" or "reply"
            string lm_anchor  = llList2String(    commands, 3); //the lm point 
            string target_key = llList2String(    commands, 4); //the actual key we should latch to.
            if( target != sitting_avatar || protocol != "LMV2" || command != "ReplyPoint")
                return; //Early bailing out if the command isn't formatted properly.
            integer lmv2_index = llListFindList(LM_TARGETS,[lm_anchor]);
            if( (lmv2_index != -1) && (llList2Integer(lm_target_states,lmv2_index) == 1) )  //This is for us (LMV2)
                SetParticles(target_key, lm_anchor);
                lm_target_states = llListReplaceList(lm_target_states,[2],lmv2_index,lmv2_index);
            //this section is not strictly necessary but we can close the listener early
            //if all the anchors are in the lmv2 state.
            integer close_listener;
            integer max = llGetListLength(lm_target_states);
                if(llList2Integer(lm_target_states,max) == 2)
            if(close_listener == llGetListLength(lm_target_states))
        //Close the listener after a little while.