Script LSL de interruptor de luz: toca para encender y apagar una lámpara
Script LSL gratis para lámparas, velas y bombillas de Second Life: toca para encender y apagar luz real, resplandor y full bright, con color y radio ajustables.
Convierte cualquier lámpara, bombilla, vela o letrero de neón en una luz que funciona. Tócala y este script de interruptor de luz enciende luz real de Second Life, un resplandor suave y full bright en la cara que elijas. Vuelve a tocar para apagarlo todo.
// Light Switch - free LSL script from WhatSL (https://whatsl.com/scripts/lsl-light-switch-script)
// Free to use, change and put in your own creations, also ones you sell.
//
// Put this script in a lamp, bulb or candle. Touch to turn the light on and off.
// The prim gives real light, and can glow and be full bright while it is on.
vector LIGHT_COLOR = <1.0, 0.9, 0.7>; // warm white
float LIGHT_INTENSITY = 1.0; // 0.0 to 1.0
float LIGHT_RADIUS = 10.0; // metres, up to 20.0
float LIGHT_FALLOFF = 0.75; // 0.0 to 2.0
float GLOW_AMOUNT = 0.1; // 0.0 = no glow
integer USE_FULLBRIGHT = TRUE;
integer LIGHT_FACE = ALL_SIDES; // the face that glows, or ALL_SIDES
integer START_ON = FALSE;
integer gOn = FALSE;
setLight(integer on)
{
float glow = 0.0;
if (on) glow = GLOW_AMOUNT;
llSetLinkPrimitiveParamsFast(LINK_THIS, [
PRIM_POINT_LIGHT, on, LIGHT_COLOR, LIGHT_INTENSITY, LIGHT_RADIUS, LIGHT_FALLOFF,
PRIM_FULLBRIGHT, LIGHT_FACE, on && USE_FULLBRIGHT,
PRIM_GLOW, LIGHT_FACE, glow
]);
gOn = on;
}
default
{
state_entry()
{
setLight(START_ON);
}
touch_start(integer total)
{
setLight(!gOn);
}
}
Libre para usar, cambiar e incluir en tus creaciones, también en las que vendes.
Cómo configurarlo
- Pon el script en la pantalla o en la bombilla de la lámpara (prim) y guarda.
- Toca la lámpara para encenderla y apagarla.
- Cambia el color, la intensidad y el radio para que encajen con la habitación.
Ajustes
- LIGHT_COLOR: el color de la luz. <1.0, 0.9, 0.7> es blanco cálido, <0.7, 0.8, 1.0> es blanco frío.
- LIGHT_INTENSITY, LIGHT_RADIUS, LIGHT_FALLOFF: qué tan fuerte es la luz, hasta dónde llega y qué tan rápido se desvanece.
- GLOW_AMOUNT: un resplandor suave en la cara iluminada; 0.0 apaga el resplandor.
- USE_FULLBRIGHT: hace que la cara iluminada se vea brillante incluso de noche.
- LIGHT_FACE: la cara que brilla (por ejemplo, solo la bombilla), o ALL_SIDES.
- START_ON: si la luz está encendida cuando el script empieza.
Consejos
- Los visitantes solo ven la luz en sí si tienen activadas las luces locales en la configuración gráfica de su visor. El resplandor y el full bright sí se ven igual.
- Muchas luces juntas pueden ralentizar el visor. Usa unas pocas luces potentes en lugar de muchas pequeñas.
Preguntas frecuentes
¿Por qué no veo la luz en las paredes?
La configuración gráfica de tu visor puede limitar las luces locales. Sube la calidad gráfica o permite las luces locales, y comprueba que LIGHT_RADIUS llegue hasta las paredes.
¿Puede un solo interruptor controlar varias lámparas?
Este script controla solo su propio prim. Para controlar varias lámparas, el interruptor puede enviar un mensaje a las lámparas con llMessageLinked (si están enlazadas) o llRegionSay (si no lo están), y cada lámpara lo escucha.
¿Puede encenderse sola de noche?
Sí. Comprueba la posición del sol con llGetSunDirection en un temporizador y cambia la luz cuando el sol se ponga.