Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Bridge Segment building robot program
- local sides = require("sides")
- local event = require("event")
- local c = require("component")
- local computer = require("computer")
- local robot = c.robot
- local rs = c.redstone
- local chu = c.chunkloader
- local function moveUp(amount)
- local move = amount
- while move > 0 do
- robot.move(sides.up)
- move = move - 1
- end
- end
- local function moveDown(amount)
- local move = amount
- while move > 0 do
- robot.move(sides.down)
- move = move - 1
- end
- end
- local function moveLeft(amount)
- local move = amount
- robot.turn(false)
- while move > 0 do
- robot.move(sides.front)
- move = move - 1
- end
- robot.turn(true)
- end
- local function moveRight(amount)
- local move = amount
- robot.turn(true)
- while move > 0 do
- robot.move(sides.front)
- move = move - 1
- end
- robot.turn(false)
- end
- local function moveForward(amount)
- local move = amount
- while move > 0 do
- robot.move(sides.front)
- move = move - 1
- end
- end
- local function moveBack(amount)
- local move = amount
- while move > 0 do
- robot.move(sides.back)
- move = move - 1
- end
- end
- local function oneeighty()
- robot.turn(true)
- robot.turn(true)
- end
- local function place()
- robot.place(sides.front)
- end
- local function doplace()
- place()
- oneeighty()
- place()
- oneeighty()
- end
- robot.select(1)
- robot.setLightColor(0x00DB00) --green
- doplace()
- moveUp(1)
- doplace()
- moveUp(1)
- doplace()
- moveLeft(1) -- Left supporting arm
- doplace()
- moveLeft(1)
- doplace()
- moveLeft(1)
- doplace()
- moveLeft(1)
- doplace()
- moveUp(1)
- doplace()
- moveUp(1)
- doplace()
- moveLeft(1) -- Leftmost track support
- doplace()
- moveLeft(1)
- doplace()
- moveLeft(1)
- doplace()
- moveLeft(1)
- doplace()
- moveRight(5) -- Left track support
- doplace()
- moveRight(1)
- doplace()
- moveRight(1)
- doplace()
- robot.select(2)
- moveRight(1)
- doplace()
- moveDown(1)
- doplace()
- moveDown(1)
- moveRight(1) -- Right supporting arm
- doplace()
- moveRight(1)
- doplace()
- moveRight(1)
- doplace()
- moveRight(1)
- doplace()
- moveUp(1)
- doplace()
- moveUp(1)
- doplace()
- moveRight(1) -- Rightmost track support
- doplace()
- moveRight(1)
- doplace()
- moveRight(1)
- doplace()
- moveRight(1)
- doplace()
- moveLeft(5) -- Right track support
- doplace()
- moveLeft(1)
- doplace()
- moveLeft(1)
- doplace()
- moveLeft(1)
- doplace()
- moveUp(1) -- Place final post in the center and stop
- robot.place(sides.down)
- robot.setLightColor(0xFF0000) --red
- computer.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment