Posted in Programming, scripting

Script: Simple voice-command RLV lock script

A script that allows any worn object or HUD to be locked in place using RLV / RLVa (a.k.a. “Remote Scripted Viewer Controls).

Introduction

I wrote this script so that items that I want to wear all the time cannot get detached when I change Outfits. Currently I use it with my wings, and my favourite HUDs. But you could use it on any object that you want to always wear, such as a wedding ring, a special necklace, or anything really.

It is suitable for any self-owned object, provided you can create a new script inside it. It is not suitable for a collar for BDSM use as it has no access list (as in, it can only be self-owned).

Usage

The script requires a viewer with RLV / RLVa (a.k.a. “Remote Scripted Viewer Controls”), which must be enabled. If not present, or disabled, then it will not work correctly.

To use, create a new script inside the wearable object or HUD that you wish to make lockable, and then paste my script into it and save it.

Voice commands

By default the script listens on channel 44. To change this to a different channel, edit the value of LISTENER_CHANNEL in the script.

The following commands are supported:

Command Description
status Shows the current status of the object (ie. if it is locked or unlocked, shown or hidden, and which channel it is listening on).
lock Locks the object so that it cannot be detached.
unlock Unlocks the object again.
hide Causes the entire object (or linkset) to be hidden.
show Causes the entire object (or linkset) to be shown.

You can disable the show / hide functionality by setting the ALLOW_HIDE variable to FALSE.

NOTE: You cannot edit the script whilst the object is locked. Simply unlock if you need to edit the script, eg. to change settings.

Background

The very first version of this script drew inspiration from a script by Antony Fairport that used LSL’s state machine for the lock & unlock. However, I found that when used in HUDs this approach got easily confused, and also it involved too much duplicate code, so I dropped that idea and instead used a single state, recording the locked state with a variable. This makes it a lot more robust when used in other objects which have existing scripts running.

License

I hereby release the script under the same license as the Second Life source code – ie. the LGPL

Credits

This is all my own work, although I drew inspiration from an old script by Antony Fairport.

Download

Becca’s RLV lock (v2.11)

 


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s