Advertisement
Mackan90096

cblfarm

Feb 5th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. m = peripheral.wrap("right")
  2. function counter()
  3.  local i = 0
  4.  return function() i = i + 1 return i end
  5. end
  6. function modStr(num)
  7.  if num < 10 then
  8.    return "0" .. num
  9.  else
  10.    return num
  11.  end
  12. end
  13. while true do
  14.  if turtle.detect() then
  15.   turtle.dig()
  16.   m.clear()
  17.   term.setCursorPos(1,1)
  18.   local total = 0
  19.   for i=1,16,1 do
  20.    total = total + turtle.getItemCount(i)
  21.   end
  22.   for i=1,16,1 do
  23.    m.write("Row " .. i .. ": " .. turtle.getItemCount(i) .. " (" .. math.floor((turtle.getItemCount(i)/total)*100) .. "%)")
  24.   end
  25.   m.write("Total: " .. total)
  26.   m.write("-----------------")
  27.   local iterator = counter()
  28.   m.write(" ___ ___ ___ ")
  29.   m.write("|" .. modStr(turtle.getItemCount(iterator())) .. " |" .. modStr(turtle.getItemCount(iterator())) .. " |" .. modStr(turtle.getItemCount(iterator())) .. " |")
  30.   m.write("|___|___|___|")
  31.   m.write("|" .. modStr(turtle.getItemCount(iterator())) .. " |" .. modStr(turtle.getItemCount(iterator())) .. " |" .. modStr(turtle.getItemCount(iterator())) .. " |")
  32.   m.write("|---|---|---|")
  33.   m.write("|" .. modStr(turtle.getItemCount(iterator())) .. " |" .. modStr(turtle.getItemCount(iterator())) .. " |" .. modStr(turtle.getItemCount(iterator())) .. " |")
  34.   m.write("|___|___|___|")
  35.   m.write(" ")
  36.   m.write("-----------------")
  37.   m.write("Cobble Farmer")
  38.  end
  39.  totalcount = turtle.getItemCount(16)
  40.  if totalcount == 64 then
  41.   m.clear()
  42.   msetCursorPos(1,1)
  43.   m.write("Dropping Stacks")
  44.   m.write("...Please wait.")
  45.   sleep(1)
  46.   for i=1,16 do
  47.    turtle.select(i)
  48.    turtle.drop()
  49.   end
  50.   turtle.select(1)
  51.  end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement