remote_receiver.lsl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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:37
  7. // :EDITED:2016-03-30 20:29:28
  8. // :ID:1079
  9. // :NUM:1779
  10. // :REV:1.1
  11. // :WORLD:Second Life
  12. // :DESCRIPTION:
  13. // Drop this into the same prim where the SWITCH is located
  14. // :CODE:
  15. // :LICENSE: CC0 (Public Domain)
  16. // Remote receiver for Rene's Free Lighting System
  17. //
  18. // Author: Rene10957 Resident
  19. // Date: 24-01-2014
  20. //
  21. // Drop this into the same prim where the SWITCH is located
  22. // Note: only useful if you are also using the remote control script
  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 = "Remote Receiver"; // title
  27. string version = "1.1"; // version
  28. integer silent = TRUE; // silent startup
  29. // Constants
  30. integer remoteChannel = -975104; // remote channel
  31. integer msgNumber = 10957; // number part of link message
  32. string separator = ";;"; // separator for region messages
  33. // Functions
  34. string getGroup()
  35. {
  36. string str = llStringTrim(llGetObjectDesc(), STRING_TRIM);
  37. if (llToLower(str) == "(no description)" || str == "") str = "Default";
  38. return str;
  39. }
  40. default
  41. {
  42. state_entry()
  43. {
  44. llListen(remoteChannel, "", "", "");
  45. if (!silent) llWhisper(0, title + " " + version + " ready");
  46. }
  47. on_rez(integer start_param)
  48. {
  49. llResetScript();
  50. }
  51. listen(integer channel, string name, key id, string msg)
  52. {
  53. if (channel != remoteChannel) return;
  54. list msgList = llParseString2List(msg, [separator], []);
  55. string group = llList2String(msgList, 0);
  56. string command = llList2String(msgList, 1);
  57. key user = (key)llList2String(msgList, 2);
  58. if (llToLower(group) == llToLower(getGroup())) llMessageLinked(LINK_THIS, msgNumber, command, user);
  59. }
  60. }