Guest User

Untitled

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