chalkboard.lslp 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // The line above should be left blank to avoid script errors in OpenSim.
  3. integer SLOODLE_CHANNEL_SET_SET_SHARED_MEDIA_URL_OWNER = -1639270111; // set the main shared media panel to the specified URL, accessible to the owner
  4. integer SLOODLE_CHANNEL_SET_SET_SHARED_MEDIA_URL_GROUP = -1639270112; // set the main shared media panel to the specified URL, accessible to the group
  5. integer SLOODLE_CHANNEL_SET_SET_SHARED_MEDIA_URL_ANYONE = -1639270114; // set the main shared media panel to the specified URL, accessible to anyone
  6. integer side = 0;
  7. setMessage(string str){
  8. string url = "data:text/html,<body style=\"width:1000px;height:1000px;background-color:#23212e;color:white;font-weight:bold;\">";
  9. url+="<div style=\"position:relative;top:19px;text-align:center;width:1000px;height:750px;font-size:50px;\" >";
  10. url+=str;
  11. url+="</div></body>";
  12. llClearPrimMedia(side);
  13. llSetPrimMediaParams( side, [ PRIM_MEDIA_CURRENT_URL, url, PRIM_MEDIA_HOME_URL, url, PRIM_MEDIA_FIRST_CLICK_INTERACT, TRUE, PRIM_MEDIA_AUTO_ZOOM, TRUE, PRIM_MEDIA_AUTO_PLAY, TRUE, PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_OWNER, PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE ] );
  14. }
  15. integer channel=9;
  16. string SLOODLE_EOF = "sloodleeof";
  17. integer eof= FALSE;
  18. integer isconfigured=FALSE;
  19. integer SLOODLE_CHANNEL_OBJECT_DIALOG = -3857343; // an arbitrary channel the sloodle scripts will use to talk to each other. Doesn't atter what it is, as long as the same thing is set in the sloodle_slave script.
  20. string chalkboardtext;
  21. integer sloodle_handle_command(string str)
  22. {
  23. list bits = llParseString2List(str,["|"],[]);
  24. integer numbits = llGetListLength(bits);
  25. string name = llList2String(bits,0);
  26. string value1 = "";
  27. string value2 = "";
  28. if (numbits > 1) value1 = llList2String(bits,1);
  29. if (numbits > 2) value2 = llList2String(bits,2);
  30. if (name == "set:chalkboardtext"){
  31. chalkboardtext = (string)value1;
  32. setMessage(chalkboardtext);
  33. }else
  34. if (name == "set:channel"){
  35. channel= (integer)value1;
  36. }
  37. else if (name == SLOODLE_EOF) eof = TRUE;
  38. return (chalkboardtext != "");
  39. }
  40. default
  41. {
  42. // touch_start(integer d){
  43. // llSay(0,(string)llDetectedTouchFace(0));
  44. //}
  45. state_entry(){
  46. llClearPrimMedia( 1);
  47. setMessage(llKey2Name(llGetOwner())+", \"type /9 message\" to write a message");
  48. llListen(channel, "", llGetOwner(), "");
  49. }
  50. listen(integer channel, string name, key id, string message) {
  51. llClearPrimMedia(side);
  52. setMessage(message);
  53. }
  54. link_message( integer sender_num, integer num, string str, key id)
  55. {
  56. // Check the channel
  57. if (num == SLOODLE_CHANNEL_OBJECT_DIALOG) {
  58. // Split the message into lines
  59. list lines = llParseString2List(str, ["\n"], []);
  60. integer numlines = llGetListLength(lines);
  61. integer i = 0;
  62. for (; i < numlines; i++) {
  63. isconfigured = sloodle_handle_command(llList2String(lines, i));
  64. }
  65. // If we've got all our data AND reached the end of the configuration data, then move on
  66. if (eof == TRUE) {
  67. if (isconfigured == TRUE) {
  68. //sloodle_translation_request(SLOODLE_TRANSLATE_SAY, [0], "configurationreceived", [], null_key, "");
  69. }
  70. }
  71. }
  72. }
  73. on_rez(integer start_param) {
  74. //llClearPrimMedia(3);
  75. // Give the object a starting texture.
  76. // If we just use llClearPrimMedia here, we get a strange problem where if you click on it before it's ready, autozoom fails until you look away then look back.
  77. string url = "data:text/html,<body style=\"width:1000px;height:1000px;background-color:#595c67;color:white;font-weight:bold;\"><div style=\"position:relative;top:200px;text-align:center;width:1000px;height:750px;font-size:200%\" >Waiting for Message</div></body>";
  78. llSetPrimMediaParams( side, [ PRIM_MEDIA_CURRENT_URL, url, PRIM_MEDIA_HOME_URL, url, PRIM_MEDIA_FIRST_CLICK_INTERACT, TRUE, PRIM_MEDIA_AUTO_ZOOM, TRUE, PRIM_MEDIA_AUTO_PLAY, TRUE, PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_OWNER, PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE ] );
  79. }
  80. }
  81. // Please leave the following line intact to show where the script lives in Git:
  82. // SLOODLE LSL Script Git Location: mod/furniture-1.0/objects/chalkboard/assets/chalkboard.lslp