Advertisement
Guest User

Untitled

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