Advertisement
Wassaa

packager 9x9

Nov 26th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. p = peripheral.wrap("front")
  2. turtle.select(12)
  3. items = p.getAllStacks()
  4. turtleDir = ("West")
  5. quantity = 0
  6. p.condenseItems()
  7.  
  8. function getStacks()
  9. items = {}
  10.     for i=1, p.getInventorySize() do
  11.         if p.getStackInSlot(i) ~= nil then
  12.             quantity = p.getStackInSlot(i).qty
  13.             --if quantity >= 9 then
  14.             if quantity >= 4 then
  15.                 doCrafting(i, quantity)
  16.                 print("crafting")
  17.             end
  18.         end
  19.     end
  20. end
  21.  
  22. function getStacksxx(_index)
  23.     items = p.getAllStacks()
  24.     if items[_index] ~= nil then
  25.         quantity = items[_index]["qty"]
  26.     end
  27.     --if quantity >= 9 then
  28.     if quantity >= 4 then
  29.         doCrafting(_index, quantity)
  30.         print("crafting")
  31.     end
  32. end
  33.  
  34. function doCrafting(slot, n)
  35.     --craftNr = math.floor(n / 9)
  36.     craftNr = math.floor(n / 4)
  37.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 1)
  38.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 2)
  39.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 5)
  40.     p.pushItemIntoSlot(turtleDir,slot,craftNr, 6)
  41.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 3)
  42.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 7)
  43.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 9)
  44.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 10)
  45.     --p.pushItemIntoSlot(turtleDir,slot,craftNr, 11)
  46.     turtle.craft()
  47.     turtle.dropUp()
  48. end
  49.  
  50.  
  51.  
  52. while true do
  53.     getStacks()
  54.     p.condenseItems()
  55.     --print("waiting 1")
  56.     --os.sleep(0)
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement