LazerAio

ARE

Mar 14th, 2022 (edited)
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. rednet.open("top")
  2. args = {...}
  3. term.setBackgroundColor(colors.lightGray)
  4. term.setTextColor(colors.white)
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. print("ARE V1")
  8. if #args == 0 then
  9. print("Relay/Node?")
  10. SITE = tonumber(read())
  11. else
  12. SITE = tonumber(args[1])
  13. end
  14. if SITE == nil then
  15. print("INVALID SITE")
  16. else
  17. print("CONNECTING")
  18. sleep(0.25)
  19. rednet.send(SITE,"PING")
  20. while true do
  21. rednet.send(SITE,"PING")
  22. term.setBackgroundColor(colors.lightGray)
  23. term.setTextColor(colors.black)
  24. term.setCursorPos(1,1)
  25. term.clear()
  26. RID,RMSG = rednet.receive(3)
  27. if RID == SITE then
  28. if RMSG == nil then
  29. term.setBackgroundColor(colors.lightGray)
  30. term.setTextColor(colors.orange)
  31. term.clear()
  32. term.setCursorPos(1,1)
  33. print("CONNECTION REFUSED")
  34. print("204")
  35. sleep(1)
  36. break
  37. elseif RMSG == "401" then
  38. term.setBackgroundColor(colors.lightGray)
  39. term.setTextColor(colors.orange)
  40. term.clear()
  41. term.setCursorPos(1,1)
  42. print("CONNECTION REFUSED")
  43. print("401")
  44. elseif RMSG == "101" then
  45. nilCount = 0
  46. FC = 0
  47. while true do
  48. sleep(0)
  49. RID,RMSG = rednet.receive(0)
  50. if RID == SITE then
  51. print(RMSG)
  52. elseif RID == nil then
  53. nilCount = nilCount + 1
  54. if nilCount == 200 then
  55. term.setBackgroundColor(colors.lightGray)
  56. term.setTextColor(colors.orange)
  57. term.clear()
  58. print("CONNECTION TIMEDOUT")
  59. print("408")
  60. break
  61. end
  62. end
  63. end
  64. else
  65. print(RMSG)
  66. sleep(1)
  67. end
  68. elseif RID == nil then
  69. term.setBackgroundColor(colors.lightGray)
  70. term.setTextColor(colors.orange)
  71. term.clear()
  72. term.setCursorPos(1,1)
  73. print("CONNECTION FAILED")
  74. print("404")
  75. sleep(1)
  76. --FC = FC + 1
  77. if FC == 3 then
  78. break
  79. end
  80. end
  81. end
  82. end
Add Comment
Please, Sign In to add comment