Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- peripheral.wrap("back")
- rednet.open("back")
- logged = false
- user = " "
- pass = " "
- function printList()
- print(" ")
- print("logout")
- print("toggle lift tb")
- os.pullEvent("key")
- end
- function unlog()
- logged = false
- user = " "
- pass = " "
- end
- function home()
- term.clear()
- term.setTextColor(colors.yellow)
- term.setCursorPos(1,1)
- print("Stendarr OS - TEXT ENABLED")
- print("")
- term.setTextColor(colors.white)
- if logged == false then
- logIn()
- else
- enterCommand()
- end
- end
- function logIn()
- print("=====================")
- print("| Enter Credentials |")
- print("| Username: |")
- print("| Access Code: |")
- print("| |")
- print("| Access: |")
- print("=====================")
- term.setCursorPos(12, 5)
- username = io.read()
- term.setCursorPos(15, 6)
- code = io.read()
- if username == "WSearle" then
- if code == "9465" then
- user = "Will"
- pass = "9465"
- logged = true
- end
- elseif username == "RDucker" then
- if code == "7245" then
- user = "Rowan"
- logged = true
- pass = "7245"
- end
- end
- term.setCursorPos(10, 8)
- if logged == true then
- term.setTextColor(colors.green)
- term.write("Granted")
- else
- term.setTextColor(colors.red)
- term.write("Denied")
- end
- sleep(3)
- end
- function enterCommand()
- print("Welcome, " .. user)
- print("Type 'list' for commands.")
- print(" ")
- command = io.read()
- if command == "list" then
- printList()
- elseif command == "toggle lift tb" then
- toggleLiftTB()
- elseif command == "logout" then
- unlog()
- end
- end
- function toggleLiftTB()
- print(" ")
- print("Establishing connection...")
- print("connect - " .. pass)
- rednet.send(2,pass)
- local myTimer = os.startTimer(5)
- while true do
- event,id,msg = os.pullEvent()
- if event == "timer" then
- print("Failed to Connect")
- break
- elseif event == "rednet_message" then
- print("Confirmed")
- rednet.send(2,"toggle")
- break
- end
- end
- os.pullEvent("key")
- end
- while true do
- home()
- end
Add Comment
Please, Sign In to add comment