Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local followChannel = 14
- local followRespChannel = 15
- local modem = peripheral.wrap("right")
- modem.open(followChannel)
- commands = {
- follow_Up = function()
- turtle.up()
- end,
- follow_Down = function()
- turtle.down()
- end,
- follow_Forward = function()
- turtle.forward()
- end,
- follow_Backward = function()
- turtle.back()
- end,
- follow_Left = function()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end,
- follow_Right = function()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end,
- }
- while true do
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- print(message)
- if string.find(string.lower(message), "follow_") then
- --if ( (string.len(op.name) > 7) and (string.find(op.name, "follow_", nil, true) ~= nil) ) then
- commands[message]()
- modem.transmit(followRespChannel ,followChannel ,"Following OK")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement