Here is the code:
homepage = "home";
website = "home";
nw = "";
rednet.open("right")
id, message = rednet.receive(10)
if message == "www." ..nw.. ".com" then -- If someone tries to connect, it will send back the website
rednet.send(id, "site")
end
function home()
print("Welcome to RedNet explorer! This requires you to have a wireless modem on the right side of your computer. This is the default homepage. A homepage option might be added in 1.2")
print("Host a website at: ")
print("www.newsite.com! ")
print(" -ComputerCraftFan11 ")
end
function newsite()
local function cPrint(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
cPrint("Rednet Site Manager")
print("")
print("Welcome to the rednet site manager!")
print("To make a new website, enter a domain name (.com will be added for you.):")
end
function newsite2()
local function cPrint(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
cPrint("Rednet Site Manager")
print("")
print("People can connect to this site by going to www." ..nw.. ".com")
print("You can edit this site by going to www." ..nw.. ".com/editor")
end
function loadwebpage() -- gonna change this when the bug is fixed
print (message)
end
function drawScreen()
term.clear()
term.setCursorPos(1,1)
local function cPrint(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
cPrint("Rednet Explorer 1.1")
local function cPrint(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
cPrint("rdnt://"..website)
print("")
if website == "home" then
home()
elseif website == "www.newsite.com" then
newsite()
elseif website == "www.newsite.com/nsite/index.php?/" then
newsite2()
else
loadwebpage()
end
print("")
if website == "www.newsite.com" then
write("www.")
nw = read()
newsite = nw
website = "www.newsite.com/nsite/index.php?/"
else
write("Goto:")
address = read()
website = address
rednet.send(5, website)
end
drawScreen()
end
drawScreen()
I don't get a error and I dont know whats wrong. Please help