Advertisement
Guest User

Untitled

a guest
May 9th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. local robot = require("robot")
  2. local computer = require("computer")
  3. local sides = require("sides")
  4. local component = require("component")
  5. local ser = require("serialization")
  6.  
  7. local c = component.crafting
  8. local inventory = component.inventory_controller
  9.  
  10.  
  11.  
  12. local left = robot.turnLeft()
  13. local right = robot.turnRight()
  14. local TURN = robot.turnAround()
  15. local d = robot.detect()
  16. local dUp = robot.detectUp()
  17. local dDown = robot.detectDown()
  18.  
  19.  
  20. print(robot.detect())
  21.  
  22.  
  23. -- Functions for movements
  24.  
  25. local function goUp()
  26.   while dUp do
  27.     robot.swingUp()
  28.     os.sleep(2)
  29.   end
  30.   robot.up()
  31.   os.sleep(0.8)
  32. end
  33.  
  34. local function goDown()
  35.   while dDown do
  36.     robot.swingDown()
  37.     os.sleep(2)
  38.   end
  39.   robot.down()
  40.   os.sleep(0.8)
  41. end
  42.  
  43. local function go()
  44.   while d do
  45.     robot.swing()
  46.     os.sleep(2)
  47.   end
  48.   robot.forward()
  49.   os.sleep(0.8)
  50. end
  51.  
  52.  
  53.  
  54. -- Place Blocks with Dev/ Null
  55.  
  56. local function Bf()
  57.     if d then
  58.         robot.select(13)
  59.         robot.place()
  60.     end
  61. end
  62.  
  63. local function Bd()
  64.     if dDown then
  65.         robot.select(13)
  66.         robot.placeDown()
  67.     end
  68. end
  69.  
  70. local function Bu()
  71.     if dUp then
  72.         robot.select(13)
  73.         robot.placeUp()
  74.     end
  75. end
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. -- Movement script
  83.  
  84. local function Movement()
  85. Bd() ; go()
  86. Bd() ; left ; go() ; Bf() ; Bd() ; TURN ; go() ; go() ; Bd() ; Bf() ; goUp()
  87. Bf() ; TURN ; go() ; go() ; Bf() ; goUp()
  88. Bf() ; Bu() ; TURN ; go() ; Bu() ; go() ; Bf() ; Bu()
  89. TURN ; go() ; goDown() ; goDown() ; right
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement