Guest User

Untitled

a guest
Dec 14th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.77 KB | None | 0 0
  1. -- This program creates a square of 9 3x3 block satellites for use as GPS trackers.
  2.  
  3. local v = 1
  4. local y = 0
  5. local x = 0
  6. local s = 127
  7. -- v/x are timers, y is the turtle's Y coordinate. s is the spread of the satellites.
  8.  
  9. -- Functions, placesat places a 3x3 square starting with the middle, then a console. landing lands the turtle at the end.
  10. function placesat()
  11. turtle.down()
  12. turtle.placeDown()
  13. turtle.forward()
  14. turtle.placeDown()
  15. turtle.turnRight()
  16. turtle.forward()
  17. turtle.placeDown()
  18. turtle.turnRight()
  19. turtle.forward()
  20. turtle.placeDown()
  21. turtle.forward()
  22. turtle.placeDown()
  23. turtle.turnRight()
  24. turtle.forward()
  25. turtle.placeDown()
  26. turtle.forward()
  27. turtle.placeDown()
  28. turtle.turnRight()
  29. turtle.forward()
  30. turtle.placeDown()
  31. turtle.forward()
  32. turtle.placeDown()
  33. turtle.turnRight()
  34. turtle.forward()
  35. turtle.turnLeft()
  36. turtle.back()
  37. turtle.up()
  38. turtle.select(9)
  39. turtle.placeDown()
  40. turtle.select(1)
  41. if turtle.getItemCount(cslot) == 0 then
  42. turtle.select(2)
  43. end
  44. x = 1
  45. end
  46. function landing()
  47. turtle.turnLeft()
  48. turtle.forward()
  49. turtle.forward()
  50. turtle.turnLeft()
  51. turtle.turnLeft()
  52. turtle.down()
  53. turtle.down()
  54. turtle.down()
  55. turtle.forward()
  56. turtle.forward()
  57. turtle.turnLeft()
  58.  repeat
  59.  turtle.down()
  60.  v = v - 1
  61.  until v < 2
  62. end
  63. print ("Enter your turtle's current elevation [Y].")
  64. y = read()
  65. print ("Place materials in slots 1-2, computers in slot 9. Enter the desired spread and press enter to begin.")
  66. s = read()
  67. -- This is the beginning ascent.
  68. repeat
  69. turtle.up()
  70. v = v + 1
  71. until v > (129 - y)
  72. -- The extra 1 block of ascent is to account for the 1 block drop at the start of placesat
  73. placesat()
  74. turtle.forward()
  75. turtle.down()
  76. repeat
  77. turtle.forward()
  78. x = x + 1
  79. until x > s
  80. -- Second platform
  81. placesat()
  82. turtle.turnLeft()
  83. repeat
  84. turtle.forward()
  85. x = x + 1
  86. until x > s
  87. turtle.turnRight()
  88. -- Third platform
  89. placesat()
  90. turtle.turnLeft()
  91. turtle.turnLeft()
  92. repeat
  93. turtle.forward()
  94. x = x + 1
  95. until x > s
  96. turtle.turnRight()
  97. turtle.turnRight()
  98. -- Forth platform
  99. placesat()
  100. turtle.turnLeft()
  101. turtle.turnLeft()
  102. repeat
  103. turtle.forward()
  104. x = x + 1
  105. until x > s
  106. turtle.turnRight()
  107. turtle.turnRight()
  108. -- Fifth platform
  109. placesat()
  110. turtle.turnRight()
  111. repeat
  112. turtle.forward()
  113. x = x + 1
  114. until x > s
  115. turtle.turnLeft()
  116. -- Sixth platform
  117. placesat()
  118. turtle.turnRight()
  119. repeat
  120. turtle.forward()
  121. x = x + 1
  122. until x > s
  123. turtle.turnLeft()
  124. -- Seventh platform
  125. placesat()
  126. repeat
  127. turtle.forward()
  128. x = x + 1
  129. until x > s
  130. -- Eighth platform
  131. placesat()
  132. repeat
  133. turtle.forward()
  134. x = x + 1
  135. until x > s
  136. -- Final platform
  137. placesat()
  138. turtle.turnLeft()
  139. repeat
  140. turtle.forward()
  141. x = x + 1
  142. until x > s
  143. x = 0
  144. turtle.turnLeft()
  145. turtle.up()
  146. repeat
  147. turtle.forward()
  148. x = x + 1
  149. until x > s
  150. x = 0
  151. turtle.turnRight()
  152. turtle.turnRight()
  153. landing()
Add Comment
Please, Sign In to add comment