TheCryptek

[LUA][OC] Creeper Robot Build

Aug 14th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.99 KB | None | 0 0
  1. --Robot builds creeper
  2.  
  3. local sides = require("sides")
  4. local event = require("event")
  5. local c = require("component")
  6. local computer = require("computer")
  7. local robot = c.robot
  8. --local rs = c.redstone
  9. local chu = c.chunkloader
  10.  
  11. local function moveUp(amount)
  12.   local move = amount
  13.  
  14.   while move > 0 do
  15.     robot.move(sides.up)
  16.     move = move - 1
  17.   end
  18. end
  19.  
  20. local function moveDown(amount)
  21.   local move = amount
  22.  
  23.   while move > 0 do
  24.     robot.move(sides.down)
  25.     move = move - 1
  26.   end
  27. end
  28.  
  29. local function moveLeft(amount)
  30.   local move = amount
  31.  
  32.   robot.turn(false)
  33.  
  34.   while move > 0 do
  35.     robot.move(sides.front)
  36.     move = move - 1
  37.   end
  38.  
  39.   robot.turn(true)
  40. end
  41.  
  42. local function moveRight(amount)
  43.   local move = amount
  44.   robot.turn(true)
  45.  
  46.   while move > 0 do
  47.     robot.move(sides.front)
  48.     move = move - 1
  49.   end
  50.   robot.turn(false)
  51. end
  52.  
  53. local function moveForward(amount)
  54.   local move = amount
  55.  
  56.   while move > 0 do
  57.     robot.move(sides.front)
  58.     move = move - 1
  59.   end
  60. end
  61.  
  62. local function moveBack(amount)
  63.   local move = amount
  64.  
  65.   while move > 0 do
  66.     robot.move(sides.back)
  67.     move = move - 1
  68.   end
  69. end
  70.  
  71. local function oneeighty()
  72.   robot.turn(true)
  73.   robot.turn(true)
  74. end
  75.  
  76. local function place()
  77.   robot.place(sides.front)
  78. end
  79.  
  80. local function doplace()
  81.   place()
  82. end
  83.  
  84.  
  85. robot.select(1)
  86. robot.setLightColor(0x00DB00) --green
  87. doplace()
  88. moveUp(1)
  89. doplace()
  90. moveUp(1)
  91. doplace()
  92. moveUp(1)
  93. doplace()
  94. moveUp(1)
  95. doplace()
  96. moveUp(1)
  97. doplace()
  98. moveUp(1)
  99. doplace()
  100. moveRight(1)
  101. doplace()
  102. robot.select(2)
  103. moveDown(1)
  104. doplace()
  105. moveDown(1)
  106. doplace()
  107. robot.select(1)
  108. moveDown(1)
  109. doplace()
  110. moveDown(1)
  111. doplace()
  112. moveDown(1)
  113. doplace()
  114. moveDown(1)
  115. doplace()
  116. moveRight(1)
  117. doplace()
  118. robot.select(2)
  119. moveUp(1)
  120. doplace()
  121. moveUp(1)
  122. doplace()
  123. robot.select(1)
  124. moveUp(1)
  125. doplace()
  126. robot.select(2)
  127. moveUp(1)
  128. doplace()
  129. moveUp(1)
  130. doplace()
  131. robot.select(1)
  132. moveUp(1)
  133. doplace()
  134. moveRight(1)
  135. doplace()
  136. moveDown(1)
  137. doplace()
  138. moveDown(1)
  139. doplace()
  140. robot.select(2)
  141. moveDown(1)
  142. doplace()
  143. moveDown(1)
  144. doplace()
  145. robot.select(1)
  146. moveDown(1)
  147. doplace()
  148. moveDown(1)
  149. doplace()
  150. moveRight(1)
  151. doplace()
  152. moveUp(1)
  153. doplace()
  154. robot.select(2)
  155. moveUp(1)
  156. doplace()
  157. moveUp(1)
  158. doplace()
  159. robot.select(1)
  160. moveUp(1)
  161. doplace()
  162. moveUp(1)
  163. doplace()
  164. moveUp(1)
  165. doplace()
  166. moveRight(1)
  167. doplace()
  168. robot.select(2)
  169. moveDown(1)
  170. doplace()
  171. moveDown(1)
  172. doplace()
  173. robot.select(1)
  174. moveDown(1)
  175. doplace()
  176. robot.select(2)
  177. moveDown(1)
  178. doplace()
  179. moveDown(1)
  180. doplace()
  181. robot.select(1)
  182. moveDown(1)
  183. doplace()
  184. moveRight(1)
  185. doplace()
  186. moveUp(1)
  187. doplace()
  188. moveUp(1)
  189. doplace()
  190. moveUp(1)
  191. doplace()
  192. robot.select(2)
  193. moveUp(1)
  194. doplace()
  195. moveUp(1)
  196. doplace()
  197. robot.select(1)
  198. moveUp(1)
  199. doplace()
  200. moveRight(1)
  201. doplace()
  202. moveDown(1)
  203. doplace()
  204. moveDown(1)
  205. doplace()
  206. moveDown(1)
  207. doplace()
  208. moveDown(1)
  209. doplace()
  210. moveDown(1)
  211. doplace()
  212. moveDown(1)
  213. doplace()
  214. moveLeft(7)
  215. robot.setLightColor(0xFF0000) --red
  216. computer.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment