Advertisement
kingding82

Untitled

Feb 12th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. term.redirect(peripheral.wrap("right"));
  2. chest = peripheral.wrap("bottom");
  3.  
  4. function makeString(c)
  5. local h = tostring(c);
  6. if string.len(h) == 1 then
  7. return h.." ";
  8. end
  9. return h;
  10. end
  11.  
  12. function makeInvStr(slot)
  13. return makeString(turtle.getItemCount(slot));
  14. end
  15.  
  16. function getTotal()
  17. local h = 0;
  18. for i = 1, 16 do
  19. h = h +turtle.getItemCount(i);
  20. end
  21. turtle.getItemCount(slot)
  22. return h;
  23. end
  24.  
  25. function getChest()
  26. local h = 0;
  27. for i = 1, chest.getInventorySize() do
  28. local l = chest.getStackInSlot(i);
  29. if l ~= null then
  30. h = h +l.qty;
  31. end
  32. i = i+1;
  33. end
  34. turtle.getItemCount(slot)
  35. return h;
  36. end
  37.  
  38. while true do
  39. if turtle.detect() then
  40. turtle.dig();
  41. term.clear();
  42. term.setCursorPos(1, 1);
  43.  
  44. print();
  45. print("Kiste: ");
  46. local ch = (getChest() *5);
  47. print(" " .. ch .. " (" .. (math.floor(ch /(chest.getInventorySize() *64) *100)) .. "%)");
  48.  
  49. local tot = getTotal();
  50. print("Turtle: ");
  51. print(" " .. tot .. " (" .. (math.floor(tot /1024 *100)) .. "%)");
  52. print();
  53.  
  54. print("+--+--+--+--+");
  55. print("|" .. makeInvStr(1) .. "|" .. makeInvStr(2) .. "|" .. makeInvStr(3) .. "|" .. makeInvStr(4) .. "|");
  56. print("|" .. makeInvStr(5) .. "|" .. makeInvStr(6) .. "|" .. makeInvStr(7) .. "|" .. makeInvStr(8) .. "|");
  57. print("|" .. makeInvStr(9) .. "|" .. makeInvStr(10) .. "|" .. makeInvStr(11) .. "|" .. makeInvStr(12) .. "|");
  58. print("|" .. makeInvStr(13) .. "|" .. makeInvStr(14) .. "|" .. makeInvStr(15) .. "|" .. makeInvStr(16) .. "|");
  59. print("+--+--+--+--+");
  60. print()
  61. print("by kingdingeling82")
  62.  
  63. if turtle.getItemCount(16) == 64 then
  64. for i = 1, 16 do
  65. turtle.select(i);
  66. turtle.dropDown();
  67. end
  68. turtle.select(1);
  69. end
  70. end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement