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:
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:
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:
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:
The first thing the script needs to know is which direction the swing will move in. Just click, or 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 ...
In that example, I clicked theoption, 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 thebutton to get to the main menu ...
or stop or start the swing.
sets everything back the way it started, so any changes you made are undone.
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.
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.
This lets you control how quickly the swing moves.
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.
This lets you control how quickly the swing moves.
Again,, , , , and buttons adjust the value, this time for how far the swing travels.
The current approximate angle is shown above the menu.
This lets you change three different options, and the current values are shown above the menu buttons. The options are
controls whether the swing comes to a stop naturally, or whether it stops suddenly and immediately.
controls whether the script uses short messages in chat to tell the user what's happening.
cycles through four different methods of operation:
When you select any of these options, the text above the buttons changes to reflect what you have done.
This lets you control the sounds made by the swing.
(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.
and control the loudness of the sounds.
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 Main menu, and answer Yes to this prompt:from the
Alternatively, you could just delete the script Handy's swing setup from the prim contents by hand.
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.
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.
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:
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.