Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("left")
- term.clear()
- passwort = 1379
- count = 0
- a = 0
- b = 0
- c = 0
- d = 0
- eingabe = 0
- zugang = 0
- function Rahmen()
- m.clear()
- m.setBackgroundColor(8)
- m.setCursorPos(3,1)
- m.write("123")
- m.setCursorPos(3,2)
- m.write("456")
- m.setCursorPos(3,3)
- m.write("789")
- end
- m.setBackgroundColor(32768)
- function Eingabe()
- while count < 4 do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x == 3 and y == 1 then
- count = count + 1
- if count == 1 then
- a = 1
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 1
- m.write("*")
- elseif count == 3 then
- c = 1
- m.write("*")
- elseif count == 4 then
- d = 1
- m.write("*")
- end
- end
- if x == 4 and y == 1 then
- count = count + 1
- if count == 1 then
- a = 2
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 2
- m.write("*")
- elseif count == 3 then
- c = 2
- write("*")
- elseif count == 4 then
- d = 2
- m.write("*")
- end
- end
- if x == 5 and y == 1 then
- count = count + 1
- if count == 1 then
- a = 3
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 3
- m.write("*")
- elseif count == 3 then
- c = 3
- m.write("*")
- elseif count == 4 then
- d = 3
- m.write("*")
- end
- end
- if x == 3 and y == 2 then
- count = count + 1
- if count == 1 then
- a = 4
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 4
- m.write("*")
- elseif count == 3 then
- c = 4
- m.write("*")
- elseif count == 4 then
- d = 4
- m.write("*")
- end
- end
- if x == 4 and y == 2 then
- count = count + 1
- if count == 1 then
- a = 5
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- write("*")
- elseif count == 2 then
- b = 5
- m.write("*")
- elseif count == 3 then
- c = 5
- m.write("*")
- elseif count == 4 then
- d = 5
- m.write("*")
- end
- end
- if x == 5 and y == 2 then
- count = count + 1
- if count == 1 then
- a = 6
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 6
- m.write("*")
- elseif count == 3 then
- c = 6
- m.write("*")
- elseif count == 4 then
- d = 6
- m.write("*")
- end
- end
- if x == 3 and y == 3 then
- count = count + 1
- if count == 1 then
- a = 7
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 7
- m.write("*")
- elseif count == 3 then
- c = 7
- m.write("*")
- elseif count == 4 then
- d = 7
- m.write("*")
- end
- end
- if x == 4 and y == 3 then
- count = count + 1
- if count == 1 then
- a = 8
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 8
- m.write("*")
- elseif count == 3 then
- c = 8
- m.write("*")
- elseif count == 4 then
- d = 8
- m.write("*")
- end
- end
- if x == 5 and y == 3 then
- count = count + 1
- if count == 1 then
- a = 9
- m.setBackgroundColor(32768)
- m.setCursorPos(3,4)
- m.write("*")
- elseif count == 2 then
- b = 9
- m.write("*")
- elseif count == 3 then
- c = 9
- m.write("*")
- elseif count == 4 then
- d = 9
- m.write("*")
- end
- end
- end
- end
- count = 0
- end
- while true do
- Rahmen()
- Eingabe()
- m.setCursorPos(2,5)
- eingabe = (""..a..""..b..""..c..""..d.."")
- zugang = (passwort - eingabe)
- if zugang == 0 then
- m.setCursorPos(2,5)
- m.write("OK")
- rs.setOutput("bottom", true)
- sleep(3)
- rs.setOutput("bottom", false)
- else m.write("FALSCH")
- end
- sleep(3)
- m.setBackgroundColor(32768)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement