Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.98 KB | None | 0 0
  1. //self explanatory shit
  2. integer current_notecard;
  3. integer current_notecard_line;
  4. integer lines_in_current_notecard;
  5. integer DEBUG = FALSE;
  6. //whether its online data or number of lines data
  7. integer FLAG_GET_NUMLINES;
  8. integer FLAG_GET_NAME;
  9. integer FLAG_GET_STATUS;
  10. integer DISPLAY = -1;
  11. integer count;
  12. integer max = 9001;
  13. //Display stuff
  14. list display;
  15. //Dataserver shit
  16. key req;
  17. string name;
  18. string status = "_";
  19. string uuid;
  20. string loadbar;
  21. list load = ["|---","-|--","--|-","---|","----"];
  22. integer zoomb;
  23.  
  24. loadbarstuff()
  25. {
  26. zoomb = (zoomb + 1) % llGetListLength(load);
  27. loadbar = llList2String(load,zoomb);
  28. }
  29.  
  30. float red = 1;
  31. float green;
  32. float blue;
  33. vector color;
  34.  
  35. colortick()
  36. {
  37. if(red >= 1.0)
  38. {
  39. if (blue > 0.1)
  40. {blue = blue - 0.1;}
  41. else
  42. {green = green + 0.1;}
  43. }
  44. if(green >= 1.0)
  45. {
  46. if (red > 0.1)
  47. {red = red - 0.1;}
  48. else
  49. {blue = blue + 0.1;}
  50. }
  51. if(blue >= 1.0)
  52. {
  53. if (green > 0.1)
  54. {green = green - 0.1;}
  55. else
  56. {red = red + 0.1;}
  57. }
  58. color = <red,green,blue>;
  59. }
  60.  
  61. stalk_list_dump(string t)
  62. {
  63. integer x;
  64. for(x=0;x<llGetInventoryNumber(INVENTORY_NOTECARD);x++)
  65. {
  66. if(llToLower(llGetInventoryName(INVENTORY_NOTECARD,x))==t)
  67. {
  68. current_notecard = x;
  69. current_notecard_line = 0;
  70. FLAG_GET_NUMLINES = TRUE;
  71. FLAG_GET_NAME = FALSE;
  72. FLAG_GET_STATUS = FALSE;
  73. DISPLAY = x;
  74. }
  75. }
  76. }
  77.  
  78. default
  79. {
  80. on_rez(integer r)
  81. {
  82. llResetScript();
  83. }
  84. changed(integer c)
  85. {
  86. if(c & CHANGED_INVENTORY)
  87. {
  88. llOwnerSay("Updating Stalkbox");
  89. llResetScript();
  90. }
  91. if(c & CHANGED_TELEPORT)
  92. llResetScript();
  93. }
  94. state_entry()
  95. {
  96. llListen(0,"","","");
  97. if(DEBUG == TRUE)
  98. llSay(0,"initializing");
  99. integer x;
  100. for(x=0;x<llGetInventoryNumber(INVENTORY_NOTECARD);x++)
  101. {
  102. display += "";
  103. }
  104. FLAG_GET_NUMLINES = TRUE;
  105. req = llGetNumberOfNotecardLines(llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
  106. }
  107. listen(integer c, string n, key i, string m)
  108. {
  109. if(llGetOwnerKey(i)==llGetOwner())
  110. {
  111. m = llToLower(m);
  112. if(llSubStringIndex(m,"stalklist") == 0)
  113. {
  114. string targ = llGetSubString(m,llSubStringIndex(m," ")+1,-1);
  115. llOwnerSay("Showing online accounts for: " + targ);
  116. stalk_list_dump(targ);
  117. }
  118. }
  119. }
  120. dataserver(key i, string data)
  121. {
  122. if(i == req)
  123. {
  124. count++;
  125. if(DEBUG == TRUE)
  126. llSay(0,data);
  127. if(FLAG_GET_NUMLINES == TRUE)
  128. {
  129. lines_in_current_notecard = (integer)data;
  130. FLAG_GET_NUMLINES = FALSE;
  131. FLAG_GET_NAME = TRUE;
  132. if(DEBUG == TRUE)
  133. llSay(0,"Got " + (string)lines_in_current_notecard + " lines in notecard " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard) + "\nGetting Notecard info for line " + (string)current_notecard_line + ".");
  134. req = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,current_notecard),0);
  135. }
  136. else if(FLAG_GET_NAME == TRUE)
  137. {
  138. if(data != EOF)
  139. {
  140. if(DEBUG == TRUE)
  141. llSay(0,"checking for notes");
  142. if(llSubStringIndex(data,"#") == 0)
  143. {
  144. //It's a note about that person or account
  145. //Skip it
  146. current_notecard_line++;
  147. req = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,current_notecard),current_notecard_line);
  148. }
  149. else
  150. {
  151. if(DEBUG == TRUE)
  152. llSay(0,"Got name data");
  153. name = llGetSubString(data,0,llSubStringIndex(data,"#")-1);
  154. uuid = llGetSubString(data,llSubStringIndex(data,"#")+1,-1);
  155. if(DEBUG == TRUE)
  156. llSay(0,"Name = " + name + "\nUUID = " + uuid);
  157. FLAG_GET_STATUS = TRUE;
  158. FLAG_GET_NAME = FALSE;
  159. if(DEBUG == TRUE)
  160. llSay(0,"Requesting online data for uuid");
  161. req = llRequestAgentData((key)uuid,DATA_ONLINE);
  162. }
  163. }
  164. else
  165. {
  166. if(DEBUG == TRUE)
  167. llSay(0,"EOF: Updating display list");
  168. display = llListReplaceList(display,[llGetInventoryName(INVENTORY_NOTECARD,current_notecard) + " " + status],current_notecard,current_notecard);
  169. if(DEBUG == TRUE)
  170. llSay(0,"resetting status and flags");
  171. status = "_";
  172. FLAG_GET_NUMLINES = TRUE;
  173. FLAG_GET_STATUS = FALSE;
  174. if(DEBUG == TRUE)
  175. llSay(0,"modulo on current notecard. resetting display flags");
  176. if(DISPLAY == current_notecard)
  177. DISPLAY = -1;
  178. current_notecard = (current_notecard + 1) % llGetInventoryNumber(INVENTORY_NOTECARD);
  179. if(DEBUG == TRUE)
  180. llSay(0,"resetting current notecard line request to 0");
  181. current_notecard_line = 0;
  182. if(DEBUG == TRUE)
  183. llSay(0,"current notecard is " + (string)current_notecard + "\nRequesting number of notecard lines for " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
  184. req = llGetNumberOfNotecardLines(llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
  185. if(DEBUG == TRUE)
  186. llSay(0,"Setting text");
  187. if(DEBUG == TRUE)
  188. llSetText("Current Notecard: " + (string)current_notecard + "\nCurrent Line: " + (string)current_notecard_line + "\n" + llDumpList2String(display,"\n"),<0,1,0>,10);
  189. //else
  190. //{
  191. //loadbarstuff();
  192. //llSetText(llDumpList2String(display,"\n") + "\n" + loadbar,<0,1,0>,10);
  193. //}
  194. }
  195. }
  196. else if(FLAG_GET_STATUS == TRUE)
  197. {
  198. if(data == "1")
  199. {
  200. if(DEBUG == TRUE)
  201. llSay(0,name + " online");
  202. if(DISPLAY == current_notecard)
  203. {
  204. llOwnerSay(llGetInventoryName(INVENTORY_NOTECARD,current_notecard) + " is online on account: " + name);
  205. }
  206. status = "X";
  207. }
  208. else
  209. {
  210. if(DEBUG == TRUE)
  211. {
  212. llSay(0,name + " offline");
  213. }
  214. }
  215. FLAG_GET_STATUS = FALSE;
  216. FLAG_GET_NAME = TRUE;
  217. current_notecard_line++;
  218. if(DEBUG == TRUE)
  219. llSay(0,"Requesting notecard line " + (string)current_notecard_line + " for notecard " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
  220. req = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,current_notecard),current_notecard_line);
  221. }
  222. colortick();
  223. loadbarstuff();
  224. llSetText(llDumpList2String(display,"\n") + "\n" + loadbar + "\nCurrent scan: " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard),color,10);
  225. }
  226. if(count > max)
  227. llResetScript();
  228. else return;
  229. }
  230. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement