cyber_Ahn

PassDoor

Jul 11th, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.11 KB | None | 0 0
  1. passwort = 1258 -- kann man sich aussuchen (einfach 4-stellige Zahl aussuchen und austauschen)
  2. count = 0
  3. a = 0
  4. b = 0
  5. c = 0
  6. d = 0
  7. eingabe = 0
  8. zugang = 0
  9.  
  10. function Rahmen()
  11. shell.run("clear")
  12. term.setBackgroundColor(colors.green)
  13. term.setCursorPos(3,2)
  14. print("123")
  15. term.setCursorPos(3,3)
  16. print("456")
  17. term.setCursorPos(3,4)
  18. print("789")
  19. end
  20.  
  21. term.setBackgroundColor(colors.black)
  22.  
  23. function Eingabe()
  24. while count < 4 do
  25. event,side,x,y = os.pullEvent()
  26.   if event == "monitor_touch" then
  27.  
  28.       if x == 3 and y == 2 then
  29.        count = count + 1
  30.        if count == 1 then
  31.        a = 1
  32.        term.setBackgroundColor(colors.black)
  33.        write("*")
  34.        elseif count == 2 then
  35.        b = 1
  36.        write("*")
  37.        elseif count == 3 then
  38.        c = 1
  39.        write("*")
  40.        elseif count == 4 then
  41.        d = 1
  42.        write("*")
  43.        end
  44.       end
  45.      
  46.       if x == 4 and y == 2 then
  47.       count = count + 1
  48.       if count == 1 then
  49.       a = 2
  50.       term.setBackgroundColor(colors.black)
  51.       write("*")
  52.       elseif count == 2 then
  53.       b = 2
  54.       write("*")
  55.       elseif count == 3 then
  56.       c = 2
  57.       write("*")
  58.       elseif count == 4 then
  59.       d = 2
  60.       write("*")
  61.       end
  62.       end
  63.      
  64.       if x == 5 and y == 2 then
  65.       count = count + 1
  66.       if count == 1 then
  67.       a = 3
  68.       term.setBackgroundColor(colors.black)
  69.       write("*")
  70.       elseif count == 2 then
  71.       b = 3
  72.       write("*")
  73.       elseif count == 3 then
  74.       c = 3
  75.       write("*")
  76.       elseif count == 4 then
  77.       d = 3
  78.       write("*")
  79.       end
  80.       end
  81.      
  82.       if x == 3 and y == 3 then
  83.       count = count + 1
  84.       if count == 1 then
  85.       a = 4
  86.       term.setBackgroundColor(colors.black)
  87.       write("*")
  88.       elseif count == 2 then
  89.       b = 4
  90.       write("*")
  91.       elseif count == 3 then
  92.       c = 4
  93.       write("*")
  94.       elseif count == 4 then
  95.       d = 4
  96.       write("*")
  97.       end
  98.       end
  99.      
  100.       if x == 4 and y == 3 then
  101.       count = count + 1
  102.       if count == 1 then
  103.       a = 5
  104.       term.setBackgroundColor(colors.black)
  105.       write("*")
  106.       elseif count == 2 then
  107.       b = 5
  108.       write("*")
  109.       elseif count == 3 then
  110.       c = 5
  111.       write("*")
  112.       elseif count == 4 then
  113.       d = 5
  114.       write("*")
  115.       end
  116.       end
  117.      
  118.       if x == 5 and y == 3 then
  119.       count = count + 1
  120.       if count == 1 then
  121.       a = 6
  122.       term.setBackgroundColor(colors.black)
  123.       write("*")
  124.       elseif count == 2 then
  125.       b = 6
  126.       write("*")
  127.       elseif count == 3 then
  128.       c = 6
  129.       write("*")
  130.       elseif count == 4 then
  131.       d = 6
  132.       write("*")
  133.       end
  134.       end
  135.      
  136.       if x == 3 and y == 4 then
  137.       count = count + 1
  138.       if count == 1 then
  139.       a = 7
  140.       term.setBackgroundColor(colors.black)
  141.       write("*")
  142.       elseif count == 2 then
  143.       b = 7
  144.       write("*")
  145.       elseif count == 3 then
  146.       c = 7
  147.       write("*")
  148.       elseif count == 4 then
  149.       d = 7
  150.       write("*")
  151.       end
  152.       end
  153.      
  154.       if x == 4 and y == 4 then
  155.       count = count + 1
  156.       if count == 1 then
  157.       a = 8
  158.       term.setBackgroundColor(colors.black)
  159.       write("*")
  160.       elseif count == 2 then
  161.       b = 8
  162.       write("*")
  163.       elseif count == 3 then
  164.       c = 8
  165.       write("*")
  166.       elseif count == 4 then
  167.       d = 8
  168.       write("*")
  169.       end
  170.       end
  171.      
  172.       if x == 5 and y == 4 then
  173.       count = count + 1
  174.       if count == 1 then
  175.       a = 9
  176.       term.setBackgroundColor(colors.black)
  177.       write("*")
  178.       elseif count == 2 then
  179.       b = 9
  180.       write("*")
  181.       elseif count == 3 then
  182.       c = 9
  183.       write("*")
  184.       elseif count == 4 then
  185.       d = 9
  186.       write("*")
  187.       end
  188.       end
  189.      
  190. end
  191. end
  192. count = 0
  193. end
  194.  
  195. while true do
  196. Rahmen()
  197. Eingabe()
  198.  
  199. eingabe = (""..a..""..b..""..c..""..d.."")
  200. zugang = (passwort-eingabe)
  201. if zugang == 0 then
  202. write("OK")
  203. rs.setOutput("bottom", true)
  204. sleep(3,5)
  205. rs.setOutput("bottom", false)
  206. else write("FALSCH")
  207. end
  208.  
  209. sleep(3)
  210. term.setBackgroundColor(colors.black)
  211. end
Add Comment
Please, Sign In to add comment