Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component = require "component"
- modem = component.modem
- event = require "event"
- robot = require "robot"
- modem.open(8267)
- while true do
- local _, _, from, port, _, message = event.pull("modem_message")
- if message == "Forward" then
- _, output = robot.forward()
- elseif message == "Turn Right" then
- _, output = robot.turnRight()
- elseif message == "Turn Left" then
- _, output = robot.turnLeft()
- elseif message == "Backward" then
- _, output = robot.back()
- elseif message == "Up" then
- _, output = robot.up()
- elseif message == "Down" then
- _, output = robot.down()
- elseif message == "Succ" then
- robot.suck()
- elseif message == "Drop" then
- robot.drop()
- elseif message == "Place" then
- robot.place()
- elseif message == "Swing" then
- robot.swing()
- elseif message == "Equip" then
- component.inventory_controller.equip()
- elseif message == "Swing Up" then
- robot.swingUp()
- elseif message == "Swing Down" then
- robot.swingDown()
- elseif message == "Turn Around" then
- robot.turnAround()
- elseif string.sub(message, 1, 15) == "Inv Slot Change" then
- slot = string.sub(message, 16, -1)
- robot.select(tonumber(slot))
- else print("Invalid Command")
- end
- if output then
- modem.broadcast(8268, output)
- end
- print("Got a message from " .. from .. " on port " .. port .. ": " .. tostring(message))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement