Wednesday, February 12, 2014

Script: Simple Sprinklers Controller

:: BLACK TULIP SIMPLE SPRINKLERS CONTROLLER ::
:: Add Sprinkler Particles and Sound to your Garden with one script ::


Simple Sprinklers Controller at Marketplace
By Auryn Beorn (2012)

TABLE OF CONTENTS



PURPOSE AND FEATURES


The purpose of the "[Black Tulip] Simple Sprinklers Controller" script is to allow you to:

  • Define one or many "sprinkler points" in your linked object
  • Determine how long the water will flow to take care of your grass and plants
  • Determine how long to wait between watering cycles
  • Optionally, play a sound while the water falls

Everything is controlled by a single script, so you can have as many sprinkler points as you wish in the same linked object at low lag cost.

INSTALL AND USE YOUR SPRINKLERS CONTROLLER


In order to have this system working in your object, you have to:

  • Decide which are the "sprinkler points" in your linked object
  • Give those primitives the following description (it's case sensitive!):

sprinkler

  • Drop the notecard "[Black Tulip] Simple Sprinklers Controller Params" in the "Content" tab of your object.
  • Drop the script "[Black Tulip] Simple Sprinklers Controller" in the "Content" tab of your object.

THE CONFIGURATION NOTECARD


To configure this controller you simply have to fill the "[Black Tulip] Simple Sprinklers Controller Params" notecard keeping in mind that:

  • A line beginning with # is considered a comment line, thus, won't have any effect over the script.
  • The parameter timeWatering expects a float number (decimal) which represents the time you want the plants to be watered.
  • The parameter timeNotWatering expects a float number which represents the time you want to wait between watering cycles.
  • The parameter soundToPlay expects a sound clip name as it appears in the primitive where the "[Black Tulip] Simple Sprinklers Controller (linked object)" resides.

An example notecard is supplied to help with this purpose. Simply change the values and use it.

There's also supplied a sound as an example, the sound clip "Sprinkler". The sample notecard uses it.

Use the following UUID if you wish to have silence:

25bf95dd-140a-559b-ae01-d6fac301bc38

(It's the UUID of the supplied "[Black Tulip] Silence" sound sample.)

A NOTE ABOUT DESIGNING YOUR "SPRINKLER POINTS"


The water from this system is achieved by using particles. Particles will emit ALWAYS from the center of the primitive or, in this case, from the center of the "sprinkler points". Keep this in mind when you design your own primitives/sculpties to be used as "sprinkler points".

The following primitive serves as an example of a watering point that will show correctly:

Rez a CYLINDER.

Change its size to:

X = 0.15
Y = 0.15
Z = 0.50

You may want to change the "Slice Begin and End" property to:

B = 0.000
E = 0.500

At times, you might need to change "Slice Begin and End", "Profile Cut" or other properties. This depends of your specific primitive.