chopstyix

Untitled

Dec 31st, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. local tArgs = { ... }
  2. local dis = tonumber(tArgs[1])
  3.  
  4. g = 1
  5. st = 5
  6.  
  7.  
  8. -- Functions
  9.  
  10. function turnaround()
  11. turtle.turnRight()
  12. turtle.turnRight()
  13. end
  14.  
  15. function placedown(item)
  16. turtle.detect()
  17. if (turtle.detectDown() == true) then
  18. turtle.digDown()
  19. end
  20. turtle.select(item)
  21. turtle.placeDown()
  22. end
  23.  
  24. function placefront(item)
  25. turtle.detect()
  26. if (turtle.detect() == true) then
  27. turtle.dig()
  28. end
  29. turtle.select(item)
  30. turtle.place()
  31. end
  32.  
  33. function placerow()
  34. placefront(st)
  35. placedown(gr)
  36. turnaround()
  37. turtle.forward()
  38. placedown(gr)
  39. turtle.forward()
  40. placedown(gr)
  41. placefront(st)
  42. turnaround()
  43. turtle.forward()
  44. turtle.turnRight()
  45. end
  46.  
  47. -- Main Script
  48.  
  49. local repeat = true
  50. write( [[This code is looped.
  51. Press Enter to terminate code. OK?")
  52. input = read()
  53. if input == "OK" then
  54. while repeat == true do
  55. turtle.forward()
  56. turtle.turnRight()
  57. turtle.forward()
  58. placerow()
  59. ev,k=os.pullEvent()
  60. if ev=="key"then
  61. if k == 28 then
  62. repeat = false
  63. end
  64. print("Code Terminated.")
  65. end
Advertisement
Add Comment
Please, Sign In to add comment