Advertisement
DevilTvLP

openComputersTunnel

Jun 17th, 2018 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local os = require("os")
  2. local robot = require("robot")
  3. local term = require("term")
  4.  
  5. function doX(x, f)
  6.   i = 0
  7.   while i<x do
  8.     f()
  9.     i = i+1
  10.   end
  11. end
  12. function forward()
  13.   while not robot.forward() do
  14.     robot.swing()
  15.     os.sleep(0.2)
  16.   end
  17. end
  18. function go()
  19.   forward()
  20.   if not robot.detectDown() then
  21.     robot.placeDown()
  22.   end
  23.   robot.swingUp()
  24. end
  25.  
  26. function doStructure()
  27.   go()
  28.   robot.turnRight()
  29.   go()
  30.   robot.turnLeft()
  31.   robot.turnLeft()
  32.   go()
  33.   go()
  34.   robot.turnRight()
  35.   robot.turnRight()
  36.   go()
  37.   robot.turnLeft()
  38. end
  39.  
  40. --program start
  41. print("Please make sure to put Cobblestone in first Robot slot")
  42. print("Count: ")
  43. count = tonumber(term.read())
  44. --doX(5, doStructure)
  45. n = 0
  46. while n<count do
  47.   doStructure()
  48.   n = n+1
  49.   term.clear()
  50.   print(n)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement