Get 1Click Maker

Light Switch โ€‹

A lamp that lights the room and glows when on, dark when off, from one button on the lamp itself. No HUD needed: the lamp is its own project.

You need: a lamp with a prim named switch and a prim named bulb, plus *BUILD, *FUNCTIONS and [add-on] - Conditions & Variables - 1Click inside.

1. Variable โ€‹

Tools โ†’ { } โ†’ Create New Variable: String, light, initial OFF.

2. The switch function โ€‹

  1. Re-scan, click switch to create its function.

  2. Add Condition: $light == OFF. Save.

  3. Success branch (turn on):

    • Change Variable: $light Set ON
    • Point of Light: $THIS, link bulb, ON, color <1.0, 0.9, 0.7>, intensity 1, radius 8, falloff 0.75
    • Glow: $THIS, link bulb, faces All, 0.3
    • Full Bright: $THIS, link bulb, faces All, ON
    • Sound Play click
  4. Failure branch (turn off):

    • Change Variable: $light Set OFF
    • Point of Light: $THIS, link bulb, OFF
    • Glow: bulb, 0
    • Full Bright: bulb, OFF
    • Sound Play click

3. Start dark โ€‹

Rez event: Point of Light OFF, Glow 0, Full Bright OFF, $light = OFF. That way a freshly rezzed lamp is always off.

4. Build, test, finish โ€‹

Click the switch: warm light, glowing bulb. Click again: dark. Finish! when done.

Variations โ€‹

  • Dimmer: an integer $level (0โ€“3) and a chain of conditions, each setting a different intensity.
  • Remote control: move the condition into a Receive Command toggle event and send it from a HUD (commands guide).
  • Color: add a Color Picker to a HUD that controls the lamp's bulb faces.