Jharakn

Untitled

Apr 16th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. --turtle builder
  2.  
  3. function stopForBricks()
  4. print("out of bricks, fill'er up and press c")
  5. while true do
  6. local event, character = os.pullEvent()
  7. if event == "char" and character == "c" then break end
  8. end
  9. end
  10.  
  11. --main program
  12.  
  13. local slotNum = 1
  14. local turnDirection = 1 --where 1 is right and 2 is left
  15.  
  16. print("length?")
  17. local length = read()
  18.  
  19. while true do
  20. for i = 1,length do
  21. if turtle.getItemCount(slotNum) == 0 then
  22. slotNum = slotNum + 1
  23. if slotNum == 17 then
  24. stopForBricks()
  25. slotNum = 1
  26. end
  27. end
  28. turtle.select(slotNum)
  29. turtle.placeDown()
  30. turtle.forward()
  31. end
  32.  
  33. if turnDirection == 1 then
  34. turtle.turnRight()
  35. turtle.forward()
  36. turtle.turnRight()
  37. turnDirection = 2
  38. else
  39. turtle.turnLeft()
  40. turtle.forward()
  41. turtle.turnLeft()
  42. turnDirection = 1
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment