theMCcm

theMCcm's EnderChat -EXTREMELY SIMPLE-

Jun 26th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. print("What Side Is Your Modem On?")
  4. term.write("Side: ")
  5. input = read()
  6. rednet.open(tostring(input))
  7.  
  8. term.clear()
  9. term.setCursorPos(1,1)
  10.  
  11. term.write("Connect To Which Computer?: ")
  12. connection = read()
  13.  
  14. term.clear()
  15. term.setCursorPos(1,1)
  16.  
  17. term.write("Whats Your UserName?: ")
  18. user = read()
  19. tostring(user)
  20.  
  21. term.clear()
  22. term.setCursorPos(1,1)
  23.  
  24. print("Youre Connected To Computer: "..connection)
  25. print("Type 's' To Send A Msg, And 'e' To Exit The Program!")
  26.  
  27. while true do
  28. local ev, param, msg, dist = os.pullEvent()
  29. if ev == "rednet_message" then
  30. if param ~= connection then
  31. print("This Msg Comes From Computer "..param)
  32. end
  33. print(msg)
  34. end
  35. if ev == "key" then
  36. if param == 31 then
  37. term.write("Msg: ")
  38. text = read()
  39. tostring(text)
  40. if text == "clear" or text == "Clear" then
  41. shell.run("clear")
  42. elseif text ~= "clear" or text ~= "Clear" then
  43. rednet.send(tonumber(connection), user..": "..text)
  44. end
  45. elseif param == 18 then
  46. print("Exiting . . .")
  47. sleep(0.5)
  48. term.clear()
  49. term.setCursorPos(1,1)
  50. print("Exited")
  51. break
  52. end
  53. end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment