Advertisement
Guest User

pw

a guest
Dec 6th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. pw = "7744"
  2.  
  3. j1 = 0
  4. j2 = 0
  5. j3 = 0
  6. j4 = 0
  7.  
  8. m = peripheral.wrap("back")
  9.  
  10.  
  11. function drawpin()
  12. m.setBackgroundColor(colors.red)
  13. m.clear()
  14. m.setBackgroundColor(colors.black)
  15. m.setTextColor(colors.white)
  16. m.setCursorPos(1,1)
  17. m.write("1")
  18. m.setCursorPos(3,1)
  19. m.write("2")
  20. m.setCursorPos(5,1)
  21. m.write("3")
  22. m.setCursorPos(1,3)
  23. m.write("4")
  24. m.setCursorPos(3,3)
  25. m.write("5")
  26. m.setCursorPos(5,3)
  27. m.write("6")
  28. m.setCursorPos(1,5)
  29. m.write("7")
  30. m.setCursorPos(3,5)
  31. m.write("8")
  32. m.setCursorPos(5,5)
  33. m.write("9")
  34.  
  35. m.setBackgroundColor(colors.black)
  36. m.setTextColor(colors.white)
  37. m.setCursorPos(10,1)
  38. m.write("0000")
  39. end
  40.  
  41. function unlock()
  42. m.setBackgroundColor(colors.green)
  43. m.clear()
  44. redstone.setAnalogOutput("bottom",15)
  45. sleep(3)
  46. redstone.setAnalogOutput("bottom",0)
  47. j1 = 0
  48. j2 = 0
  49. j3 = 0
  50. j4 = 0
  51. drawpin()
  52. end
  53.  
  54. drawpin()
  55.  
  56.  
  57.  
  58.  
  59. while true do
  60. event, side, xPos, yPos = os.pullEvent("monitor_touch")
  61.  
  62.  
  63. drawpin()
  64.  
  65.  
  66. j4 = j3
  67. j3 = j2
  68. j2 = j1
  69. if yPos == 1 then
  70. if xPos == 1 or xPos == 2 then
  71. j1 = 1
  72. elseif xPos == 3 or xPos == 4 then
  73. j1 = 2
  74. elseif xPos == 5 or xPos == 6 then
  75. j1 = 3
  76. end
  77. elseif yPos == 3 then
  78. if xPos == 1 or xPos == 2 then
  79. j1 = 4
  80. elseif xPos == 3 or xPos == 4 then
  81. j1 = 5
  82. elseif xPos == 5 or xPos == 6 then
  83. j1 = 6
  84. end
  85. elseif yPos == 5 then
  86. if xPos == 1 or xPos == 2 then
  87. j1 = 7
  88. elseif xPos == 3 or xPos == 4 then
  89. j1 = 8
  90. elseif xPos == 5 or xPos == 6 then
  91. j1 = 9
  92. end
  93. end
  94.  
  95. j = j4..j3..j2..j1
  96.  
  97. m.setBackgroundColor(colors.black)
  98. m.setTextColor(colors.white)
  99. m.setCursorPos(10,1)
  100. m.write(j)
  101.  
  102. if j == pw then
  103. unlock()
  104. end
  105.  
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement