Advertisement
IzdiharTEAM17

MCMESSENGER 1.0

Mar 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. settings.set(username,"RedTropics")
  2. term.clear()
  3.  
  4. local modem = peripheral.wrap("top")
  5. modem.open(3)
  6.  
  7. function WriteMessageFromOtherPlayer(message)
  8.     term.setCursorPos(1,3)
  9.     term.setBackgroundColor(colors.black)
  10.     term.setTextColor(colors.yellow)
  11.     term.write("You receive a message:")
  12.    
  13.     term.setCursorPos(1,4)
  14.     term.setBackgroundColor(colors.black)
  15.     term.setTextColor(colors.white)
  16.     term.write(message)
  17. end
  18.  
  19. while true do
  20.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  21.     term.setCursorPos(1,1)
  22.     term.setBackgroundColor(colors.gray)
  23.     term.setTextColor(colors.white)
  24.     local MessageInput = read()
  25.    
  26.     WriteMessageFromOtherPlayer(message)
  27.     if message then
  28.         modem.transmit(7, 3, "Hello world!")
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement