Advertisement
chopstyix

Untitled

Dec 31st, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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. if (turtle.detectDown() == true) then
  17. turtle.digDown()
  18. end
  19. turtle.select(item)
  20. turtle.placeDown()
  21. end
  22.  
  23. function placefront(item)
  24. if (turtle.detect() == true) then
  25. turtle.dig()
  26. end
  27. turtle.select(item)
  28. turtle.place()
  29. end
  30.  
  31. function placerow()
  32. placefront(st)
  33. checkst(st)
  34. placedown(gr)
  35. checkgr(gr)
  36. turnaround()
  37. turtle.forward()
  38. placedown(gr)
  39. checkgr(gr)
  40. turtle.forward()
  41. placedown(gr)
  42. checkgr(gr)
  43. placefront(st)
  44. checkst(st)
  45. turnaround()
  46. turtle.forward()
  47. turtle.turnLeft()
  48. end
  49.  
  50. function checkgr(item)
  51. if (turtle.getItemCount(item) == 1) then
  52. if (gr == 4) then
  53. print "Out of Gravel"
  54. else
  55. gr = gr + 1
  56. end
  57. end
  58. end
  59.  
  60. function checkst(item)
  61. if (turtle.getItemCount(item) == 1) then
  62. if (st == 8) then
  63. print "Out of Stairs"
  64. else
  65. st = st + 1
  66. end
  67. end
  68. end
  69.  
  70. -- Main Script
  71.  
  72. for i=1, 2 do
  73. turtle.forward()
  74. turtle.turnRight()
  75. turtle.forward()
  76. placerow()
  77. end
  78. print("Code Terminated")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement