link_control.lsl 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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:18
  7. // :EDITED:2016-03-30 20:29:28
  8. // :ID:1079
  9. // :NUM:1772
  10. // :REV:1.2
  11. // :WORLD:Opensim
  12. // :DESCRIPTION:
  13. // Link control (secondary switch)
  14. // :CODE:
  15. // :LICENSE: CC0 (Public Domain)
  16. // Link control (secondary switch) for Rene's Free Lighting System
  17. //
  18. // Author: Rene10957 Resident
  19. // Date: 24-01-2014
  20. //
  21. // Drop this in any prim (within the same linkset) you want to use as an extra on/off/menu switch
  22. // Note: only useful if you need multiple switches for the same light group in LINKSET mode
  23. // License: CC0 (Public Domain).
  24. // To the extent possible under law, Rene10957 has waived all copyright and related or neighboring rights.
  25. // For more information, see http://creativecommons.org/publicdomain/zero/1.0/.
  26. string title = "Link Control"; // title
  27. string version = "1.2"; // version
  28. integer silent = TRUE; // silent startup
  29. // Constants
  30. integer msgNumber = -975104; // number part of link message
  31. string separator = ";;"; // separator for link messages
  32. // Functions
  33. string getGroup()
  34. {
  35. string str = llStringTrim(llGetObjectDesc(), STRING_TRIM);
  36. if (llToLower(str) == "(no description)" || str == "") str = "Default";
  37. return str;
  38. }
  39. default
  40. {
  41. state_entry()
  42. {
  43. if (!silent) llWhisper(0, title + " " + version + " ready");
  44. }
  45. on_rez(integer start_param)
  46. {
  47. llResetScript();
  48. }
  49. touch_start(integer total_number)
  50. {
  51. llResetTime();
  52. }
  53. touch_end(integer total_number)
  54. {
  55. key user = llDetectedKey(0);
  56. string command;
  57. if (llGetTime() > 1.0) command = "menu";
  58. else command = "switch";
  59. list msgList = [getGroup(), command, user];
  60. string msgData = llDumpList2String(msgList, separator);
  61. llMessageLinked(LINK_ALL_OTHERS, msgNumber, msgData, "");
  62. }
  63. }