Advertisement
Guest User

cpu

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