Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("top")
- --ecran 39*19 1->39 1->19
- local t = {}
- m.clear()
- function open()
- m.clear()
- m.setCursorPos(3,8)
- m.write("Code correct, ouverture de la porte")
- rs.setOutput("front",true)
- os.sleep(2)
- rs.setOutput("front",false)
- os.reboot()
- end
- m.setCursorPos(1,1)
- m.write("Commande d'ouverture des portes")
- m.setCursorPos(4,3)
- m.write("-------------------")
- m.setCursorPos(4,4)
- m.write("- - - -")
- m.setCursorPos(4,5)
- m.write("- 1 - 2 - 3 -")
- m.setCursorPos(4,6)
- m.write("- - - -")
- m.setCursorPos(4,7)
- m.write("-------------------")
- m.setCursorPos(4,8)
- m.write("- - - -")
- m.setCursorPos(4,9)
- m.write("- 4 - 5 - 6 -")
- m.setCursorPos(4,10)
- m.write("- - - -")
- m.setCursorPos(4,11)
- m.write("-------------------")
- m.setCursorPos(4,12)
- m.write("- - - -")
- m.setCursorPos(4,13)
- m.write("- 7 - 8 - 9 -")
- m.setCursorPos(4,14)
- m.write("- - - -")
- m.setCursorPos(4,15)
- m.write("-------------------")
- m.setCursorPos(10,16)
- m.write("- -")
- m.setCursorPos(10,17)
- m.write("- 0 -")
- m.setCursorPos(10,18)
- m.write("- -")
- m.setCursorPos(10,19)
- m.write("-------")
- m.setCursorPos(29,5)
- m.write("Valider")
- m.setCursorPos(29,8)
- m.write("Annuler")
- m.setCursorPos(24,13)
- m.write("Code : ")
- while true do
- local taille = table.getn(t)
- local e, button, x, y = os.pullEvent("monitor_touch")
- local val = 0
- if x > 4 and x < 22 and y > 3 and y <19 then
- if x > 4 and x < 10 and y > 3 and y < 7 then
- val = 1
- elseif x > 10 and x < 16 and y > 3 and y < 7 then
- val = 2
- elseif x > 16 and x < 22 and y > 3 and y < 7 then
- val = 3
- elseif x > 4 and x < 10 and y > 7 and y < 11 then
- val = 4
- elseif x > 10 and x < 16 and y > 7 and y < 11 then
- val = 5
- elseif x > 16 and x < 22 and y > 7 and y < 11 then
- val = 6
- elseif x > 4 and x < 10 and y > 11 and y < 15 then
- val = 7
- elseif x > 10 and x < 16 and y > 11 and y < 15 then
- val = 8
- elseif x > 16 and x < 22 and y > 11 and y < 15 then
- val = 9
- elseif x > 10 and x < 16 and y > 15 and y < 19 then
- val = 0
- end
- table.insert(t,val)
- m.setCursorPos(31+taille,15)
- m.write("*")
- elseif x > 29 and x < 35 and y > 5 and y < 8 then
- if t[1] == 0 and t[2] == 0 and t[3] == 0 and t[4] == 0 then
- open()
- else
- m.clear()
- m.setCursorPos(3,8)
- m.write("Code Incorrect, vous allez mourrir!")
- os.sleep(4)
- os.reboot()
- end
- elseif x > 29 and x < 35 and y > 8 and y < 12 then
- os.reboot()
- end
- end
Add Comment
Please, Sign In to add comment