Advertisement
Guest User

Untitled

a guest
Dec 25th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. Passwort1 = 0
  2. Passwort2 = 1
  3. Passwort3 = 0
  4. Passwort4 = 2
  5. Passwort5 = 0
  6. Passwort6 = 3
  7. Passwort7 = 0
  8. Passwort8 = 4
  9. Passwort9 = 0
  10.  
  11.  
  12. local Zeit2 = 3
  13.  
  14. local Anzahl = 3
  15.  
  16. local Zeit = 30
  17.  
  18. animation = false
  19. anzahl = 15
  20. -- -- -- -- -- -- -- -- -- -- -- --
  21.  
  22.  
  23.  
  24. local count = 0
  25. local count2 = 0
  26. a = 0
  27.  
  28. m = peripheral.wrap("top")
  29. m.setBackgroundColor(128)
  30. function draw()
  31. m.clear()
  32. m.setCursorPos(1,1)
  33. m.setTextScale(1.5)
  34. m.write("1")
  35. m.setCursorPos(3,1)
  36. m.write("2")
  37. m.setCursorPos(5,1)
  38. m.write("3")
  39. m.setCursorPos(1,2)
  40. m.write("4")
  41. m.setCursorPos(3,2)
  42. m.write("5")
  43. m.setCursorPos(5,2)
  44. m.write("6")
  45. m.setCursorPos(1,3)
  46. m.write("7")
  47. m.setCursorPos(3,3)
  48. m.write("8")
  49. m.setCursorPos(5,3)
  50. m.write("9")
  51. end
  52. draw()
  53.  
  54.  
  55. while true do
  56. event,side,x,y = os.pullEvent()
  57. if event == "monitor_touch" then
  58. count = count+1
  59. if x == 1 and y == 1 and count == Passwort1 then
  60. a = a+Passwort1
  61. end
  62. if x == 3 and y == 1 and count == Passwort2 then
  63. a = a+Passwort2
  64. end
  65. if x == 5 and y == 1 and count == Passwort3 then
  66. a = a+Passwort3
  67. end
  68. if x == 1 and y == 2 and count == Passwort4 then
  69. a = a+Passwort4
  70. end
  71. if x == 3 and y == 2 and count == Passwort5 then
  72. a = a+Passwort5
  73. end
  74. if x == 5 and y == 2 and count == Passwort6 then
  75. a = a+Passwort6
  76. end
  77. if x == 1 and y == 3 and count == Passwort7 then
  78. a = a+Passwort7
  79. end
  80. if x == 3 and y == 3 and count == Passwort8 then
  81. a = a+Passwort8
  82. end
  83. if x == 5 and y == 3 and count == Passwort9 then
  84. a = a+Passwort9
  85. end
  86.  
  87.  
  88. if count == 1 then
  89. m.setBackgroundColor(128)
  90. m.setCursorPos(1,4)
  91. m.write("*")
  92. end
  93. if count == 2 then
  94. m.setBackgroundColor(128)
  95. m.setCursorPos(2,4)
  96. m.write("*")
  97. end
  98. if count == 3 then
  99. m.setBackgroundColor(128)
  100. m.setCursorPos(3,4)
  101. m.write("*")
  102. end
  103. if count == 4 then
  104. m.setBackgroundColor(128)
  105. m.setCursorPos(4,4)
  106. m.write("*")
  107. sleep(0.8)
  108.  
  109. -- Animation
  110.  
  111. count3 = 0
  112.  
  113. while count3 < anzahl and animation == true do
  114. m.setCursorPos(5,4)
  115. m.write("/")
  116. sleep(0.3)
  117. m.setCursorPos(5,4)
  118. m.write("|")
  119. sleep(0.3)
  120.  
  121. count3 = count3 + 1
  122. end
  123.  
  124.  
  125. end
  126.  
  127.  
  128. if a == 10 and count == 4 then
  129.  
  130. a = 0 --Variable zum Berechnen
  131. count = 0 --Anzahl der Versuche
  132. count2 = 0 --Anzahl der Fehlversuche
  133.  
  134. m.setBackgroundColor(colors.green)
  135. draw()
  136. m.setCursorPos(1,4)
  137. m.write(" OK ")
  138. rs.setOutput("left",true)
  139. sleep(Zeit2)
  140. m.setBackgroundColor(128)
  141. draw()
  142. rs.setOutput("left",false)
  143.  
  144.  
  145. elseif count == 4 then
  146. a = 0
  147. count = 0
  148.  
  149.  
  150.  
  151. m.setBackgroundColor(colors.red)
  152. draw()
  153. m.setCursorPos(1,4)
  154. m.write("Wrong")
  155. sleep(2)
  156. m.setBackgroundColor(128)
  157.  
  158. count2 = count2 + 1
  159.  
  160. if Anzahl - count2 > 0 then
  161. m.clear()
  162. m.setTextScale(0.5)
  163. m.setBackgroundColor(128)
  164. m.setCursorPos(3,2)
  165. rechnung = Anzahl - count2
  166. if rechnung > 1 then
  167. m.write(""..rechnung.."")
  168. m.setCursorPos(1,3)
  169. m.write("tries")
  170. m.setCursorPos(1,4)
  171. m.write("remaining")
  172. end
  173. if rechnung == 1 then
  174. m.write(""..rechnung.."")
  175. m.setCursorPos(1,3)
  176. m.write("tries")
  177. m.setCursorPos(1,4)
  178. m.write("remaining")
  179. end
  180.  
  181. sleep(5)
  182. draw()
  183. end
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. m.setBackgroundColor(colors.black)
  191. if count2 == Anzahl then
  192.  
  193. m.clear()
  194.  
  195. count2 = 0
  196.  
  197. m.setBackgroundColor(colors.black)
  198. m.setTextScale(1)
  199. m.setCursorPos(1,4)
  200. m.write("Access")
  201. m.setCursorPos(1,5)
  202. m.write("Denied")
  203. sleep(Zeit)
  204. m.setTextScale(1.5)
  205. m.setBackgroundColor(128)
  206. draw()
  207.  
  208. end
  209.  
  210.  
  211. end
  212. end
  213. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement