petomka

Untitled

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