Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local moving = true
- local invPos = 1
- function verifyInv()
- if(robot.count(invPos) == 0) then
- invPos = invPos + 1
- if(invPos > (robot.inventorySize()) or robot.count(invPos) == 0) then
- return false
- end
- robot.select(invPos)
- end
- return true
- end
- function placeDown()
- local check = verifyInv()
- if(check) then
- local d1,d2 = robot.detectDown()
- if(not (d2 == "passable")) then
- robot.placeDown()
- end
- end
- return check
- end
- function placeUp()
- local check = verifyInv()
- if(check) then
- robot.placeUp()
- end
- return check
- end
- function placeForward()
- local check = verifyInv()
- if(check) then
- robot.place()
- end
- return check
- end
- while moving do
- moving = placeUp()
- if(not moving) then
- break
- end
- moving = placeDown()
- if(not moving) then
- break
- end
- moving = robot.back()
- if(not moving) then
- break
- end
- moving = placeForward()
- if(not moving) then
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment