Script.lsl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // :CATEGORY:Communications
  2. // :NAME:Chalkboard
  3. // :AUTHOR:Ferd Frederix
  4. // :CREATED:2014-01-07 22:48:53
  5. // :EDITED:2014-01-07 22:48:12
  6. // :ID:1009
  7. // :NUM:1562
  8. // :REV:1
  9. // :WORLD:Second Life
  10. // :DESCRIPTION:
  11. // It creates a chalkboard. If Shared media is not on, this displays an image named "SharedMedia" to clue them in that they need to enable it or click it
  12. // It also forces the address bar to be minimal, to auto play, and prevent navigation away from this page.
  13. // Add this image to the same prim that holds this script:
  14. // :CODE:
  15. // This script will scan for avatars and pop open the screen for them ( if shared media is enabled).
  16. // It creates a chalkboard. If Shared media is not on, this displays an image named "SharedMedia" to clue them in that they need to enable it or click it
  17. // It also forces the address bar to be minimal, to auto play, and prevent navigation away from this page.
  18. // Add this image to the same prim that holds this script:
  19. // http://dl.dropboxusercontent.com/u/31305726/SharedMedia.png
  20. // :License: Creative Commons CC
  21. // :Author: Ferd Frederix
  22. // :Description:Shared media paper for collaborative chatting in any Virtual world.
  23. // Makes a box <2.8, 1.8, 0.10>
  24. // tapers the x and y = 0.1 to make it framed
  25. // required shared media aka Media on a Prim (MOAP)
  26. string url = "http://sharejs.org/pad/pad.html#02tahXX"; // Change the url ending after the # for private channels
  27. float DISTANCE = 20.0; // distance the picture will detect up an avatar, from 0.1 to 96.0. Biggers numbers cause more lag
  28. float RATE = 5.0; // seconds to scan for an avatar, lower numbers cause more lag but faster response.
  29. string no_viewer2 = "SharedMedia"; // an image to tell them they need to click things.
  30. integer side = 0;
  31. list rules = [
  32. PRIM_MEDIA_AUTO_ZOOM, TRUE,
  33. PRIM_MEDIA_AUTO_PLAY ,TRUE,
  34. // Permissions: choose one
  35. // PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_NONE , // view only
  36. //PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_OWNER , // Just the owner of the prim
  37. //PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_GROUP , // Just group chat
  38. PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_ANYONE ,
  39. PRIM_MEDIA_PERMS_CONTROL,PRIM_MEDIA_PERM_NONE ,
  40. // Media controls: : choose one
  41. //PRIM_MEDIA_CONTROLS, PRIM_MEDIA_CONTROLS_STANDARD, // FULL SIZE CONTROL
  42. PRIM_MEDIA_CONTROLS, PRIM_MEDIA_CONTROLS_MINI, // MINI CONTROL
  43. PRIM_MEDIA_AUTO_SCALE, FALSE, // MUST be false to allow scrolling
  44. PRIM_MEDIA_WIDTH_PIXELS , 800,
  45. PRIM_MEDIA_HEIGHT_PIXELS , 600,
  46. PRIM_MEDIA_CURRENT_URL ];
  47. list page_visible ; // hold the texture when avtar is away
  48. list picture_image; // holds the regular image
  49. list web_rules;
  50. default
  51. {
  52. state_entry()
  53. {
  54. //make boxed picture frame and set it to glow.
  55. llSetPrimitiveParams([ PRIM_FULLBRIGHT,side, TRUE]);
  56. llSetScale(<2.8, 1.8, 0.10>);
  57. llSetPrimitiveParams([ PRIM_TYPE,PRIM_TYPE_BOX,0, <0,1,0>, 0, <0,0,0>, <0.950,0.950,0>, <0,0,0>]);
  58. web_rules = rules + url;
  59. page_visible = [
  60. PRIM_TEXTURE, // command to set a texture
  61. side, // on side 1
  62. "", // the white default texture
  63. <0.56,0.39,0>, // Repeats per face 0.56
  64. <-0.210,-0.210,0>, // Texture Offset
  65. 0 // rotation in radians
  66. ];
  67. picture_image = [
  68. PRIM_TEXTURE, // command to set a texture
  69. side, // on side 1
  70. no_viewer2, // the white default texture
  71. <1,1,0>, // Repeats per face
  72. <0,0,0>, // Texture Offset
  73. 0 // rotation in radians
  74. ];
  75. llClearPrimMedia(side);
  76. llSetPrimitiveParams(picture_image);
  77. llSensorRepeat("","",AGENT,DISTANCE,PI,RATE);
  78. }
  79. sensor(integer nh)
  80. {
  81. llSetPrimitiveParams(page_visible);
  82. llSetPrimMediaParams(side,web_rules);
  83. }
  84. no_sensor()
  85. {
  86. llClearPrimMedia(side);
  87. llSetPrimitiveParams(picture_image);
  88. }
  89. on_rez(integer p)
  90. {
  91. llResetScript();
  92. }
  93. }