Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1.  
  2. //Script Check Section
  3. string allowed;
  4. string temp;
  5. integer DISCREET = TRUE;
  6. list GET_DETAILS = [OBJECT_SCRIPT_MEMORY, OBJECT_TOTAL_SCRIPT_COUNT, OBJECT_RUNNING_SCRIPT_COUNT];
  7.  
  8. //check nearby avatar
  9. list recent_avatars;
  10. list results;
  11. integer SCRIPTS;
  12. add_avatar(string name) {
  13. if(!seen(name)) {
  14. recent_avatars += name;
  15. if (llGetListLength(recent_avatars) > 50)
  16. {
  17. recent_avatars = llDeleteSubList(recent_avatars,0,0);
  18. }
  19. }
  20. }
  21. integer seen(string name) {
  22. if(llListFindList(recent_avatars,[name]) > -1) { return TRUE; }
  23. return FALSE;
  24. }
  25. default
  26. {
  27. on_rez(integer start_param)
  28. {
  29. // Restarts the script every time the object is rezzed
  30. llResetScript();
  31. }
  32. state_entry()
  33. {
  34.  
  35. allowed = llGetObjectDesc() ;
  36. llSetTimerEvent(604800);
  37. llSensorRepeat("", NULL_KEY, AGENT, 5, PI, 5);
  38.  
  39. }
  40. sensor(integer total_number)
  41. {
  42. if(!seen(llDetectedName(0)))
  43. {
  44. results = llGetObjectDetails(llDetectedKey(0),GET_DETAILS);
  45. SCRIPTS = llList2Integer(results, 1);
  46. // llSay(0, (string)SCRIPTS);
  47. temp = "This is a Private Message to you. " +
  48. "You currently have " + (string)llList2Integer(results, 1) +
  49. " Total Scripts, of which " +
  50. (string)llList2Integer(results, 2) +
  51. " are running.";
  52. llInstantMessage(llDetectedKey(0), temp );
  53.  
  54. {
  55. if ((integer)SCRIPTS >= (integer) allowed)
  56. llInstantMessage(llDetectedKey(0), "To help reduce lag in the SIM, please do what you can to reduce your total scripts. If you need assistance, ask a resident.");
  57.  
  58. else if ((integer)SCRIPTS < (integer) allowed)
  59. llInstantMessage(llDetectedKey(0), "We thank you for being Script-Aware and helping keep the SIM lag-free!");
  60. add_avatar(llDetectedName(0));
  61. }
  62. }
  63.  
  64. }
  65. timer()
  66. {
  67. llResetScript();
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement