Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Passwort1 = 0
- Passwort2 = 1
- Passwort3 = 0
- Passwort4 = 0
- Passwort5 = 2
- Passwort6 = 0
- Passwort7 = 0
- Passwort8 = 3
- Passwort9 = 4
- local count = 0
- a = 0
- m = peripheral.find("monitor")
- m.setBackgroundColor(128)
- function draw()
- m.clear()
- m.setCursorPos(1,1)
- m.setTextScale(1.5)
- m.write("1")
- m.setCursorPos(3,1)
- m.write("2")
- m.setCursorPos(5,1)
- m.write("3")
- m.setCursorPos(1,2)
- m.write("4")
- m.setCursorPos(3,2)
- m.write("5")
- m.setCursorPos(5,2)
- m.write("6")
- m.setCursorPos(1,3)
- m.write("7")
- m.setCursorPos(3,3)
- m.write("8")
- m.setCursorPos(5,3)
- m.write("9")
- end
- draw()
- while true do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- count = count+1
- if x == 1 and y == 1 and count == Passwort1 then
- a = a+Passwort1
- end
- if x == 3 and y == 1 and count == Passwort2 then
- a = a+Passwort2
- end
- if x == 5 and y == 1 and count == Passwort3 then
- a = a+Passwort3
- end
- if x == 1 and y == 2 and count == Passwort4 then
- a = a+Passwort4
- end
- if x == 3 and y == 2 and count == Passwort5 then
- a = a+Passwort5
- end
- if x == 5 and y == 2 and count == Passwort6 then
- a = a+Passwort6
- end
- if x == 1 and y == 3 and count == Passwort7 then
- a = a+Passwort7
- end
- if x == 3 and y == 3 and count == Passwort8 then
- a = a+Passwort8
- end
- if x == 5 and y == 3 and count == Passwort9 then
- a = a+Passwort9
- end
- if count == 1 then
- m.setBackgroundColor(128)
- m.setCursorPos(1,4)
- m.write("*")
- end
- if count == 2 then
- m.setBackgroundColor(128)
- m.setCursorPos(2,4)
- m.write("*")
- end
- if count == 3 then
- m.setBackgroundColor(128)
- m.setCursorPos(3,4)
- m.write("*")
- end
- if count == 4 then
- m.setBackgroundColor(128)
- m.setCursorPos(4,4)
- m.write("*")
- sleep(0.8)
- end
- if a == 10 and count == 4 then
- a = 0 --Variable zum Berechnen
- count = 0 --Anzahl der Versuche
- m.setBackgroundColor(colors.green)
- draw()
- m.setCursorPos(1,4)
- m.write(" OK ")
- rs.setOutput("left",true)
- sleep(Zeit2)
- m.setBackgroundColor(128)
- draw()
- rs.setOutput("left",false)
- -- Falsches Passwort
- elseif count == 4 then
- a = 0
- count = 0
- m.setBackgroundColor(colors.red)
- draw()
- m.setCursorPos(1,4)
- m.write("Wrong")
- sleep(2)
- m.setBackgroundColor(128)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement