Advertisement
Jeyjey0

Untitled

Sep 7th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. rednet.open("top")
  2. if not fs.exists("browserid") then
  3. print("pls enter Server Browserid")
  4. serverid = tonumber(read())
  5. local fileHandle = fs.open ("browserid", 'w')
  6. fileHandle.write (textutils.serialize (serverid))
  7. fileHandle.close()
  8. end
  9. if fs.exists("browserid") then
  10. local fileopen = fs.open ("browserid", 'r')
  11. servid = textutils.unserialize (fileopen.readAll())
  12. fileopen.close()
  13. term.clear()
  14. term.setCursorPos(8,8)
  15. print("Enter Website:")
  16. term.setCursorPos(24, 8)
  17. website = read()
  18. if website == "exit" then
  19. shell.run("reboot")
  20. else
  21. rednet.send(servid,website)
  22. if fs.exists(website) then
  23. term.clear()
  24. term.setCursorPos(1, 1)
  25. shell.run(website)
  26. error()
  27. end
  28. if website == "" then
  29. shell.run(shell.getRunningProgram())
  30. end
  31. if not fs.exists(tostring(website)) then
  32. code = 1
  33. function load()
  34. while true do
  35. local id, message = rednet.receive()
  36. if message == "Wbn" then
  37. term.clear()
  38. print("Website not found ")
  39. sleep(1)
  40. shell.run(shell.getRunningProgram())
  41. end
  42. if message == "Wbn" == false then
  43. print("Website found!")
  44. sleep(1)
  45. function installer()
  46. shell.run(message)
  47. end
  48. function clearer()
  49. for i =0,5 do
  50. sleep(0.1)
  51. term.clear()
  52. term.setCursorPos(1, 1)
  53. end
  54. end
  55. parallel.waitForAll(clearer,installer)
  56. clearer()
  57. shell.run(website)
  58. error()
  59. end
  60. if not fs.exists(website) then
  61. term.clear()
  62. print("Failed to connect to website")
  63. sleep(1)
  64. shell.run(shell.getRunningProgram())
  65. end
  66. end
  67. if fs.exists(tostring(website)) then
  68. shell.run(website)
  69. error()
  70. end
  71. end
  72. end
  73. function connection()
  74. while true do
  75. if code >= 1 then
  76. code = code + 1
  77. if code >30 then
  78. term.clear()
  79. term.setCursorPos(1, 1)
  80. print("Server is down or exitst")
  81. sleep(1)
  82. shell.run(shell.getRunningProgram())
  83. code = 0
  84. end
  85. end
  86. end
  87. end
  88. end
  89. parallel.waitForAll(load,connection)
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement