Wednesday, February 12, 2014

Script: Vanishing Linked Ghosts with Sound

:: BLACK TULIP Vanishing Linked Ghosts with Sound ::


Vanishing Linked Ghosts with Sound at Marketplace
By Auryn Beorn (2012)

TABLE OF CONTENTS




INSTALL AND USE YOUR VANISHING LINKED GHOST WITH SOUND SCRIPT
THE CONFIGURATION NOTECARD


Make a copy of the included "[Black Tulip] Vanishing Linked Ghosts with Sound ~config~" notecard for always having a fresh one you can refer to. Open this copy to edit, and change as you would like to have the following parameters:

ghostsShowTogether = 0
timeBetweenAppears = 15.0
sleepPause = 0.05
steps = 10
soundVolume = 1.0

What each value means for the script?

The ghosts may show up all together at the same time, or they may show one each time, randomly. You would set up this by giving one of the following values to ghostsShowTogether:

ghostsShowTogether = 0      # This means, each time will show up a ghost, randomly
ghostsShowTogether = 1      # This means, each time, all the ghosts will show up at the same time

timeBetweenAppears is the pause (in seconds) that will happen once the ghost has vanished, to then begin appearing again. If less than a second or more than an hour (3600.0 seconds) is set here, ten seconds will be the default value.

sleepPause is the time (in seconds) to wait between steps once the ghost is appearing/disappearing. If less than 0.01 seconds or more than 60.0 seconds is set here, 0.05 seconds will be the default value.

steps is a whole number indicating how many steps we want for the ghost appearing/disappearing. An example, 10 steps mean that the script will take the initial and end glow values (detailed next) and will perform a transition of such 10 steps to go from the initial glow value to the end glow value (if appearing) or from the end glow value to the initial glow value (if disappearing).
If less than 2 steps or more than 500 is set, the default value will be 10 steps.

soundVolume is a number that has to range from 0.0 to 1.0 (otherwise, 1.0 will be taken) and indicates the volume the sound will be played as your ghost begins appearing.

INSTALL AND USE YOUR VANISHING LINKED GHOST WITH SOUND SCRIPT
THE GHOST PRIMS - REQUIREMENTS


Now you should have your ghosts, LINKED (this is very important). If you haven't built them yet, then build your ghost prims and link them. It doesn't matter which prim is the root, but there will be a very important note at the end if you want to keep only some prims to be phantom!

If you don't know how to build a ghost, refer to the next section, "Building the prim that you can use as ghost". This script will work over the whole linkset and needs to be placed in the root.

Edit your object, having all the linked ghosts.

Click "Edit Linked Parts" (or "Edit Linked", depending upon your viewer).
Click the prim you want being a ghost.
Click the "General" tab.

Write in the DESCRIPTION field of that prim the following:

ghost;ghostColor;minGlow;maxGlow

where:

ghost - This is the word "ghost" as is. Lowercase!

ghostColor - This is a specific code to indicate which color we want to tint our ghost with.
White is <1.0, 1.0, 1.0> - Refer to the included Color HUD tool and its documentation for more information about how to write colors for scripts (or refer to this online text: http://wiki.secondlife.com/wiki/User:Auryn_Beorn/How_to_get_a_valid_LSL_color ) If no value is input, or a wrong one, black (<0.0, 0.0, 0.0>) will be taken as default, so make sure you input this correctly.

minGlow - This is a number that has to range from 0.0 to 1.0 (otherwise, 0.0 will be taken) and indicates the initial amount of glow the ghost will have when it begins appearing.

maxGlow - This is a number that has to range from 0.0 to 1.0 (otherwise, 0.15 will be taken) and indicates the final amount off glow the ghost will have when it ends appearing. Be careful that if you go too high in this one (like, 0.25 or more) the glow might be so intense that your ghost won't be seen in all the light!

so an example, the following would be a VALID DESCRIPTION for ONE of your ghost prims:

ghost;<1.0,0.0,0.0>;0.0;0.25

and would tell the script:

  • The prim is a ghost (so, affected by the vanishing effect from the script)
  • The color for this ghost is <1.0,0.0,0.0> (so, RED)
  • The minimum glow will be 0.0
  • The maximum glow will be 0.25

You can refer to the sample object "[Black Tulip] Linked Ghosts - SAMPLE OBJECT" to check this setup.

Now again, edit your ghost object.
Click its "Content" tab.
Drop:

  • the "[Black Tulip] Vanishing Linked Ghosts with Sound ~config~" notecard
  • a sound clip of your choice
  • the "[Black Tulip] Vanishing Linked Ghosts with Sound" script

Right click on the "[Black Tulip] Vanishing Linked Ghosts with Sound" script and make sure that you change permissions for NEXT OWNER. The script should have either:

Copy/No Modify/No Transfer

or

No Copy/No Modify/Transfer

set as the permissions for next owner. Any other choice will invalidate your license of use! Remember to check always http://blacktulip-store.blogspot.com/p/licenses.html to have the most up to date license of use for my scripts (as well as other supplies.)

Make sure also that you have set correctly permissions for next owner for your sound clip. There it is a sound clip provided that you could use in your builds:

[Black Tulip] Eery Scream (9.9 seconds)

You have to set permissions for this asset in the same manner you set permissions for your script.

Close the "Edit" window.
That's it, linked ghosts ready to go!

SOUND LICENSE NOTE


The included sound clip is a derivate work from http://www.freesound.org/people/ERH/sounds/32899/ and used according the attribution Creative Commons license: http://creativecommons.org/licenses/by/2.5/

(Volume raised, stereo tracks blended into mono, cropped length and fade out.)

AFTER having set permissions for next owner adequately (same as the script, according to the license), you are welcome to USE the sound in your finished builds.

If you don't know how to build a flexi ghost prim, then follow the steps outlined in the next section.

BUILDING THE PRIM THAT YOU CAN USE AS GHOST


The following section is intended to help you in creating the prim that you may use as your ghost. When texturing is required, it will refer to the supplied texture, but feel free of course of using your own ghost texture!

Rez a BOX.
Edit your box.
In "General" tab, name your prim "My Ghost".

Click the "Object" tab.
Change the following parameters:

SIZE
X = 1.00
Y = 0.05
Z = 2.00


ROTATION
X = 180.00
Y = 0.00
Z = 90.00

Click the "Texture" tab.

First, make the box totally transparent, by changing the texture with the default transparent texture, either from the "Library: Textures" folder, or from this folder.

Now, enter into view transparent mode by clicking:

CTRL ALT T

Click "Select Texture" ("Select Face" in V2.)

Click one of the wide faces where the ghost will show.
Change its texture to "[Black Tulip] My Ghost Avatar" included in this folder.

Click the other face where the ghost will show.
Change its texture to "[Black Tulip] My Ghost Avatar" included in this folder.

(there it is a way to texture both sides at the same time: click one of the faces, hold SHIFT pressed, then click the other face - practice this method if you've never used it before.)

Also, change this:

REPEATS PER FACE
Vertical (V): 1.00              [X] Flip

Then you can click just ONE of the faces and check this in the texture settings:

Horizontal (H): 1.00        [X] Flip

SHIFT COPY your prim to have more copies.
Change the texture.

Link them once you feel satisfied with your ghosts object.

Optionally, you can do the following:

Click the "Features" tab.
Change the following parameters:

[X] Flexible Path

Softness: 2.00
Gravity: -0.10
Drag: 2.00
Wind: 0.50
Tension: 1.00

You may need to rotate the whole object. But that's now completely up to you - You decide how your ghosts will be built, these are just suggestions to help you build them :-)

IMPORTANT NOTES REGARDING LINKING YOUR PHANTOM GHOSTS WITH NON PHANTOM PRIMS


Before the following server release: http://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/12#12.07.31.262785, a way to have phantom and non phantom prims linked was to drop in the unlinked prims that we wanted to be phantom a "volume detect" script, and then link them to a non phantom root.

Nowadays, this can be done in a very different fashion.

If our ghosts are BOXES and all the prims in the linkset are BOXES, the use of this script is going to benefit you not only in what concerns to lag because of scripts... It also is going to allow you to REDUCE the land impact of your object in a maximum of a 50%!

In fact, if you check the supplied sample object "[Black Tulip] Linked Ghosts - SAMPLE OBJECT", you will see that it consists of eight prims... but the LI is ONLY 4!

How can you make this?

Rez your object.
Right click on it and edit it.
Click "Edit Linked Parts".

Click one of the ghost prims.
Hold SHIFT pressed.
Click another ghost prims.

Follow this SHIFT - Click another prim process until you have all the ghost prims selected.

Click the "Features" tab.
Under "Physics Shape Type" select NONE.

That's it. If you were working with boxes, the LI has been now drastically reduced, and your ghosts are phantom!

IMPORTANT: The ROOT prim (yellow outline when selected) CAN NOT have NONE as "Physics Shape Type".

Be very careful if there are other shapes (building block types) involved! Having your boxes linked to mesh, or even torus, might nowadays make the LI count to skyrocket! Try this in a sandbox.

Regardless of the method you choose, don't forget making the ghosts phantom! Ghosts are supposed to be walked through :-)

That's it. Have (scary) fun with your linked ghosts!