Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sleep(3)
- local mon = peripheral.wrap("back")
- local oldPull = os.pullEvent
- os.pullEvent = os.pullEventRaw
- function mwrite(txt)
- mon.clear()
- mon.setCursorPos(1,2)
- mon.setTextScale(2)
- mon.write("--- Klungelsoft ---")
- sleep(1)
- mon.clear()
- mon.setCursorPos(1,2)
- mon.write(txt)
- -- mon1.write(string.len(txt))
- end
- function loop()
- while true do
- mwrite("--- Town shop ---")
- sleep(1)
- end
- end
- function menu()
- print("start or stop?")
- if read()=="start" then
- loop()
- end
- os.pullEvent = oldPull
- -- shell.exit()
- end
- function login2()
- mwrite("--- Town shop ---")
- term.clear()
- term.setCursorPos(1,1)
- print("Press a key to unlock the computer")
- os.startTimer(1)
- event, param1, param2, param3 = os.pullEvent()
- -- print(event)
- if event=="key" then
- print("starting login")
- login()
- else
- print("No key pressed. Starting normal program")
- loop()
- end
- end
- function login()
- term.clear()
- term.setCursorPos(1,1)
- print("Press the first letter of the pass")
- os.startTimer(10)
- event, param1, param2, param3 = os.pullEvent()
- -- print(param1)
- -- print(event)
- -- print(event=="key")
- -- print(param1=="30")
- -- print(param1)
- -- print(param1==30)
- -- print(param1=="a")
- if event=="key" and param1==30 then
- print("Press the second letter of the pass")
- event, param1, param2, param3 = os.pullEvent()
- -- print(param1)
- -- print(event)
- event, param1, param2, param3 = os.pullEvent()
- -- print(param1)
- -- print(event)
- if event=="key" and param1==30 then
- print("Press the final letter of the pass")
- event, param1, param2, param3 = os.pullEvent()
- -- print(param1)
- -- print(event)
- event, param1, param2, param3 = os.pullEvent()
- if event=="key" and param1==25 then
- event, param1, param2, param3 = os.pullEvent()
- print("Passcode accepted")
- menu()
- else
- denied()
- end
- else
- denied()
- end
- else
- denied()
- end
- end
- function denied()
- print("Passcode denied")
- print("Starting normal program")
- loop()
- end
- login2()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement