Wednesday, February 12, 2014

Script: Simple Watering Controller

:: BLACK TULIP SIMPLE WATERING CONTROLLER ::
:: Add Particles and Sound to your Greenhouse with one script ::


Simple Watering Controller at Marketplace
By Auryn Beorn (2011)

TABLE OF CONTENTS



PURPOSE AND FEATURES


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

  • Define one or many "watering points" in your linked object
  • Determine how long the water will flow to take care of your 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 water points as you wish at low lag cost.

INSTALL AND USE YOUR WATER CONTROLLER


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

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

water

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

THE CONFIGURATION NOTECARD


To configure this controller you simply have to fill the "[Black Tulip] Simple Watering 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 represets 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 Watering Controller for Greenhouse" 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 "rain-on-greenhouse". The sample notecard uses it.

A NOTE ABOUT DESIGNING YOUR "WATERING 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 "watering points". Keep this in mind when you design your own primitives/sculpties to be used as "watering 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.08
Y = 0.08
Z = 0.08

Change its rotation to:

X = 0.00
Y = 0.00
Z = 270.00

Change its hollow to 95.0
Change its taper to:

X = 0.50
Y = 0.50

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