Advertisement
denvys5

WaterFiller

Jul 9th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. crafts = 2
  2. t=turtle
  3. j = crafts - 1
  4. l = 16 - crafts
  5. k = 16 - j
  6. function inv()
  7.   t.select(1)
  8.   if t.getItemCount(1) == 0 then
  9.    t.suckUp()
  10.  end
  11. end
  12. function transfer(k)
  13.  t.select(1)
  14.  if t.getItemCount(1) > 1 then
  15.   for  i=2,k do
  16.    t.transferTo(i, 1)
  17.   end
  18.  end
  19. end
  20. function fill(i, crafts, l)
  21.  t.select(i)
  22.  for a=l,16 do
  23.  if t.compareTo(a) == true then
  24.   t.place()
  25. else
  26.   sleep(0.2)
  27.   end
  28.  end
  29. end
  30. function fillM(crafts, j, l)
  31.  for i = 1,l do
  32.   if t.getItemCount(i) == 1 then
  33.    fill(i, crafts, l)
  34.   else
  35.    if t.getItemCount(i) > 1 then
  36.     t.select(i)
  37.     if  t.getSelectedSlot() < j then
  38.       t.transferTo(i + 1, 1)
  39.     else
  40.      if t.getSelectedSlot() == j then
  41.        t.select(i)
  42.        t.transferTo(1, t.getItemCount(i) - 1)
  43.        t.place()
  44.      end
  45.     end
  46.    end
  47.   end
  48.  end
  49. end
  50. function main(crafts, j, k, l)
  51.  inv()
  52.  transfer(k)
  53.  fillM(crafts, j, l)
  54. end
  55. while true do
  56.  main(crafts, j, k, l)
  57.  sleep(5)
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement