Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local commands = {"CIRCLE", "MINE"}
- local function connectModem(port)
- local modem = peripheral.wrap("right")
- modem.open(port)
- modem.transmit(port, port, "logged on turtle")
- return modem
- end
- local function getMessages()
- while (true)
- do
- local event, modemSide, senderChannel,
- replyChannel, message, senderDistance = os.pullEvent("modem_message")
- print(senderChannel,":",message)
- executeMessage(message)
- end
- end
- function executeMessage(message)
- if message == "CIRCLE" then
- circle()
- end
- if message == "MINE" then
- mine()
- end
- if message == "STOP" then
- stop()
- end
- if message == "INFO" then
- info()
- end
- end
- function circle()
- for i = 4,1,-1
- do
- turtle.forward()
- turtle.turnLeft()
- end
- end
- function mine()
- shell.run("excavate 10")
- end
- function info()
- for j = 16, 0, -1
- do
- modem.transmit(5, 5, turtle.getItemDetail(j),"\n",turtle.getItemCount(j)
- end
- end
- function stop()
- os.exit()
- end
- modem = connectModem(5)
- getMessages()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement