Snapshot_007

Mini Tutorial: How to make a lighting system.

Here is a quick and easy way to create a light system for your home, garden, office, darkroom, dungeon, etc.

 

Let’s start with downloading some scripts:

A prim glow and light script. This script turns on the glow and light function of a prim.
It’s controlled by a controller script.

Light and Glow Script
Light and Glow Script
Light_and_glow_script
1.5 KiB
972 Downloads
Details...

This is a controller script. With this script you can turn a lamp on or off by touching a linked prim (A light switch).

Controller script Touch
Controller script Touch
Controller_touch_script
2.1 KiB
958 Downloads
Details...

Another controller script. This script sees if its night on estate level. (‘Force midnight’ won’t turn on the lights)

Controller script Night
Controller script Night
Controller_night_script
526.0 B
916 Downloads
Details...

Now, lets rezz a couple of prims!

– Rezz a cylinder with the following dimensions:
* X and Y both 0.15 meters, Z = 0.35 meters. Set the texure to blank, color = black.
* Hold down the shift key, and drag the cylinder up a bit. This makes a copy of the cylinder. Set both X and Y to 1.25 meters and Z = 0.2 meters. Set the color to white and transparency to 50%
* Select the first, black cylinder again, and copy it. Set Z to 0.1 meters. Copy this small black prim one more time.
* Position the 4 prims like in the picture below:

Now the script part:

– Select the transparent prim, this will be the prim that glows and lights up.
Open the content tab, and create a new script in it by clicking the ‘New Script’ button.
Open the ‘Glow and Light’ with your favorite text editor, and copy it.
Open the newly created script in the prim, and paste the copied script in to it, overwriting the standard script.

– Select the largest black prim. This will be your root prim.
Create a new script in this prim, and copy the ‘Controller_touch script’ in to it.
Create another script and copy the ‘Controller_Night script’ in this new script.
[Note: you can use one of these controller scripts if you like, so only a the touch controller, or only the night controller]

This was the scripting part, lets link some prims now!

Select the transparent prim.
Hold down the Shift key and touch the 2 smaller black prims.
Finally touch the big black prim. The largest, black prim should light up yellow, the other prims blue.
Hit the ‘Link’ button in the edit window to link the prims.

And your done!

Now this isn’t a really big lighting system he? To make a bigger system, with multiple lamps, you could do the following:

Shift-drag a lamp. (You have two lamps now.)
Select one lamp, and remove the controller script(s) in it.
Copy this lamp (without controller script(s) in it) as many times you like.

Shift-click on all the lamps to select them all (Oddy tip: Select the one with the controller script(s) as last, so it becomes the root prim of your system), and hit the ‘Link’ button in the edit window.

Voila!

You could make a light switch of some sort, and put one (or both) controller script in it. Again, make sure this is the last prim you select when linking things up.

Have fun!

2 thoughts on “Mini Tutorial: How to make a lighting system.”

Leave a Reply