ext_switch_control.lsl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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:39:48
  7. // :EDITED:2016-03-30 20:29:28
  8. // :ID:1079
  9. // :NUM:1770
  10. // :REV:1.0
  11. // :WORLD:Opensim
  12. // :DESCRIPTION:
  13. // Drop in any prim and touch for on/off
  14. // :CODE:
  15. // :LICENSE: CC0 (Public Domain)
  16. // Rene's Free Lighting System - Extended Switch Control
  17. //
  18. // Author: Rene10957 Resident
  19. // Date: 21-03-2014
  20. //
  21. // Drop in any prim and touch for on/off
  22. // License: CC0 (Public Domain).
  23. // To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.
  24. // For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
  25. //////////////////////////////////////////
  26. // Please read user manual before using //
  27. //////////////////////////////////////////
  28. string title = "Extended Switch Control"; // title
  29. string version = "1.0"; // version
  30. integer silent = TRUE; // silent startup
  31. // Constants
  32. integer switchChannel = -10957; // switch channel
  33. // Variables
  34. integer on = FALSE; // on-off switch
  35. // Functions
  36. switchLight()
  37. {
  38. vector color;
  39. vector primColor;
  40. vector particleColor;
  41. float intensity;
  42. float radius;
  43. float falloff;
  44. float alpha;
  45. float glow;
  46. integer fullbright;
  47. integer particleSize;
  48. string particleTexture;
  49. string desc = llGetObjectDesc();
  50. if (llGetSubString(desc, 0, 3) == "#LS#") {
  51. list configList = llParseStringKeepNulls(desc, [";"], []);
  52. if (on) {
  53. color.x = (float)llList2String(configList, 1);
  54. color.y = (float)llList2String(configList, 2);
  55. color.z = (float)llList2String(configList, 3);
  56. intensity = (float)llList2String(configList, 4);
  57. radius = (float)llList2String(configList, 5);
  58. falloff = (float)llList2String(configList, 6);
  59. alpha = (float)llList2String(configList, 7);
  60. glow = (float)llList2String(configList, 8);
  61. fullbright = (integer)llList2String(configList, 9);
  62. primColor.x = (float)llList2String(configList, 10);
  63. primColor.y = (float)llList2String(configList, 11);
  64. primColor.z = (float)llList2String(configList, 12);
  65. particleColor.x = (float)llList2String(configList, 13);
  66. particleColor.y = (float)llList2String(configList, 14);
  67. particleColor.z = (float)llList2String(configList, 15);
  68. particleSize = (integer)llList2String(configList, 16);
  69. particleTexture = llList2String(configList, 17);
  70. }
  71. else {
  72. color.x = (float)llList2String(configList, 18);
  73. color.y = (float)llList2String(configList, 19);
  74. color.z = (float)llList2String(configList, 20);
  75. alpha = (float)llList2String(configList, 21);
  76. glow = 0.0;
  77. fullbright = FALSE;
  78. primColor = color;
  79. }
  80. list sendList = ["Default", on, color, intensity, radius, falloff, alpha, glow, fullbright,
  81. primColor, particleColor, particleSize, 999, particleTexture, on];
  82. string sendMsg = llList2CSV(sendList);
  83. llMessageLinked(LINK_ALL_OTHERS, switchChannel, sendMsg, "");
  84. }
  85. }
  86. default
  87. {
  88. state_entry()
  89. {
  90. switchLight();
  91. if (!silent) llWhisper(0, title + " " + version + " ready");
  92. }
  93. on_rez(integer start_param)
  94. {
  95. llResetScript();
  96. }
  97. touch_start(integer total_number)
  98. {
  99. on = !on;
  100. switchLight();
  101. }
  102. }