Advertisement
Guest User

startup

a guest
Apr 26th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local p = peripheral
  2. local r = p.wrap("left")
  3. local c = p.wrap("front")
  4. local t = turtle
  5.  
  6. rs.setOutput("top", false)
  7.  
  8. function empty()
  9.   for i=1,16 do
  10.     t.select(i)
  11.     t.drop()
  12.   end
  13. end
  14.  
  15.  
  16. function getItem(name, amount, toSlot)
  17.    for slot, item in pairs(c.getAllStacks()) do
  18.         for a, b in pairs(item) do
  19.             if a == "all" then
  20.                 for a2, b2 in pairs(b()) do
  21.                     if a2 == "display_name" then
  22.                         if string.match(b2, name) then
  23.                             if t.getItemCount(toSlot) ~= amount then
  24.                                 toMove = amount - t.getItemCount(toSlot)
  25.                                 moved = c.pushItem("WEST", slot, toMove, toSlot)
  26.                                 if tonumber(moved) ~= tonumber(amount) then
  27.                                     toMove = amount - t.getItemCount(toSlot)
  28.                                     getItem(name, amount, toSlot)
  29.                                 end
  30.                             end
  31.                         end
  32.                     end
  33.                 end
  34.             end
  35.         end
  36.         print("]")
  37.    end
  38.   return false
  39. end
  40.  
  41. if true then
  42.   t.digDown()
  43.   empty()
  44.   sleep(1)
  45.   getItem("Seeds", 1, 1)
  46.   sleep(1)
  47.   t.select(1)
  48.   t.placeDown()
  49.   rs.setOutput("top", true)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement