Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ startup
- id="GLMmkuJ3"
- loadstring(http.get("http://pastebin.com/raw.php?i=" .. id).readAll())()
- ]]--
- eng = false
- connected = false
- modem = false
- myChannel = 6636
- monitorChannel = 6637
- for a,b in pairs(rs.getSides()) do
- if peripheral.getType(b) == 'modem' then
- print("Found modem on " .. b .. ", attaching to " .. myChannel)
- print("Hold CTRL-T for one second to stop, CTRL-R to reboot and update.")
- modem = peripheral.wrap(b)
- modem.open(myChannel)
- connected = true
- elseif (peripheral.getType(b) == 'carriage') then
- print("Found carriage on " .. b .. ".")
- eng = peripheral.wrap(b)
- end
- end
- while connected do
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- print("Got message " .. message)
- local monitormsg = false
- local direction = false
- if (message == "break") then
- connected = false
- monitormsg = "Told to stop."
- break
- elseif (message == "move.down") then
- monitormsg = "Moved down."
- direction = 0
- elseif (message == "move.up") then
- monitormsg = "Moved up."
- direction = 1
- elseif (message == "move.north") then
- monitormsg = "Moved north."
- direction = 2
- elseif (message == "move.south") then
- monitormsg = "Moved south."
- direction = 3
- elseif (message == "move.west") then
- monitormsg = "Moved west."
- direction = 4
- elseif (message == "move.east") then
- monitormsg = "Moved east."
- direction = 5
- end
- if (direction ~= false) then
- eng.move(direction, false, false)
- end
- if (monitormsg) then
- modem.transmit(monitorChannel,myChannel,monitormsg)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement