Wassaa

Free Auto Packager

Jan 9th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. p = peripheral.wrap("front")
  2.  
  3. turtleDir = ("West")
  4. quantity = 0
  5. p.condenseItems()
  6.  
  7. function getStacks()
  8.     for i=1, p.getInventorySize() do
  9.         if p.getStackInSlot(i) ~= nil then
  10.             quantity = p.getStackInSlot(i).qty
  11.             --if quantity >= 9 then
  12.             if quantity >= 4 then
  13.                 doCrafting(i, quantity)
  14.                 print("crafting")
  15.             end
  16.         end
  17.     end
  18. end
  19.  
  20. function doCrafting(slot, n)
  21.     --craftNr = math.floor(n / 9)
  22.     craftNr = math.floor(n / 4)
  23.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 1)
  24.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 2)
  25.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 5)
  26.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 6)
  27.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 3)
  28.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 7)
  29.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 9)
  30.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 10)
  31.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 11)
  32.     turtle.craft()
  33.     turtle.dropUp()
  34. end
  35.  
  36.  
  37.  
  38. while true do
  39.     getStacks()
  40.     p.condenseItems()
  41.     print("waiting 1")
  42.     os.sleep(0.4)
  43. end
Add Comment
Please, Sign In to add comment