Advertisement
Sanwi

ChestLogger

Jul 16th, 2014
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. $${
  2.  
  3. // Open chest
  4. key(use);
  5. wait(500ms);
  6.  
  7. // Log contents
  8. for(#forsearch,0,53);
  9. // look in slot
  10. getslotitem(%#forsearch%,&founditem,#cstacksize,#cmeta);
  11. // if item found...
  12. if(%&founditem% != "air");
  13. // If potion, get name from damage value
  14. if(%&founditem% = "potion");
  15. @#getpotionnamemetadata = %#cmeta%
  16. exec(getpotionname.txt,"getpotionname");
  17. wait(300ms);
  18. do;
  19. wait(10ms);
  20. while(@getpotionname);
  21.  
  22. &founditem = %@&gotpotionname%
  23. endif;
  24.  
  25. // check array for current item
  26. foreach(&chestlogarray,&carrayitem);
  27. // If item found in array...
  28. ifmatches(%&carrayitem%,"^\d (%&founditem%)$");
  29.  
  30. set(founditeminarray);
  31.  
  32. // Find item pos in array
  33. IndexOf(&chestlogarray,#index,%&carrayitem%)
  34.  
  35. // Split current array var
  36. #arrayrecall[] = split(" ",%&chestlogarray[%#index%]%);
  37.  
  38. // Add item stack to array
  39. #putstacksize = (%#arrayrecall[0]%) + (%#cstacksize%)
  40.  
  41. // Set array var to new stack size
  42. &chestlogarray[%#index%] = "%#putstacksize% %&founditem%"
  43. endif;
  44. next;
  45.  
  46. // If array contains item, add, else put new item in array
  47. if(founditeminarray);
  48. unset(founditeminarray);
  49. else;
  50. put(&chestlogarray,"%#cstacksize% %&founditem%");
  51. endif;
  52. endif;
  53.  
  54. next;
  55.  
  56.  
  57. // Clear array
  58. foreach(&chestlogarray,&carrayitem);
  59. pop(&chestlogarray,&cpop);
  60. logto(chestlog.txt,"%&cpop%");
  61. next;
  62.  
  63.  
  64. gui();
  65.  
  66. stop();
  67. }$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement