sign.lslp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // The line above should be left blank to avoid script errors in OpenSim.
  3. string SLOODLE_EOF = "sloodleeof";
  4. integer eof= FALSE;
  5. integer isconfigured=FALSE;
  6. 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.
  7. string color= "#e7dfbc";
  8. string bgcolor = "#8a4c23";
  9. string title="";
  10. integer fontsize=150;
  11. integer side=1;
  12. setMessage(string str,string color,string bgcolor){
  13. llClearPrimMedia(side);
  14. string url = "data:text/html,<body style=\"width:1000px;height:500px;background-color:"+bgcolor+";color:"+color+";font-weight:bold;\">";
  15. url+="<div style=\"position:relative;top:19px;text-align:center;width:1000px;height:500px;font-size:"+(string)fontsize+"px;\" >";
  16. url+=str;
  17. url+="</div></body>";
  18. 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 ] );
  19. }
  20. integer sloodle_handle_command(string str)
  21. {
  22. list bits = llParseString2List(str,["|"],[]);
  23. integer numbits = llGetListLength(bits);
  24. string name = llList2String(bits,0);
  25. string value1 = "";
  26. string value2 = "";
  27. if (numbits > 1) value1 = llList2String(bits,1);
  28. if (numbits > 2) value2 = llList2String(bits,2);
  29. if (name == "set:color"){
  30. color = (string)value1;
  31. }else
  32. if (name == "set:bgcolor"){
  33. bgcolor = (string)value1;
  34. }else
  35. if (name=="set:title"){
  36. title = (string)value1;
  37. }
  38. else
  39. if (name=="set:fontsize"){
  40. fontsize= (integer)value1;
  41. }
  42. else if (name == SLOODLE_EOF) eof = TRUE;
  43. return (color != ""&&title!="");
  44. }
  45. default {
  46. on_rez(integer start_param) {
  47. llResetScript();
  48. }
  49. state_entry() {
  50. }
  51. link_message( integer sender_num, integer num, string str, key id)
  52. {
  53. // Check the channel
  54. if (num == SLOODLE_CHANNEL_OBJECT_DIALOG) {
  55. // Split the message into lines
  56. list lines = llParseString2List(str, ["\n"], []);
  57. integer numlines = llGetListLength(lines);
  58. integer i = 0;
  59. for (i=0; i < numlines; i++) {
  60. isconfigured = sloodle_handle_command(llList2String(lines, i));
  61. }
  62. if (isconfigured){
  63. state ready;
  64. }
  65. // If we've got all our data AND reached the end of the configuration data, then move on
  66. }
  67. }
  68. }
  69. state bready{
  70. state_entry() {
  71. state ready;
  72. }
  73. }
  74. state ready{
  75. on_rez(integer start_param) {
  76. llResetScript();
  77. }
  78. state_entry() {
  79. setMessage(title,color,bgcolor);
  80. }
  81. link_message( integer sender_num, integer num, string str, key id)
  82. {
  83. // Check the channel
  84. if (num == SLOODLE_CHANNEL_OBJECT_DIALOG) {
  85. // Split the message into lines
  86. list lines = llParseString2List(str, ["\n"], []);
  87. integer numlines = llGetListLength(lines);
  88. integer i = 0;
  89. for (i=0; i < numlines; i++) {
  90. isconfigured = sloodle_handle_command(llList2String(lines, i));
  91. }
  92. if (isconfigured) state bready;
  93. // If we've got all our data AND reached the end of the configuration data, then move on
  94. }
  95. }
  96. }
  97. // Please leave the following line intact to show where the script lives in Git:
  98. // SLOODLE LSL Script Git Location: mod/furniture-1.0/objects/sign/assets/sign.lslp