Jharakn

Untitled

Apr 5th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. --turtle square 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 side = 1
  15.  
  16. while true do
  17. for i = 1,17 do
  18. if turtle.getItemCount(slotNum) == 0 then
  19. slotNum = slotNum + 1
  20. if slotNum == 17 then
  21. stopForBricks()
  22. slotNum = 1
  23. end
  24. end
  25. turtle.select(slotNum)
  26. turtle.placeDown()
  27. turtle.forward()
  28. end
  29.  
  30. turtle.turnRight()
  31. side = side + 1
  32.  
  33. if side == 5 then
  34. turtle.up()
  35. side = 1
  36. end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment