Advertisement
jille_Jr

CC: Crafting script [ERRORS]

Sep 27th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. while not turtle.detectDown() do
  2.   turtle.down() -- get the turtle down to the ground.
  3. end
  4. turtle.up() -- to keep the turtle 1 block up in the air.
  5.  
  6. -- I got 2 pieces of log, and I want to craft a chest...
  7. -- The log is in the first position in the turtles inventory
  8. turtle.select(1)
  9. turtle.craft(2)
  10.  
  11. for i = 1, 9 do -- I THINK this will execute 8 times, starting on 1...
  12.   if i == 4 or i == 6 or i == 8 then i = i + 1 end -- to get the crafting grid for a chest.
  13.   if i ~= 8 then turtle.dropDown(8 - i) end -- drop the stuff below the turtle, unless it's on it's 8th run.
  14.   if i ~= 1 then turtle.select(i) end -- select the correct slot (not on first run)
  15.   if i ~= 8 then turtle.suckDown() end -- pick everything thats below up again, putting it in the expected slot.
  16. end
  17.  
  18. if not turtle.craft() then
  19.   print("Failed crafting!")
  20. end
  21.  
  22. -- so the turtle should place wooden planks in this pattern:
  23. -- [ ] [ ] [ ]
  24. -- [ ] N/A [ ]
  25. -- [ ] [ ] [ ]
  26. -- unless someone else picks up the blocks or if extra blocks where placed below
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement