Grandfather Clock

[Black Tulip] Grandfather Clock (Script for Designers)

(c) 2015, Auryn Beorn and Sei Lisa

Grandfather Clock script in Marketplace.

Thank you for having considered this script to enhance the quality of your products. Please read the following instructions carefully, especially the ones explaining which permissions to apply to the scripts for the next owner. Failure to complete this task INVALIDATES the license governing your use of this set of scripts. Should you have problems, please fill the scripts assistance form, explaining what you did and what happened, and I'll get back to you.

IMPORTANT!
The script contains a check to prevent accidental give-aways. If you haven't set permissions correctly in your inventory, then the script will self delete when you try to use it. The best way to ensure you set permissions correctly is by doing it NOW in your inventory.

TABLE OF CONTENTS



IMPORTANT ABOUT THIS SCRIPT


This is probably one of the most featured clock scripts that you can find in SL. And with great power comes great responsibility. This script allows to setup many things in your clock: hands, little gears, pendulum, which timezones to browse, which sounds to play. It also gives you the possibility of having two extra buttons to call other scripts.

For a basic clock, you only need to have the hands working, and timezones: start reading how to setup those. We provide of an auxiliary tool to help you setup the hands, and timezones have to be setup on a notecard.

If your clock will use a pendulum, then read the section explaining how to set that up. We've provided an auxiliary tool designed to make it easy for you, setting up the pendulum. The final data will have to be added to the configuration notecard.

If you would like to add little rotating gears, then read that section. Rotating gears need that you write descriptions in a certain way: how, it's explained in the corresponding section.

Finally, the clock allows for several sounds: tick-tock sounds, chimes, and carillon. Those sounds are specified in the configuration notecard. They are OPTIONAL.

The extra buttons, if any, are also setup in the notecard.

There's a sample object included, containing ALL the features, already set, and another sample, ready to setup, to help you learn how to set up your own clock. If you have doubts about how to setup your own items, please DO CHECK the sample object in the first place, to compare with your own object.


FEATURES


You can setup and control all this with one script:

  • The clock Hours, minutes and seconds hands. Seconds hand is optional, and it can be placed in a separate place than hours and minutes. There's a tool to help setting up the hands, so they rotate as you want them.
  • You can define all the timezones you need, and there's an option to turn on/off daylight saving.
  • Pendulum tick-tock motion (and rest position). There's a tool to help setting it up, and its motion can be turned on/off.
  • Spinning gears. If you feel like adding spinning gears to the clock, you can. You can turn them on/off.
  • Tick-tock sound. It can be turned on/off.
  • Chimes sound.
  • Two extra buttons that you can setup to call other scripts.
  • Final user can change access to owner only/everybody/group
  • Menu can be integrated into tools such as MLPv2, AVsitter... (AVsitter version 2 works too!)


SET UP: WHAT SCRIPT TO USE?


There are two copy/no modify/transfer scripts contained in your folder:

[Black Tulip] Analog Clock - Grandfather Clock
[Black Tulip] Analog Clock - Grandfather Clock [MODULE]

We need to use ONLY ONE of them in a given product.

Which one? How to choose?

The [MODULE] version, as explained in the THE MAIN SCRIPT, AS A MODULE YOU CAN USE FROM ANOTHER SCRIPT section, will allow you to use this script integrated with other scripts that allow sending linked messages, such as the Multi Love Pose (MLP) or AVSitter for multiavatar, multianimation devices.

So, depending on what we need, we'll use the following script as main one:

Normal use - We want the menu to show when the object is clicked:
[Black Tulip] Analog Clock - Grandfather Clock

The menu should show up after clicking a button from another script, like MLP, AVSitter:
[Black Tulip] Analog Clock - Grandfather Clock [MODULE]

Once we've chosen the right main script, we have to set some descriptions in the primitives of the object, following the instructions below.


SETUP: CHANGE PERMISSIONS FOR NEXT OWNER


Check the following section on this page, knowing that each [Black Tulip] ASSET refers to the following scripts:

[Black Tulip] Analog Clock - Grandfather Clock
[Black Tulip] Analog Clock - Grandfather Clock [MODULE]


SETUP: EXAMINING THE SAMPLE OBJECT


With this script, you may control the following:

  • The clock Hours, minutes and seconds hands. Seconds hand is optional, and it can be placed in a separate place than hours and minutes. There's a tool to help setting up the hands, so they rotate as you want them.
  • You can define all the timezones you need, and there's an option to turn on/off daylight saving.
  • Pendulum tick-tock motion (and rest position). There's a tool to help setting it up, and its motion can be turned on/off.
  • Spinning gears. If you feel like adding spinning gears to the clock, you can. You can turn them on/off.
  • Tick-tock sound. It can be turned on/off.
  • Chimes sound.
  • Two extra buttons that you can setup to call other scripts.
  • Final user can change access to owner only/everybody/group
  • Menu can be integrated into tools such as MLPv2, AVsitter... (AVsitter version 2 works too!)

We'll understand better what this means by examining the [Black Tulip] Grandfather Clock - FINISHED SAMPLE object. Rez it, and let's follow this explanation.

Before anything, right click the object to edit, then click the Content tab. When we do this, we're inspecting the contents of the ROOT PRIM. You should see the [Black Tulip] Analog Clock - Grandfather Clock script, the [Black Tulip] Analog Clock ~CFG~ configuration notecard, several sound clips and a script to demonstrate the extra buttons feature.

What does this mean?
That the script, configuration notecard and sound clips, if any, have to be dropped into the ROOT PRIM. This is the default when we simply right click an object, then select Edit from the menu.

Having this clear, now let's examine the sample object in detail. It consists of several linked prims: The clock base, the pendulum, the little gears, the clock hands and the doors. Some prims will need that we type specific descriptions in them. Others, will need that we type specific names. Some options are configured in the notecard. Other options are configured by a mix of prim name + notecard. There are several tools to help set up each feature.

This is a complex tool, so take the time to setup one feature at a time.

Click on the object to get a menu. Get familiar first with all the options this script offers. Once you see all the script does, then continue reading, to learn how to setup each one of the features.


SETTING UP THE CLOCK HANDS


Follow this link for the documentation on the Hands Clock auxiliary tool.


DEFINING WHICH TIMEZONES TO INCLUDE


Click here for the related documentation.


SETTING UP A PENDULUM


In order to setup a pendulum, we have to proceed following the next steps. Briefly, these steps are:

  1. Change the descriptions of all prims that will be part of the pendulum to pendulum
  2. Use the provided auxiliary tool, the script
  3. Add the output of said script to the configuration notecard

Follow this link for the documentation on the pendulum auxiliary tool.


SETTING UP THE SOUND EFFECTS


Click here for the related documentation.


SETTING UP ROTATING GEARS


As you can check in the sample [Black Tulip] Grandfather Clock - FINISHED SAMPLE object, this script allows you to ALSO rotate, by spinning, all the child prims you wish to rotate (until you hit the script's memory limit - don't worry, this won't happen with five/ten spinning prims). You could also make the root prim to rotate. Perhaps this is not what you would like anyway, but feel free to make a copy of your object and try this if you're curious about :-) (basically, it will make the whole object to spin around the root)

Rez the [Black Tulip] Grandfather Clock - SAMPLE TO SETUP sample object to follow this explanation. Pay special attention to the sections of the diagrams that are highlighted.

Having all the object selected (this is, make sure that Edit Linked is not ticked), set the rotation of the ROOT PRIM to:

X = 0.00
Y = 0.00
Z = 0.00

Make sure that World coordinates mode is also selected.


Don't worry if your object doesn't look like you have designed it. You will be able of rotating it again as you wish ONCE you have gathered the values for the spin vectors.

Now tick Edit linked. Click one of the little gears. Type the following description on it:

gear;<0,1,0>;1;1

The picture shows how it should look like:


What does this mean?

The first that we have to know is that the script will read the semicolons (;) and take all the values between them.
So in the case above:

gear;<0,1,0>;1;1

we see that there are FOUR pieces of information:

gear
<0,1,0>
1
1

It is VERY IMPORTANT the order these values appear! If they don't appear in this exact order, the script won't be able to read the values of the prim we want to spin.

What each of those values mean?

First one:

gear

means that the script has to consider this prim as a spinning one. The word has to be written exactly as said above. It IS case sensitive!

The second one:

<0,1,0>

is the spin vector. Don't worry, it is explained after this how to obtain it correctly.

The third one:

1

is the spin rate value. It is a number with decimals that, to make it easy to understand, we can think of as the velocity, so the smaller the value we type in, the slower the piece will spin and the reverse.

and the last one:

1

might be complicated to understand and, anyway, it doesn't make sense if our prims are not physical. Since this last one can be very technical, we will leave it always as 1. If you have the knowledge to follow the explanations from the wiki, then you can learn more about it in this wiki page: http://wiki.secondlife.com/wiki/LlTargetOmega

This last value corresponds to the gain parameter the wiki mentions there.

And how the spin vector has been obtained?

With the object having the root rotation set to <0.00 ,0.00, 0.00> (as stated above), and being in WORLD COORDINATES mode, we choose the axis we want the object rotating around.

  • If the axis is X, the RED one, we write the spin vector as: <1, 0, 0>
  • If the axis is Y, the GREEN one, we write the spin vector as: <0, 1, 0>
  • If the axis is Z, the BLUE one, we write the spin vector as: <0, 0, 1>

We can see in the picture that the green axis is the one that corresponds to our little gear:


If the gear rotates too fast, we will decrease the 1 value:

gear;<0,1,0>;1;1

to, for example, 0.5:

gear;<0,0.5,0>;1;1

If we want it rotating the other way around, we change the sign of the number:

gear;<0,-0.5,0>;1;1

Similarly, we would setup the other little gear, always paying attention to which of the arrows represents the axis we want the gear rotating around:



ADDING UP TO TWO EXTRA BUTTONS


This is set up in the [Black Tulip] Analog Clock ~CFG~ configuration notecard. Each button we want to add to the menu, means that we have to write a line with the following format in the notecard:

Click here for the related documentation.


SETUP: THE MAIN SCRIPT, AS A MODULE YOU CAN USE FROM ANOTHER SCRIPT

Check the following section on this page, knowing that:

[Black Tulip] ***Script Name*** [MODULE] refers to [Black Tulip] Analog Clock - Grandfather Clock [MODULE]
CODE_NUMBER is -37640982
NAME_ON_MENU is Clock

AVSitter line looks like: BUTTON Clock|-37640982
MLP line looks like: LINKMSG Clock | 1,-4,-37640982,fromMLP

You have example AVpos and .MENUITEMS notecards with your purchase. Remember that this works too with AVSitter 2.