Advertisement
vivex42

floating chat text 3.1

Dec 17th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.84 KB | None | 0 0
  1. //Displays what you say wherever you place this script, as well as flashing "Typing..." As you type; slight delay in that if you've already typed something; I might make it better later.
  2. //By Kejento Drake/Potential Difference, 2007 - 2010
  3.  
  4.  
  5. list Display;
  6. float first_random;
  7. float second_random;
  8. float third_random;
  9. integer last_status;
  10. integer typed;
  11.  
  12. string inner;
  13. string outer;
  14. string title;
  15. string typeset;
  16. string leftc;
  17. string rightc;
  18.  
  19. integer chat0;
  20. integer chat1;
  21. integer ao_enabled = FALSE;
  22. integer disabledChat;
  23.  
  24. string getTypeset(string type) {
  25. // llSay(0, "type");
  26. if (typeset == "")
  27. {
  28. return "Typing...";}
  29. else
  30. return type;
  31.  
  32. }
  33.  
  34. //string explicitMessage(integer explicitSet,
  35.  
  36. default
  37. {
  38. on_rez(integer start_param)
  39. {
  40. llResetScript();
  41. }
  42.  
  43. state_entry()
  44. {
  45. llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
  46. typeset = getTypeset(typeset);
  47. llAllowInventoryDrop(TRUE);
  48. //llSetText("{ }", <1,1,1>, 1.5);
  49. llSetTimerEvent(.5);
  50. chat0 = llListen(0, "", llGetOwner(), "");
  51. chat1 = llListen(9, "", llGetOwner(), "");
  52. llWhisper(0, "Running...");
  53. //llSay(0, "Testing");
  54. //llListen(0, "", NULL_KEY, "");
  55. //llSensorRepeat("", llGetOwner(), AGENT,20, PI, .5);
  56.  
  57. }
  58.  
  59.  
  60.  
  61.  
  62. listen(integer channel, string name, key id, string message)
  63.  
  64. {
  65.  
  66. if (channel == 0 && message == "/enable_AO")
  67. ao_enabled = TRUE;
  68.  
  69. if (channel == 0 && message == "/disable_AO")
  70. ao_enabled = FALSE;
  71.  
  72. if (channel == 0 && message == "/disable_FCT")
  73. state disabled;
  74.  
  75. if (channel == 0 && message == "/reset_text")
  76. llResetScript();
  77. else
  78. if (channel == 0 && id == llGetOwner())
  79. {
  80. Display = llParseString2List(message, [" "],[]);
  81.  
  82. if (llList2String(Display, 0) == "/change_brackets")
  83. {
  84. inner = llList2String(Display, 1);
  85. outer = llList2String(Display, 2);
  86.  
  87. }
  88. else
  89.  
  90. if (llList2String(Display, 0) == "/typeset")
  91. {
  92. Display = llDeleteSubList(Display,0,0);
  93. typeset = llDumpList2String(Display, " ");
  94. }
  95. else
  96.  
  97. if (llList2String(Display, 0) == "/concatenate")
  98. {
  99. leftc = llList2String(Display, 1);
  100. rightc = llList2String(Display, 2);
  101.  
  102. }
  103. else
  104.  
  105. if (llList2String(Display, 0) == "/text_title")
  106. {
  107.  
  108. Display = llDeleteSubList(Display,0,0);
  109. title = llDumpList2String(Display, " ");
  110.  
  111.  
  112. }
  113. else
  114.  
  115. if (llList2String(Display, 0) == "/me")
  116. {
  117. first_random = llFrand(1.0);
  118. second_random = llFrand(1.0);
  119. third_random = llFrand(1.0);
  120. Display = llDeleteSubList(Display, 0, 0);
  121. llSetText(inner+" "+llKey2Name(id)+" "+llDumpList2String(Display, " ") +outer,<first_random,second_random,third_random>, 1.5);
  122. llSetTimerEvent(10);
  123. typed = 1;
  124.  
  125. }
  126. else
  127. {
  128. first_random = llFrand(1.0);
  129. second_random = llFrand(1.0);
  130. third_random = llFrand(1.0);
  131. llSetText(inner+" "+leftc+message+rightc+" "+outer, <first_random,second_random,third_random>, 1.5);
  132. typed = 1;
  133. llSetTimerEvent(10);
  134. }
  135.  
  136.  
  137. Display = [];
  138.  
  139. }
  140.  
  141.  
  142. }
  143.  
  144. timer()
  145. {
  146.  
  147. integer typing_or_not = llGetAgentInfo(llGetOwner()) & AGENT_TYPING;
  148.  
  149. while (typing_or_not == AGENT_TYPING)
  150. {
  151. if (ao_enabled == TRUE)
  152. llStartAnimation("lulz");
  153. first_random = llFrand(1.0);
  154. second_random = llFrand(1.0);
  155. third_random = llFrand(1.0);
  156. typing_or_not = llGetAgentInfo(llGetOwner()) & AGENT_TYPING;
  157. llSetText(inner+" "+ typeset +" "+outer, <first_random,second_random,third_random>, 1.5);
  158. //llSetText("{ Typing... }", <first_random,second_random,third_random>, 1.5);
  159.  
  160.  
  161.  
  162.  
  163. //llSetTimer(.5);
  164. //last_status = typing_or_not;
  165. }
  166. if (typed = 1)
  167. {
  168. if (ao_enabled == TRUE)
  169. llStopAnimation("lulz");
  170. typed = 0;
  171. llSetTimerEvent(10);
  172. }
  173.  
  174.  
  175. //llSleep(3);
  176. llSetText(inner+" "+title+" "+outer, <first_random,second_random,third_random>, 1.5);
  177. llSetTimerEvent(.5);
  178. //llSleep(10);
  179.  
  180. // llSetText("{ }", <first_random,second_random,third_random>, 1.5);
  181.  
  182.  
  183.  
  184.  
  185.  
  186. }
  187. }
  188.  
  189.  
  190. state disabled {
  191.  
  192. state_entry()
  193. {
  194.  
  195. llListenRemove(chat0);
  196. llListenRemove(chat1);
  197. disabledChat = llListen(0, "", NULL_KEY, "");
  198.  
  199. }
  200.  
  201. state_exit()
  202. {
  203. llListenRemove(disabledChat);
  204. }
  205.  
  206. listen(integer channel, string name, key id, string message)
  207. {
  208. if (message == "/enable_FCT")
  209. state enabled;
  210.  
  211. }
  212.  
  213. }
  214.  
  215.  
  216. state enabled {
  217. state_entry() {
  218. // disabledChat = 0;
  219. state default;}
  220.  
  221. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement