KiwiiCorne

Untitled

Jul 24th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. m = peripheral.wrap("top")
  2. --ecran 39*19 1->39 1->19
  3.  
  4. local t = {}
  5. m.clear()
  6.  
  7. function open()
  8. m.clear()
  9. m.setCursorPos(3,8)
  10. m.write("Code correct, ouverture de la porte")
  11. rs.setOutput("front",true)
  12. os.sleep(2)
  13. rs.setOutput("front",false)
  14. os.reboot()
  15. end
  16.  
  17. m.setCursorPos(1,1)
  18. m.write("Commande d'ouverture des portes")
  19.  
  20.  
  21. m.setCursorPos(4,3)
  22. m.write("-------------------")
  23. m.setCursorPos(4,4)
  24. m.write("- - - -")
  25. m.setCursorPos(4,5)
  26. m.write("- 1 - 2 - 3 -")
  27. m.setCursorPos(4,6)
  28. m.write("- - - -")
  29. m.setCursorPos(4,7)
  30. m.write("-------------------")
  31. m.setCursorPos(4,8)
  32. m.write("- - - -")
  33. m.setCursorPos(4,9)
  34. m.write("- 4 - 5 - 6 -")
  35. m.setCursorPos(4,10)
  36. m.write("- - - -")
  37. m.setCursorPos(4,11)
  38. m.write("-------------------")
  39. m.setCursorPos(4,12)
  40. m.write("- - - -")
  41. m.setCursorPos(4,13)
  42. m.write("- 7 - 8 - 9 -")
  43. m.setCursorPos(4,14)
  44. m.write("- - - -")
  45. m.setCursorPos(4,15)
  46. m.write("-------------------")
  47. m.setCursorPos(10,16)
  48. m.write("- -")
  49. m.setCursorPos(10,17)
  50. m.write("- 0 -")
  51. m.setCursorPos(10,18)
  52. m.write("- -")
  53. m.setCursorPos(10,19)
  54. m.write("-------")
  55.  
  56.  
  57. m.setCursorPos(29,5)
  58. m.write("Valider")
  59. m.setCursorPos(29,8)
  60. m.write("Annuler")
  61. m.setCursorPos(24,13)
  62. m.write("Code : ")
  63.  
  64. while true do
  65. local taille = table.getn(t)
  66. local e, button, x, y = os.pullEvent("monitor_touch")
  67. local val = 0
  68.  
  69. if x > 4 and x < 22 and y > 3 and y <19 then
  70. if x > 4 and x < 10 and y > 3 and y < 7 then
  71. val = 1
  72. elseif x > 10 and x < 16 and y > 3 and y < 7 then
  73. val = 2
  74. elseif x > 16 and x < 22 and y > 3 and y < 7 then
  75. val = 3
  76. elseif x > 4 and x < 10 and y > 7 and y < 11 then
  77. val = 4
  78. elseif x > 10 and x < 16 and y > 7 and y < 11 then
  79. val = 5
  80. elseif x > 16 and x < 22 and y > 7 and y < 11 then
  81. val = 6
  82. elseif x > 4 and x < 10 and y > 11 and y < 15 then
  83. val = 7
  84. elseif x > 10 and x < 16 and y > 11 and y < 15 then
  85. val = 8
  86. elseif x > 16 and x < 22 and y > 11 and y < 15 then
  87. val = 9
  88. elseif x > 10 and x < 16 and y > 15 and y < 19 then
  89. val = 0
  90. end
  91.  
  92. table.insert(t,val)
  93. m.setCursorPos(31+taille,15)
  94. m.write("*")
  95.  
  96. elseif x > 29 and x < 35 and y > 5 and y < 8 then
  97. if t[1] == 0 and t[2] == 0 and t[3] == 0 and t[4] == 0 then
  98. open()
  99. else
  100. m.clear()
  101. m.setCursorPos(3,8)
  102. m.write("Code Incorrect, vous allez mourrir!")
  103. os.sleep(4)
  104. os.reboot()
  105. end
  106.  
  107. elseif x > 29 and x < 35 and y > 8 and y < 12 then
  108. os.reboot()
  109. end
  110.  
  111. end
Add Comment
Please, Sign In to add comment