Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local comp = require("computer")
- function jack()
- while robot.detect() do
- if not robot.up() then
- robot.swingUp()
- robot.up()
- end
- end
- while not robot.detectDown() do
- robot.down()
- robot.swing()
- end
- robot.place()
- robot.up()
- end
- function unload()
- robot.turnAround()
- robot.down()
- for c = 2, 16 do
- robot.select(c)
- if robot.count() > 0 then
- robot.drop()
- end
- end
- robot.select(1)
- robot.up()
- robot.turnAround()
- end
- while true do
- robot.up()
- if robot.detect() then
- jack()
- if robot.count(2) == 64 then
- unload()
- end
- end
- robot.down()
- if comp.energy() < 10 then
- print("Error! Low energy level.")
- break
- end
- os.sleep(15)
- end
Add Comment
Please, Sign In to add comment