Sivarias

CC_Compy_!chat

Oct 10th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. --!chat
  2. --This is for simple emailing from computers
  3. local ID, sent, type
  4.  
  5. function recieve()
  6. while true do
  7. event, side, channel, replychannel, message, distance=os.pullEvent("modem_message")
  8. print("Message from Computer ID: "..replychannel.." from "..distance.." blocks away!")
  9. print(message)
  10. end
  11. end
  12.  
  13. function send()
  14. while true do
  15. print("Public Message=1, Private Message=0")
  16. type=read()
  17. if type=="0" then
  18. repeat
  19. print("What ID would you like to send it to?")
  20. ID=tonumber(read())
  21. until ID
  22. else
  23. ID=100
  24. end
  25. print("What would you like to say?")
  26. sent=read()
  27. modem.transmit(ID, os.getComputerID(), sent)
  28. end
  29. end
  30.  
  31. parallel.waitForAny(recieve,send)
Advertisement
Add Comment
Please, Sign In to add comment