Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pullEvent = os.pullEvent
- local pass1 = "MASTER"
- local pass2 = "ADMIN"
- local pass3 = "PERSONNEL"
- local pass4 = "GUEST"
- local opentime = 4
- local pause = 3
- local access = 2
- local h = fs.open("/securityVariables", "r")
- local access = tonumber(h.readLine())
- h.close()
- local h = fs.open("/clearanceVariables", "r")
- local input = h.readLine()
- h.close()
- os.pullEvent = os.pullEventRaw
- term.clear()
- term.setCursorPos(1,1)
- if input == pass1 then
- term.clear()
- print("Type OPEN or PERMS, or END to Terminate program")
- local command = read()
- if command =="OPEN" then
- shell.run("eject left")
- shell.run("eject right")
- term.clear()
- print("Opening door")
- redstone.setOutput("back", true)
- sleep(opentime)
- redstone.setOutput("back", false)
- elseif command =="END" then
- term.clear()
- print("Type [EXIT] to terminate program, or [BACK] to return to the login.")
- local ender = read()
- if ender == "BACK" then
- term.clear()
- print("Returning to login")
- sleep(pause)
- elseif ender == "EXIT" then
- term.clear()
- print("Exiting ID Badge Program.")
- sleep(pause)
- error()
- else
- term.clear()
- print("That was not a valid command, returnign to login.")
- sleep(pause)
- end
- os.pullEvent = pullEvent
- elseif command =="PERMS" then
- print("[NONE], [MODERATE], or [STRICT]")
- local level = read()
- if level =="NONE" then
- access = 0
- h = fs.open("/securityVariables", "w")
- h.writeLine(access)
- h.close()
- term.clear()
- print("Access now open to anyone with an ID card")
- elseif level =="MODERATE" then
- access = 1
- h = fs.open("/securityVariables", "w")
- h.writeLine(access)
- h.close()
- term.clear()
- print("Access now open to Personnel, facility administrators and the MASTER id card")
- elseif level =="STRICT" then
- access = 2
- h = fs.open("/securityVariables", "w")
- h.writeLine(access)
- h.close()
- term.clear()
- print("Access now limited to facility administrators and the MASTER id card")
- else
- access = 2
- h = fs.open("/securityVariables", "w")
- h.writeLine(access)
- h.close()
- term.clear()
- print("That was not an access level. Setting access level to STRICT")
- sleep(pause)
- end
- else
- term.clear()
- print("You put in something that was not a command")
- sleep(pause)
- end
- elseif input == pass2 then
- shell.run("eject left")
- shell.run("eject right")
- term.clear()
- print("Opening door")
- redstone.setOutput("back", true)
- sleep(opentime)
- redstone.setOutput("back", false)
- elseif input == pass3 then
- if access < 2 then
- shell.run("eject left")
- shell.run("eject right")
- term.clear()
- print("Opening door")
- redstone.setOutput("back", true)
- sleep(opentime)
- redstone.setOutput("back", false)
- elseif access > 1 then
- shell.run("eject left")
- shell.run("eject right")
- term.clear()
- print("Insufficient Clearance Level for this room.")
- sleep(pause)
- end
- elseif input == pass4 then
- if access < 1 then
- shell.run("eject left")
- shell.run("eject right")
- term.clear()
- print("Opening door")
- redstone.setOutput("back", true)
- sleep(opentime)
- redstone.setOutput("back", false)
- elseif access > 0 then
- shell.run("eject left")
- shell.run("eject right")
- term.clear()
- print("Insufficient Clearance Level for this room.")
- sleep(pause)
- end
- else
- term.clear()
- print("That is not an access card.")
- sleep(pause)
- end
- shell.run("cd /")
- shell.run("mainloop")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement