Advertisement
chopstyix

Untitled

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