sloodle_parallel_url_loader_0.lslp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // The line above should be left blank to avoid script errors in OpenSim.
  3. // Sloodle parallel URL loader
  4. // Allows the loading of a single URL on a specified channel.
  5. // (NOTE: should be in the same prim as a "sloodle_multi_url_loader.lsl" script)
  6. // Part of the Sloodle project (www.sloodle.org)
  7. //
  8. // Copyright (c) 2007 Sloodle (various contributors)
  9. // Released under the GNU GPL
  10. //
  11. // Contributors:
  12. // Peter R. Bloomfield
  13. //
  14. //
  15. // When receiving a link message, this script will load a URL for a given user.
  16. // The URL should be in the string, and the user specified by their key.
  17. // The integer number in the link message should be SLOODLE_CHANNEL_OBJECT_LOAD_URL
  18. //
  19. // NOTE: you MUST customize the "MY_CHANNEL_INDEX" value to indicate which script number this is.
  20. // Each of these scripts in a given object should have a unique channel index.
  21. // This identifies where the object appears in the sequence.
  22. // Channel indices should be numbered sequentially from 0.
  23. // It is recommended that you replace the "x" in the script name to correspond to the channel index.
  24. ///// DATA /////
  25. // The index of the channel this script will receive requests on
  26. // (NOTE: corresponds to indices in the list below)
  27. integer MY_CHANNEL_INDEX = 0;
  28. // OUTGOING link message numbers for parallel load requests
  29. list SLOODLE_CHANNEL_LIST_LOAD_URL_x = [
  30. -1699000001, //SLOODLE_CHANNEL_LOAD_URL_0
  31. -1699000002, //SLOODLE_CHANNEL_LOAD_URL_1
  32. -1699000003, //SLOODLE_CHANNEL_LOAD_URL_2
  33. -1699000004, //SLOODLE_CHANNEL_LOAD_URL_3
  34. -1699000005, //SLOODLE_CHANNEL_LOAD_URL_4
  35. -1699000006, //SLOODLE_CHANNEL_LOAD_URL_5
  36. -1699000007, //SLOODLE_CHANNEL_LOAD_URL_6
  37. -1699000008, //SLOODLE_CHANNEL_LOAD_URL_7
  38. -1699000009, //SLOODLE_CHANNEL_LOAD_URL_8
  39. -1699000010 //SLOODLE_CHANNEL_LOAD_URL_9
  40. ];
  41. ///// ---- /////
  42. default
  43. {
  44. state_entry()
  45. {
  46. if (MY_CHANNEL_INDEX < 0 || MY_CHANNEL_INDEX > llGetListLength(SLOODLE_CHANNEL_LIST_LOAD_URL_x)) {
  47. llOwnerSay("WARNING: script \"" + llGetScriptName() + "\" has an invalid channel index. Please alter value \"MY_CHANNEL_INDEX\".");
  48. }
  49. }
  50. link_message( integer sender_num, integer msg_num, string str, key id )
  51. {
  52. // Ignore this message if the variables are empty
  53. if (str == "" || id == NULL_KEY) return;
  54. // If this message is not on the correct channel, then ignore it
  55. if (msg_num != llList2Integer(SLOODLE_CHANNEL_LIST_LOAD_URL_x, MY_CHANNEL_INDEX)) return;
  56. // Load the URL
  57. llLoadURL(id, "", str);
  58. }
  59. }
  60. // Please leave the following line intact to show where the script lives in Git:
  61. // SLOODLE LSL Script Git Location: assets/sloodle_parallel_url_loader_0.lslp