Posted 28 May 2014 - 05:50 AM
I'm writing a password program to unlock a computer, and I am modelling it after the RobCo Termlink from Fallout. I want the user to be able to enter the password after a '>' purely for aesthetics. The program will run right until I hit enter to submit the password, after which i get the error 'io:10: unsupported format.' The only thing of line 10 is a function to centre text that I found on the forum. Is putting the '>' before the password entry screwing the program up?
Code:
Code:
Spoiler
password = "yourpasshere"
ovr = "vaulttecovr"
hack = "set terminal/inquire"
function header()
print("WELCOME TO ROBCO INDUSTRIES (TM) TERMLINK")
print(" ")
end
function centerText(text)
x,y = term.getSize()
x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
write(text)
end
function command()
io.write("> ")
cmd = io.read()
if cmd == "logon admin" then
print(" ")
print("ENTER PASSWORD NOW")
print(" ")
write("> ")
pass = io.read("*")
if pass == password then
term.clear()
term.setCursorPos(1,1)
-- shell.run("TERMPROGRAMHERE")
centerText("ROBCO INDUSTRIES UNIFIED OPERATING SYSTEM")
centerText("COPYRIGHT 2075-2077 ROBCO INDUSTRIES")
centerText("-Server 1-")
print(" ")
sleep(1)
else
print(" ")
print("INVALID PASSWORD")
sleep(2)
os.shutdown()
end
elseif cmd == ovr then
-- end program
elseif cmd == hack then
-- shell.run("hack")
else
print(" ")
print("INVALID COMMAND")
sleep(2)
command()
end
end
-- main code
header()
command()