nightlight.lsl 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // :SHOW:1
  2. // :CATEGORY:Light
  3. // :NAME:Rene Free Lighting System
  4. // :AUTHOR:Rene10957 Resident
  5. // :KEYWORDS: light,lamp,lighting light
  6. // :CREATED:2015-06-11 14:41:56
  7. // :EDITED:2016-03-30 20:29:28
  8. // :ID:1079
  9. // :NUM:1789
  10. // :REV:1
  11. // :WORLD:Second Life
  12. // :DESCRIPTION:
  13. // Nightlight switch: drop this script into the same prim where the SWITCH is located
  14. // :CODE:
  15. // :LICENSE: CC0 (Public Domain)
  16. // Night light plugin for Rene's Free Lighting System
  17. // A simple example script for creating your own plugin
  18. //
  19. // Automatically switches on at sunset and off at sunrise
  20. /////////////////////////////////////////////////////////////////////////////////
  21. // HOW TO USE: drop this script into the same prim where the SWITCH is located //
  22. /////////////////////////////////////////////////////////////////////////////////
  23. key owner; // object owner
  24. integer number = 10957; // number part of link message
  25. default
  26. {
  27. state_entry()
  28. {
  29. owner = llGetOwner();
  30. llSetTimerEvent(300);
  31. }
  32. on_rez(integer start_param)
  33. {
  34. llResetScript();
  35. }
  36. timer()
  37. {
  38. vector sun = llGetSunDirection();
  39. if (sun.z < 0) llMessageLinked(LINK_THIS, number, "on", owner);
  40. else llMessageLinked(LINK_THIS, number, "off", owner);
  41. }
  42. }