Monday, November 10, 2014

Script: Coffee House Sign Switch

[Black Tulip] Coffee House Sign Switch (Script for Designers)

(c) 2014 Auryn Beorn

Coffee House Sign switch 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



FEATURES


  • Show the Open/Closed text by selecting on the menu.
  • Turn glow on/of when the open/closed text is visible.
  • Change the light color, radius, intensity and fall off of the SL-light point.
  • Menu timeout to reduce lag - no open listeners after timeout (0.001 ms script time when idle)
  • Final user can change access to owner only/everybody/group


SETUP: CHANGE PERMISSIONS FOR NEXT OWNER


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

[Black Tulip] Coffee House Signs - Switch


SETUP: EXAMINING THE SAMPLE OBJECT


With this script, you may control the following:

  • One light point
  • One prim that should have at least two different faces, one to show the Open text, the other one to show the Closed text

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

Right click the sample object to edit it, then click the "Content" tab. When we do this, we're inspecting the contents of the ROOT PRIM. You should see:

  • The [Black Tulip] Coffee House Signs - Switch script

What does this mean?
That the script has 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 two linked prims: a mesh neon sign having both the Open and Closed texts, in separate faces (only one will show, but with the menu you can see the other one) and a white, regular box, which is the root prim. Right click to edit, click "Edit linked", and now:

  • Inspect the root prim. It only contains the script.
  • Inspect the mesh sign prim.
  • Inspect now the description of this prim. It says:

sign;2;0.1;0;3;0.1;0#light

There are two parts in this description, separated by the # character. This means, this prim will feature both effects (open/closed sign and SL light point).

Now that we've inspected the object, let's study the details of the description format.


SETUP: FORMAT OF THE DESCRIPTIONS


To tell the script which of the linked primitives are relevant (open/closed text effects, SL-light point), we have to write specific words (CASE SENSITIVE) in the DESCRIPTION of each primitive (DESCRIPTION - not the name, don't confuse them!)

The format of the descriptions is as follows:

parameter

or

parameter1#parameter2

It doesn't matter the order the parameters are written, as long as a # character separates them.

As we've seen, when inspecting the sample object, the following parameter-keyword would indicate that the prim is a SL-light point:

light

There is another possibility, which tells that the primitive contains the open/closed text (explained below): sign.

If we want to specify that a primitive is, at the same time, the open/closed text and a SL light point, then we write the:

sign;2;0.1;0;3;0.1;0#light

combination. The # character will separate parameters, and it does not matter the order we choose to write the parameters.

This:

light#sign;2;0.1;0;3;0.1;0

would have the same effect.


The possible descriptions this script recognizes are:

Expected description for a light point: light
Expected description for the prim containing the open/closed text: sign (there's more to this one, explained next)

When we type sign in the description, we have to add more information: what face contains the open text, what face contains the closed text, and which values of glow each of them have, when glow is turned on/off.

How do we do this?

First, we type sign, to indicate "this is the prim with the open/closed text". Then we type a semicolon. Then we type a number: the face number of the face with the open text (Click here if you don't know how to get the face number of a prim.) Then we type another semicolon. Then we type how much glow when glow is "on" for the open text (range is from 0 -no glow- to 1 -full glow-). Then, a semicolon. Then, how much glow when glow is "off" for the open text. Then, semicolon. Then, the face number of the face with the closed text. Semicolon. How much glow when glow is "on" for the closed text. Semicolon. Finally, how much glow when glow is "off" for the closed text.

The general format, perhaps easier to understand, is:

sign;openText_faceNumber;openText_glowONvalue;openText_glowOFFvalue;closedText_faceNumber;closedText_glowONvalue;closedText_glowOFFvalue

IMPORTANT: The order is relevant in this format! Do not type sign to the end, for example. Values are expected in that order.

So the following, in the sample object description:

sign;2;0.1;0;3;0.1;0

means:

  • sign indicates the prim has the open/closed text
  • The number 2 means that the open text is in face 2 of said prim
  • The number 0.1 next to it means that glow on the open text will be 0.1 when chosen to be ON
  • The number 0 next to it means that glow on the open text will be 0 when chosen to be OFF
  • The number 3 next to it means that the closed text is in face 3 of said prim
  • The number 0.1 next to it means that glow on the closed text will be 0.1 when chosen to be ON
  • The number 0 next to it means that glow on the closed text will be 0 when chosen to be OFF

Set the DESCRIPTIONS according to these simple rules, reset the script if needed, and your object is ready to go!


TROUBLESHOOTING


Q: I click the light options on the menu, but no visible outcome shows. What's going wrong?

A: Most likely, there's not a light source defined in the object. Double-check the DESCRIPTION of the prim you expect to be a SL light point. Make also sure that the light radius and intensity are not zero, by changing their values on the menu.


For any other problem not described here, please give a complete description of your issue in the following online form.

I'll get back to you after I have read your report and replicated your issue inworld, according to your description of it. Please, be detailed.

-- Auryn Beorn