Handy's swing system - instructions

Designed for builders and content creators, Handy's swing system lets you make your products swing smoothly back and forth easily without having to write scripts - setup is through simple menus. It's suitable for swings, rocking chairs, pendulums and so on. In this guide, we'll take about swings, but exactly the same principle apply to other objects.

The swing system uses the "omega" feature of Second Life to achieve a smooth motion, in which the prim(s) rotate around their own axis without any jerking.

Click here for a list of features.

What you get

You should have the following scripts:

Handy's swing control*

This is the script that controls the swing. You have copy/transfer permission on this script, so you can include it in the products you sell or give away.

Handy's swing setup*

This script is the one you use to set up the swing, and lets you define such things as the swing texture, its size, colour, thickness, and so on. The script is copy only, and you would remove the script when you're ready to sell or give away your product.

Creating a swing

Included with the system is a simple example swing to practice with if you wish to.


The scripts can work in two ways:

  1. In the root prim - the whole object will swing
  2. In a child prim - only that one prim will swing

The first is suitable for swings that may be sat upon by an avatar, the second for pendulums, etc.

Script in root prim

For a swing, a typical construction could look like this:

Swing construction

The whole object rotates around the centre of the root prim, which contains the control script (and setup scripts, etc as appropriate).

Script in child prim

A pendulum for a clock might like like this:

Pendulum construction

The scripts are in the child prim, which rotates relative to the whole object.

If an avatar sits on a child prim in the second type of build, they will not move with "omega" motion because the centre of that prim remains stationary, so this type of construction is not suitable for a sittable swing.

Adding the scripts

When you're ready to set up the swinging motion, drop the Handy's swing control and Handy's swing setup scripts into the contents of the appropriate prim.

When you do this, you will see this menu:

Axis menu

The first thing the script needs to know is which direction the swing will move in. Just click X, Y or Z and the swing will start moving on that axis.

You may notice that the scripts set the prim description to what looks like random characters, but is in fact your setup data. For an explanation, see the sections Prim descriptions and data and Using a notecard to store data.

When you have select an axis, the menu will change slightly to look like this ...

AXIS menu

Axis menu

In that example, I clicked the Y option, and the menu shows that after "Current axis". If it's moving in the wrong direction, just click another of the options until it looks right - each time, the swing will stop and then start again in the new direction.

When the swing is moving in the right direction, click the < MAIN MENU button to get to the main menu ...

Main menu

The options OPTIONS, SOUND, AXIS, SPEED and ANGLE (links) all take you to other menus, which is why they are in UPPER CASE (all upper-case options take you to menus).

Off or On stop or start the swing.

Reset sets everything back the way it started, so any changes you made are undone.

Finish closes the menu, and asks you if you want to delete the setup script (say "No" for now). Click the prim to get the menu back.

Help tells you the link to these instructions in chat.

With all the menus, you can always come back if you change your mind later. Nothing is permanent.

The main work is done in these other menus, so let's go through them one by one.

If at any time you find you have no menu at all, just click the prim to get the menu back.

SPEED menu

This lets you control how quickly the swing moves.

Speed menu

The +++ , ++ , + ,  - - - , - - and - buttons make the swing move faster and slower. When you select one of these, the swing will start moving at the new speed, so you can adjust it until it looks right.

The current approximate speed is shown above the menu, both in terms of how many swings per minute and in how long each swing takes.

Select < MAIN MENU to go back to the main menu, or Reset to set the speed back to the default 60 swings per minute.

ANGLE menu

This lets you control how quickly the swing moves.

Speed menu

Again, +++ , ++ , + ,  - - - , - - and - buttons adjust the value, this time for how far the swing travels.

The current approximate angle is shown above the menu.

Select < MAIN MENU to go back to the main menu, or Reset to set the angle back to the default 90 degrees.


Speed menu

This lets you change three different options, and the current values are shown above the menu buttons. The options are

Quick stop controls whether the swing comes to a stop naturally, or whether it stops suddenly and immediately.

Verbose controls whether the script uses short messages in chat to tell the user what's happening.

Control cycles through four different methods of operation:

  • Always swinging - the swing doesn't stop at all.
  • Touch to start/stop - the user clicks the swing to stop it and start it.
  • Sit to start, stand to stop - the swing moves when the user sits on it, and stops when they stand up.
  • Sit, then touch to start/stop - the user can click the swing to stop it and start it, but only when they're sitting on it.

When you select any of these options, the text above the buttons changes to reflect what you have done.

Select < MAIN MENU to go back to the main menu, or Reset to set the options back to their defaults.

SOUND menu

This lets you control the sounds made by the swing.

Speed menu

No sound (the default), makes no sound at all.

The Swing, Pendulum and Swoosh options give you a range of sounds which are played when the swing is in motion.

Each of these options gives two sounds - one for the forward part and one for the back part of the swing.

Volume + and Volume - control the loudness of the sounds.

Select < MAIN MENU to go back to the main menu.

If you'd like to use your own sounds in the swing, see the section Using your own sounds.

Removing the setup script

If you're going to sell or give away your creation, you will need to remove the setup script, partly because it's no-transfer. Even if you're keeping it for your own use, it's a good idea to take the setup script out when you're finished working on it.

It won't be possible to change any of the settings without putting the setup script back in. However, if you do decide you want to change something, and add the setup script again to the prim, it will pick up the settings you've already adjusted and you'll be able to carry on from where you left off.

To remove the script, you can select Finish from the Main menu, and answer Yes to this prompt:

Remove setup script? Yes No

Alternatively, you could just delete the script Handy's swing setup from the prim contents by hand.

Advanced topics

The information above should be all you need to know to set up a simple swing or pendulum. However, Handy's Swing System is capable of much more than that, and in this section we'll look at some more advanced features, as well as look in more detail into some features we've already covered.

Using your own sounds

If you have a sound or a pair of sounds you'd rather use instead of the built-in ones, it's very easy to do this.

  • If you have a single sound file, just drop that into the prim and it will be used for both front and back swings.
  • If you put two sounds into the prim, one will be used for each of the front and back swings.
  • If there are more than two sounds files, they will be ignored.

When there are two sounds, the control script plays them in alphabetical order. So to swap them round, just rename them.

Prim descriptions and data

Normally, all setup data is stored in the prim description in an encoded format. This means you don't need to use notecards to set up your swing.

In fact, you can use this to copy the setup parameters from one prim to another by copy/pasting the description text, although note that this will only work for a prim with the same creator. If the prim you're copying to has a different creator, you'll need to use the setup script.

Using a notecard to store data

The disadvantage of using the description to store data is that you can't then use the description for your own purposes without preventing the swing control script from working. This is especially a problem if you need to have the control script in the root prim, so that the description is visible to everyone.

You can, however, copy/paste the data from the description into a notecard called Handy's swing data(case is important) in the prim's contents. The control script will then read the notecard instead of the description to get its data. Only do this after the setup script has been removed. If you need to use the setup script again, first do the reverse: copy/paste from the notecard back into the description and remove the notecard.

Integration with other scripts

Handy's Swing System makes it easier to incorporate your swing into other scripted systems.

This section describes how, and will only make sense to someone who understand LSL (Linden Scripting Language). You can skip this section if you're not a scripter; you won't need any of the information in it anyway.

Chat messages

As a very simple method of communication, Handy's swing system will say the words "stop" and "start" on channel -450002 using llRegionSay(). You can use this to detect when the swing is moving.


Handy's swing system also supports plugin scripts, which may communicate using the following link message integer values:

716001PLUGIN_SWING_SEND_STARTSend to ctrl script to start swing
716002PLUGIN_SWING_SEND_STOPSend to ctrl script to stop swing
716003PLUGIN_SWING_RECV_STARTSent by ctrl script when swing starts
716004PLUGIN_SWING_RECV_STOPSent by ctrl script when swing stops
716005PLUGIN_SWING_RECV_SWINGFSent by ctrl script when swing moves forward
716006PLUGIN_SWING_RECV_SWINGBSent by ctrl script when swing moves back
716010PLUGIN_SWING_RECV_SITSent by ctrl script when avatar sits (UUID given)
716011PLUGIN_SWING_RECV_STANDSent by ctrl script when avatar stands
716015PLUGIN_SWING_SEND_LOCKSend to ctrl script to prevent starting/stopping
716016PLUGIN_SWING_SEND_UNLOCKSend to ctrl script to allow starting/stopping
716020PLUGIN_SWING_SEND_SOUND_1Send to ctrl script to play sound 1
716021PLUGIN_SWING_SEND_SOUND_2Send to ctrl script to play sound 2
716030PLUGIN_SWING_RECV_BOOTINGSent by ctrl script when bootup starts
716031PLUGIN_SWING_RECV_BOOTEDSent by ctrl script when bootup ends

This section is a work in progress. If you'd like to see more details here, contact Handy Low.

Upgrading control script

To upgrade the control script in an object with a later version, simply drop the new script into the object's contents and the previous version(s) will be automatically deleted.


If you have any questions or problems, see the Contact page for details of how to get help.

Thank you for buying Handy's Swing System.