Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------
- output = "back"
- password = "1234"
- monitorside = "top"
- ------------------------
- term = peripheral.wrap(monitorside)
- os.setComputerLabel("Password Door")
- count = 0
- a = 0
- b = 0
- c = 0
- d = 0
- entry = 0
- function renderFrame()
- term.clear()
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.white)
- term.setCursorPos(3,2)
- term.write("123")
- term.setCursorPos(3,3)
- term.write("456")
- term.setCursorPos(3,4)
- term.write("789")
- --term.setCursorPos(4,5)
- --term.write("0")
- end
- term.setBackgroundColor(colors.black)
- function dot()
- if count == 1 then
- term.setCursorPos(2,5)
- term.write("*")
- elseif count == 2 then
- term.write("*")
- elseif count == 3 then
- term.write("*")
- elseif count == 4 then
- term.write("*")
- end
- end
- function registerInput()
- while count < 4 do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x == 3 and y == 2 then
- count = count + 1
- if count == 1 then
- a = 1
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 1
- elseif count == 3 then
- c = 1
- elseif count == 4 then
- d = 1
- end
- dot()
- end
- if x == 4 and y == 2 then
- count = count + 1
- if count == 1 then
- a = 2
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 2
- elseif count == 3 then
- c = 2
- elseif count == 4 then
- d = 2
- end
- dot()
- end
- if x == 5 and y == 2 then
- count = count + 1
- if count == 1 then
- a = 3
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 3
- elseif count == 3 then
- c = 3
- elseif count == 4 then
- d = 3
- end
- dot()
- end
- if x == 3 and y == 3 then
- count = count + 1
- if count == 1 then
- a = 4
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 4
- elseif count == 3 then
- c = 4
- elseif count == 4 then
- d = 4
- end
- dot()
- end
- if x == 4 and y == 3 then
- count = count + 1
- if count == 1 then
- a = 5
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 5
- elseif count == 3 then
- c = 5
- elseif count == 4 then
- d = 5
- end
- dot()
- end
- if x == 5 and y == 3 then
- count = count + 1
- if count == 1 then
- a = 6
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 6
- elseif count == 3 then
- c = 6
- elseif count == 4 then
- d = 6
- end
- dot()
- end
- if x == 3 and y == 4 then
- count = count + 1
- if count == 1 then
- a = 7
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 7
- elseif count == 3 then
- c = 7
- elseif count == 4 then
- d = 7
- end
- dot()
- end
- if x == 4 and y == 4 then
- count = count + 1
- if count == 1 then
- a = 8
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 8
- elseif count == 3 then
- c = 8
- elseif count == 4 then
- d = 8
- end
- dot()
- end
- if x == 5 and y == 4 then
- count = count + 1
- if count == 1 then
- a = 9
- term.setBackgroundColor(colors.black)
- elseif count == 2 then
- b = 9
- elseif count == 3 then
- c = 9
- elseif count == 4 then
- d = 9
- end
- dot()
- end
- -- if x == 4 and y == 5 then
- -- count = count + 1
- -- if count == 1 then
- -- a = 0
- -- term.setBackgroundColor(colors.black)
- -- write("*")
- -- elseif count == 2 then
- -- b = 0
- -- write("*")
- -- elseif count == 3 then
- -- c = 0
- -- write("*")
- -- elseif count == 4 then
- -- d = 0
- -- write("*")
- -- end
- -- end
- end
- end
- count = 0
- end
- while true do
- renderFrame()
- registerInput()
- entry = (""..a..""..b..""..c..""..d.."")
- if password == entry then
- term.setCursorPos(1,5)
- term.clearLine()
- term.write("OK")
- rs.setOutput(output,true)
- sleep(2.5)
- rs.setOutput(output,false)
- else
- term.setCursorPos(1,5)
- term.clearLine()
- term.write("FALSCH!")
- end
- sleep(3)
- term.setBackgroundColor(colors.black)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement