Posted 02 January 2013 - 11:18 PM
hi, in
it asks for eof on line 119 (the last else) if I add a end there and press enter to get the else to next line it asks for one onn 118-What ends do I have wrong?? how to fix to make it run OK?
--[[Copyright Makerimages, all of the code here was made by makerimages and you may not distribute this code without written premission]]--
--set screen colours
term.clear()
term.setCursorPos(1,1)
term.setBackgroundColor(colors.lightBlue)
term.clear()
term.setBackgroundColor(colors.yellow)
local width=4
local size={term.getSize()}
for w=1,width do
term.setCursorPos(1,size[2]-w+1)
for x=1,size[1] do
write(' ')
end
end
--load apis and set more colors
term.setBackgroundColor(colors.lightBlue)
term.setCursorPos(1,3)
os.loadAPI("/APIS/mOSapi")
mOSapi.Logo()
sleep(5)
term.clear()
term.setBackgroundColor(colors.lightBlue)
term.clear()
term.setBackgroundColor(colors.yellow)
local width=4
local size={term.getSize()}
for w=1,width do
term.setCursorPos(1,size[2]-w+1)
for x=1,size[1] do
write(' ')
end
end
--check for user dir
term.clear()
term.setCursorPos(1,1)
term.setBackgroundColor(colors.lightBlue)
term.clear()
term.setBackgroundColor(colors.yellow)
local width=4
local size={term.getSize()}
for w=1,width do
term.setCursorPos(1,size[2]-w+1)
for x=1,size[1] do
write(' ')
end
end
term.setBackgroundColor(colors.lightBlue)
if not fs.exists("/mOS/Users") then
fs.makeDir("/mOS/Users")
term.setCursorPos(1,1)
print("Hang on! It seems that you do not have a user account set up yet! Lets do that now!")
print("Please select a Username: ")
repeat
term.setCursorPos(1,3)
term.clearLine()
write(" > ")
s_newName = read()
until s_newName ~= "" and not string.find(s_newName, " ")
print("Please, choose a password to use in order to protect your account:")
repeat
term.setCursorPos(1,6)
term.clearLine()
write(" > ")
s_newPassword = read("*")
until s_newPassword ~= "" and not string.find(s_newPassword, " ")
fileHandle = fs.open("/mOS/Users/"..s_newName,"w")
fileHandle.write(s_newPassword)
fileHandle.close() -- Always close a file after you're done with it.
os.reboot();
else
term.setBackgroundColor(colors.lightBlue)
term.clear()
term.setBackgroundColor(colors.yellow)
local width=4
local size={term.getSize()}
for w=1,width do
term.setCursorPos(1,size[2]-w+1)
for x=1,size[1] do
write(' ')
end
end
end
term.setBackgroundColor(colors.lightBlue)
term.setCursorPos(21,10)
print("Username:")
term.setCursorPos(21,11)
term.setBackgroundColor(colors.gray)
local loginname= read("")
if fs.exists("/mOS/Users" ..loginname) then
term.setBackgroundColor(colors.lightBlue)
term.setCursorPos(21,12)
print("Password:")
term.setCursorPos(21,13)
term.setBackgroundColor(colors.gray)
local loginpassword= read("*")
loginfile= fs.open("/mos/Users/" ..loginname,"a")
local filestuff={}
local line = loginfile.readLine() -- This function reads the next line in the file, until the end.
repeat -- Start a loop which will read lines into a table until no lines are left.
table.insert(filestuff,line) -- Puts the value of the current line into the table we have.
line = loginfile.readLine() -- read the next line
until line == nil -- readLine() returns nil when the end of the file is reached.
loginfile.close() -- Close up the file ready for use again.
if loginpassword==filestuff[1] then
term.setBackgroundColor(colors.lightBlue)
term.setCursorPos(21,14)
print("User found! Logging in")
sleep(2)
shell.run("/mos/OS")
end
end
else
term.setBackgroundColor(colors.lightBlue)
term.setCursorPos(21,14)
print("User not found, rebooting system!")
sleep(2)
os.reboot()
end
it asks for eof on line 119 (the last else) if I add a end there and press enter to get the else to next line it asks for one onn 118-What ends do I have wrong?? how to fix to make it run OK?