lego11

Untitled

Oct 12th, 2017
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local homepage = "home";
  2. local website = "home";
  3. local nw = "";
  4. local idd = os.computerID()
  5. local port1 = idd * 32
  6. local port2 = 0
  7. local port3 = port2 / 32
  8. local needport = 0
  9. rednet.open("top")
  10. local function cPrint(text)
  11. local x,y = term.getSize()
  12. local x2,y2 = term.getCursorPos()
  13. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  14. print(text)
  15. end
  16. function home()
  17. print("Welcome to RedNet explorer! This requires you to have a wireless modem on your computer.")
  18. print("Host a website at: ")
  19. print("www.newsite.com! ")
  20. print(" (C) Lego11 Systems ")
  21. needport = 0
  22. end
  23. function newsite()
  24. if fs.exists("rns") then
  25. shell.run("rns")
  26. else
  27. shell.run("pastebin", "get", "fudh9SKL", "rns")
  28. shell.run("rns")
  29. end
  30. end
  31. function newsite2()
  32. cPrint("Rednet Site Manager")
  33. print("")
  34. print("People can connect to this site by going to www." ..nw.. ".com")
  35. print("You can edit this site by going to www." ..nw.. ".com/editor")
  36. print("Your port is " ..port1)
  37. needport = 0
  38. end
  39. function drawEditor()
  40. print("Welcome to the site editor! Enter some text and it will be displayed when people connect.")
  41. print("---")
  42. line1 = read()
  43. line2 = read()
  44. line3 = read()
  45. line4 = read()
  46. line5 = read()
  47. rednet.send(id, "Editor " ..website)
  48. rednet.send(id, line1)
  49. rednet.send(id, line2)
  50. rednet.send(id, line3)
  51. rednet.send(id, line4)
  52. rednet.send(id, line5)
  53. print("---")
  54. print("Saved!")
  55. sleep(1)
  56. website = homepage
  57. drawScreen()
  58. end
  59. function loadwebpage()
  60. rednet.broadcast(website)
  61. print("Connecting...")
  62. id, message = rednet.receive()
  63. term.clear()
  64. term.setCursorPos(1,1)
  65. cPrint("Rednet Explorer 1.3")
  66.  
  67. cPrint("rdnt://"..website)
  68. print("")
  69. if message == "epanst" then
  70. drawEditor()
  71. else
  72. print(message)
  73. id, message = rednet.receive()
  74. print(message)
  75. id, message = rednet.receive()
  76. print(message)
  77. id, message = rednet.receive()
  78. print(message)
  79. id, message = rednet.receive()
  80. print(message)
  81.  
  82. print("")
  83.  
  84. write("Goto:")
  85. address = io.read()
  86. website = address
  87. drawScreen()
  88. end
  89. end
  90. function drawScreen()
  91. term.clear()
  92. term.setCursorPos(1,1)
  93. cPrint("Rednet Explorer 1.3")
  94.  
  95. cPrint("rdnt://"..website)
  96. print("")
  97.  
  98. if website == "home" then
  99. home()
  100. elseif website == "www.newsite.com" then
  101. newsite()
  102. end
  103.  
  104.  
  105. print("")
  106.  
  107. write("Goto:")
  108. address = io.read()
  109. website = address
  110. needport = 1
  111. if website == "home" then
  112. drawScreen()
  113. elseif website == "www.newsite.com" then
  114. drawScreen()
  115. else
  116. loadwebpage()
  117. end
  118. end
  119. drawScreen()
Advertisement
Add Comment
Please, Sign In to add comment