Advertisement
Solomeister

witherbot v0.1a

Aug 13th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. local robot = require("robot")
  2. local computer = require("computer")
  3. local inv = require("component").inventory_controller
  4.  
  5. function go()
  6.     if robot.detect() == false then
  7.         robot.forward()
  8.     else
  9.         os.sleep(.1)
  10.         go()
  11.     end
  12. end
  13.  
  14. function down()
  15.     if robot.detectDown() == false then
  16.         robot.down()
  17.     else
  18.         os.sleep(.1)
  19.         down()
  20.     end
  21. end
  22.    
  23. function up()
  24.     if robot.detectUp() == false then
  25.         robot.up()
  26.     else
  27.         os.sleep(.1)
  28.         up()
  29.     end
  30. end
  31. while (true) do
  32.    
  33.    
  34.     robot.select(2)
  35.     while (robot.count() < 3) do
  36.         computer.beep(2000, 0.1)
  37.         os.sleep(0.5)
  38.     end
  39.  
  40.    
  41.     robot.select(1)
  42.     robot.place()
  43.     up()
  44.     robot.place()
  45.     robot.turnLeft()
  46.     go()
  47.     robot.turnRight()
  48.     robot.place()
  49.     robot.turnRight()
  50.     go()
  51.     go()
  52.     robot.turnLeft()
  53.     robot.place()
  54.     up()
  55.     robot.select(2)
  56.     robot.place()
  57.     robot.turnLeft()
  58.     go()
  59.     robot.turnRight()
  60.     robot.place()
  61.     robot.turnLeft()
  62.     go()
  63.     robot.turnRight()
  64.     robot.place()
  65.     robot.turnRight()
  66.     go()
  67.     while robot.detectDown() == false do
  68.         down()
  69.     end
  70.     robot.turnLeft()
  71.    
  72.     os.sleep(6)
  73.         while robot.swing() do
  74.             robot.swing()
  75.         end
  76.     robot.select(2)
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement