Advertisement
Andersfc

strAymail

Nov 24th, 2012
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. --Pastebin: "5CUaFcqL"
  2. --A=Alpha, B=Beta, F=Finished
  3. --This version is: A1
  4. shell.run("clear")
  5. rednet.close("right")
  6. rednet.close("left")
  7. rednet.close("top")
  8. rednet.close("bottom")
  9. rednet.close("front")
  10. rednet.close("back")
  11.  
  12. if peripheral.isPresent("right") then
  13. rednet.open("right")
  14. end
  15. if peripheral.isPresent("left") then
  16. rednet.open("left")
  17. end
  18. if peripheral.isPresent("top") then
  19. rednet.open("top")
  20. end
  21. if peripheral.isPresent("bottom") then
  22. rednet.open("bottom")
  23. end
  24. if peripheral.isPresent("front") then
  25. rednet.open("front")
  26. end
  27. if peripheral.isPresent("back") then
  28. rednet.open("back")
  29. end
  30.  
  31. local Checking = 0
  32.  
  33. function Send()
  34.  
  35. term.write("Which message?>")
  36. A = read()
  37. rednet.broadcast(A)
  38.  
  39. end
  40.  
  41. function Receive()
  42.  
  43. Pas = 0
  44. term.write("How many times? <once> or <forever>")
  45. A12 = read()
  46.  
  47. if A12 == "once" then
  48.  
  49. x,y,z=rednet.receive()
  50. print(y)
  51.  
  52. end
  53.  
  54. if A12 == "forever" then
  55. while Pas == 0 do
  56.  
  57. x,y,z=rednet.receive()
  58. print(y)
  59.  
  60. end
  61. end
  62. end
  63.  
  64. function AndersMail()
  65.  
  66. term.write("Which mode? <receive> or <send>")
  67. Amail = read()
  68.  
  69. if Amail == "receive" then
  70. Receive()
  71. Checking = Checking+1
  72. end
  73. if Amail == "send" then
  74. Send()
  75. Checking = Checking+1
  76. end
  77. if Checking == 0 then
  78. print("Error: Invalid mode...")
  79. end
  80. end
  81.  
  82. AndersMail()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement