This programm will save the passwords you type in, when first run on your Computer.
The rest is self explaining.
This is copied from our PasteBin upload:
http://pastebin.com/bagM6FhK
-
local pullEvent = os.pullEvent -
os.pullEvent = os.pullEventRaw -
function clear() -
term.setCursorPos(1,1) -
term.clear() -
end -
clear() -
local setpass --for setting the password -
local adminpass -- for setting the admin password -
local opentime -- for setting how long the door will stay open -
local rootpass -- for setting the rootpass -
local redstoneOutputSide -
local args = {...} -
if fs.exists("doorlock-settings") and args[1] ~= "reset" then -
local f = fs.open("doorlock-settings", "r") -
setpass = f.readLine() -
adminpass = f.readLine() -
rootpass = f.readLine() -
opentime = tonumber(f.readLine()) -
redstoneOutputSide = f.readLine() -
f.close() -
else -
print("Please define the password to gain access to the door:") -
setpass = read("*") -
clear() -
print("Please define the password to gain root access to the computer(to edit files):") -
rootpass = read("*") -
clear() -
print("Please define the admin password. This password will keep the door open when entered") -
adminpass = read("*") -
clear() -
print("Please define the amount of time the redstone pulse will be on:") -
opentime = tonumber(read()) -
clear() -
local vside = false -
while true do -
print("Which side is the door on?") -
redstoneOutputSide = read() -
for k,v in pairs(rs.getSides()) do -
if v == redstoneOutputSide then -
vside = true -
break -
end -
end -
if vside then break end -
print("Invalid side!") -
sleep(0.5) -
clear() -
end -
local f = fs.open("doorlock-settings", "w") -
f.writeLine(setpass) -
f.writeLine(adminpass) -
f.writeLine(rootpass) -
f.writeLine(tostring(opentime)) -
f.writeLine(redstoneOutputSide) -
f.close() -
end -
while true do -
clear() -
print ("Loading...") -
print ("Done Loading!") -
sleep(1) -
term.clear() -
term.setCursorPos(1,1) -
write "Passcode: " -
input = read("*") -
if input == setpass then -
print ("Access Granted for " .. tostring(opentime) .. " seconds, better hurry!") -
rs.setOutput(redstoneOutputSide, true) -
sleep(opentime) -
rs.setOutput(redstoneOutputSide, false) -
os.shutdown() -
elseif input == adminpass then -
print ("Door will remain open, remember to close!") -
rs.setOutput(redstoneOutputSide, true) -
while true do -
term.clear() -
write "Passcode: " -
input2 = read("*") -
if input2 == adminpass then -
rs.setOutput(redstoneOutputSide, false) -
os.shutdown() -
break -
end -
end -
elseif input == rootpass then -
textutils.slowPrint ("Welcome, you may now edit the programs/files on this computer!") -
term.clear() -
os.pullEvent = pullEvent -
print ("Root permissions enabled") -
return -
else -
print ("Uhhm... Wrong password..") -
sleep(2) -
os.shutdown() -
end -
end












