karelvysinka

Turtle modem recieve message

Dec 26th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. local modem = peripheral.wrap("left")
  2. modem.open(3)  -- Open channel 3 so that we can listen on it
  3. local event, modemSide, senderChannel,
  4.   replyChannel, message, senderDistance = os.pullEvent("modem_message")
  5.  
  6. print("I just received a message on channel: "..senderChannel)
  7. print("I should apparently reply on channel: "..replyChannel)
  8. print("The modem receiving this is located on my "..modemSide.." side")
  9. print("The message was: "..message)
  10. print("The sender is: "..(senderDistance or "an unknown number of").." blocks away from me.")
  11.  
  12.  
  13.  
  14.  
  15. local modem = peripheral.wrap("left")
  16. modem.open(3)  -- Open channel 3 so that we can listen on it
  17. local event, modemSide, senderChannel,
  18.   replyChannel, message, senderDistance = os.pullEvent("modem_message")
  19.  
  20. print("I just received a message on channel: "..senderChannel)
  21. print("I should apparently reply on channel: "..replyChannel)
  22. print("The modem receiving this is located on my "..modemSide.." side")
  23. print("The message was: "..message)
  24. print("The sender is: "..(senderDistance or "an unknown number of").." blocks away from me.")
Add Comment
Please, Sign In to add comment