Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. Passwort1 = 0
  2. Passwort2 = 1
  3. Passwort3 = 0
  4. Passwort4 = 0
  5. Passwort5 = 2
  6. Passwort6 = 0
  7. Passwort7 = 0
  8. Passwort8 = 3
  9. Passwort9 = 4
  10.  
  11.  
  12. local count = 0
  13. a = 0
  14.  
  15. m = peripheral.find("monitor")
  16. m.setBackgroundColor(128)
  17. function draw()
  18. m.clear()
  19. m.setCursorPos(1,1)
  20. m.setTextScale(1.5)
  21. m.write("1")
  22. m.setCursorPos(3,1)
  23. m.write("2")
  24. m.setCursorPos(5,1)
  25. m.write("3")
  26. m.setCursorPos(1,2)
  27. m.write("4")
  28. m.setCursorPos(3,2)
  29. m.write("5")
  30. m.setCursorPos(5,2)
  31. m.write("6")
  32. m.setCursorPos(1,3)
  33. m.write("7")
  34. m.setCursorPos(3,3)
  35. m.write("8")
  36. m.setCursorPos(5,3)
  37. m.write("9")
  38. end
  39. draw()
  40.  
  41.  
  42. while true do
  43. event,side,x,y = os.pullEvent()
  44. if event == "monitor_touch" then
  45. count = count+1
  46. if x == 1 and y == 1 and count == Passwort1 then
  47. a = a+Passwort1
  48. end
  49. if x == 3 and y == 1 and count == Passwort2 then
  50. a = a+Passwort2
  51. end
  52. if x == 5 and y == 1 and count == Passwort3 then
  53. a = a+Passwort3
  54. end
  55. if x == 1 and y == 2 and count == Passwort4 then
  56. a = a+Passwort4
  57. end
  58. if x == 3 and y == 2 and count == Passwort5 then
  59. a = a+Passwort5
  60. end
  61. if x == 5 and y == 2 and count == Passwort6 then
  62. a = a+Passwort6
  63. end
  64. if x == 1 and y == 3 and count == Passwort7 then
  65. a = a+Passwort7
  66. end
  67. if x == 3 and y == 3 and count == Passwort8 then
  68. a = a+Passwort8
  69. end
  70. if x == 5 and y == 3 and count == Passwort9 then
  71. a = a+Passwort9
  72. end
  73.  
  74.  
  75. if count == 1 then
  76. m.setBackgroundColor(128)
  77. m.setCursorPos(1,4)
  78. m.write("*")
  79. end
  80. if count == 2 then
  81. m.setBackgroundColor(128)
  82. m.setCursorPos(2,4)
  83. m.write("*")
  84. end
  85. if count == 3 then
  86. m.setBackgroundColor(128)
  87. m.setCursorPos(3,4)
  88. m.write("*")
  89. end
  90. if count == 4 then
  91. m.setBackgroundColor(128)
  92. m.setCursorPos(4,4)
  93. m.write("*")
  94. sleep(0.8)
  95.  
  96.  
  97. end
  98.  
  99. if a == 10 and count == 4 then
  100.  
  101. a = 0 --Variable zum Berechnen
  102. count = 0 --Anzahl der Versuche
  103.  
  104.  
  105. m.setBackgroundColor(colors.green)
  106. draw()
  107. m.setCursorPos(1,4)
  108. m.write(" OK ")
  109. rs.setOutput("left",true)
  110. sleep(Zeit2)
  111. m.setBackgroundColor(128)
  112. draw()
  113. rs.setOutput("left",false)
  114.  
  115. -- Falsches Passwort
  116.  
  117. elseif count == 4 then
  118. a = 0
  119. count = 0
  120.  
  121.  
  122.  
  123. m.setBackgroundColor(colors.red)
  124. draw()
  125. m.setCursorPos(1,4)
  126. m.write("Wrong")
  127. sleep(2)
  128. m.setBackgroundColor(128)
  129.  
  130.  
  131.  
  132. end
  133. end
  134. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement