LICENSE
This is a free and open source script, under a CC0 license:
https://creativecommons.org/public-domain/cc0/
That means that if you paid for this script, you were scammed; if you're reselling it, may the fleas of a thousand camels infest your armpits.
Source is also on https://github.com/Miro-Collas/LSL_Scripts/tree/main/Multi-Light%20Day%20Switch
HOW TO USE
This script serves to control multiple lights, linked together, from a single script. Lights will turn on at nightfall, and off at the start of the day. They will also toggle their state on touch, staying that way until the next day/night change.
If you left click and hold for more than 2 seconds, you'll get a dialog which allows you to select permissions for touch access: owner only, group or anyone. (Selecting Group will always allow the owner to access.)
Naturally, any lights you want to add this to, need to be moddable. If you like, you can use one script for each light, without linking them. However, fewer scripts means reduced region lag. It may not make much difference, but every bit helps.
You should remove all scripts in the lights before starting, so that they don't conflict with this one. Therefore, I *strongly* suggest working on a copy of the lights to make sure you get all the data right, before adding the notecard and script to your placed lights.
Light info should be specified in the lights.config notecard. Edit this as needed (see below), place it into the light linkset, then drop in the script. The script will parse the notecard and is then ready to go. Lights will turn on/off automagically based on time of day, and also on touch.
Format for lights.config notecard:
- lines starting with # are treated as comments and ignored when parsing
- each non-comment line MUST start with with a keyword, followed by a = and then parameters. These are:
- autodaynightswitch: if this is set to FALSE, lights will not toggle on/off when day changes to night (and vice versa). If this isn't present in the config notecard, it defaults to TRUE
- toggletimer: how often to check whether day has changed to night, or vice versa, in seconds. Shouldn't be too low, so as not to be checking too often. If this keyword isn't present in the notecard, it defaults to 60secs
- delay: pause between turning lights on/off, in seconds, to add some "realism". Defaults to 0 (no delay).
- light=integer link_num, vector linear_color, float intensity, float radius, float falloff
- glow=integer link_num, integer face, float intensity
- fullbright=integer link, integer face
- projector=integer link_num, string texture, float fov, float focus, float ambiance
- Ref. https://wiki.secondlife.com/wiki/LlSetPrimitiveParams
See the supplied notecard for examples.
More info in the included read me notecard
----------
CHANGE LOG
v1.0 - 2025-08-16
- Initial non-public release
v2.0 - 2025-08-17
- remove code to turn off projectors, it made no sense.
- add configs for delay between lights on/off, and day/night check timer.
- added utility scripts
- internal changes for legibility, and to handle the output of Utility: Dump Light Info
v2.1 - 2025-08-21
- If multiple notecards are present in the object, the code wasn't handling it properly; fixed.
- Minor code clean-up.
- First public release.
v3.0 - 2025-08-22
- stop resetting on owner change; no need for it
- added command (autodaynightswitch) to allow day/night switching to be turned off
- on long touch (more than 2secs), bring up dialog where touch permissions can be set