Advertisement
Dojnaz

Touchpad version 1.0

Feb 20th, 2017
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. password = "1235"
  2. -- Redstone Output
  3. redout = "left"
  4. -- Monitor Side
  5. moniside = "top"
  6. -- Super Admin pass:
  7. adminpass = "admin"
  8. tastencol = 0x800
  9. -- Farbcodes:
  10. -- white                0x1
  11. -- orange               0x2
  12. -- magenta              0x4
  13. -- lightBlue            0x8
  14. -- yellow               0x10   
  15. -- lime                 0x20
  16. -- pink                 0x40
  17. -- gray                 0x80
  18. -- lightGray            0x100  
  19. -- cyan                 0x200    
  20. -- purple               0x400
  21. -- blue                 0x800  
  22. -- brown                0x1000
  23. -- green                0x2000
  24. -- red                  0x4000
  25. -- black                0x8000
  26.  
  27. count = 0
  28. a = 0
  29. b = 0
  30. c = 0
  31. d = 0
  32. eingabe = 0
  33. zugang = 0
  34. term = peripheral.wrap(moniside)
  35. local pullEvent = os.pullEvent
  36. os.pullEvent = os.pullEventRaw
  37. term.setBackgroundColor(colors.black)
  38. if os.getComputerLabel() == nil then
  39. os.setComputerLabel("Password-Door" )
  40. end
  41.  
  42. function Rahmen()
  43.     term.clear()
  44.     term.setTextColor(colors.white)
  45.     term.setCursorPos(2,1)
  46.     term.setBackgroundColor(tastencol)
  47.     term.write(" 1 ")
  48.     term.setBackgroundColor(colors.black)
  49.     term.write (" ")
  50.     term.setBackgroundColor(tastencol)
  51.     term.write(" 2 ")
  52.     term.setBackgroundColor(colors.black)
  53.     term.write (" ")
  54.     term.setBackgroundColor(tastencol)
  55.     term.write(" 3 ")
  56.     term.setBackgroundColor(colors.black)
  57.     term.setCursorPos(2,3)
  58.     term.setBackgroundColor(tastencol)
  59.     term.write(" 4 ")
  60.     term.setBackgroundColor(colors.black)
  61.     term.write (" ")
  62.     term.setBackgroundColor(tastencol)
  63.     term.write(" 5 ")
  64.     term.setBackgroundColor(colors.black)
  65.     term.write (" ")
  66.     term.setBackgroundColor(tastencol)
  67.     term.write(" 6 ")
  68.     term.setBackgroundColor(colors.black)
  69.     term.write ("  ")
  70.     term.setBackgroundColor(tastencol)
  71.     term.write(" C ")
  72.     term.setBackgroundColor(colors.black)
  73.     term.setCursorPos(2,5)
  74.     term.setBackgroundColor(tastencol)
  75.     term.write(" 7 ")
  76.     term.setBackgroundColor(colors.black)
  77.     term.write (" ")
  78.     term.setBackgroundColor(tastencol)
  79.     term.write(" 8 ")
  80.     term.setBackgroundColor(colors.black)
  81.     term.write (" ")
  82.     term.setBackgroundColor(tastencol)
  83.     term.write(" 9 ")
  84.     term.setBackgroundColor(colors.black)
  85.     term.setCursorPos(15,2)
  86.     term.setBackgroundColor(tastencol)
  87.     term.write("   ")
  88.     term.setCursorPos(15,4)
  89.     term.write("   ")
  90.     term.setBackgroundColor(colors.black)
  91. end
  92.  
  93.  
  94. function Eingabe()
  95.     while count < 4 do
  96.         event,side,x,y = os.pullEvent()
  97.         if event == "terminate" then
  98.         write("Admin Password:")
  99.         admin = read("*")
  100.         if admin == adminpass then
  101.         os.pullEvent = pullEvent
  102.         shell.run("clear")
  103.         shell.run("shell")
  104.         os.reboot()
  105.         sleep(6)
  106.     else
  107.         print("wrong")
  108.     end
  109. end
  110.  
  111. if event == "monitor_touch" then
  112.     if (x >= 2 and x<= 4) and y == 1 then
  113.         count = count + 1
  114.     if count == 1 then
  115.         a = 1
  116.         term.setBackgroundColor(colors.black)
  117.         punkt()
  118.     elseif count == 2 then
  119.         b = 1
  120.         punkt()
  121.     elseif count == 3 then
  122.         c = 1
  123.         punkt()
  124.     elseif count == 4 then
  125.         d = 1
  126.         punkt()
  127.     end
  128. end
  129.  
  130. if (x >= 6 and x<= 8) and y == 1 then
  131.     count = count + 1/re
  132.     if count == 1 then
  133.         a = 2
  134.         term.setBackgroundColor(colors.black)
  135.         punkt()
  136.     elseif count == 2 then
  137.         b = 2
  138.         punkt()
  139.     elseif count == 3 then
  140.         c = 2
  141.         punkt()
  142.     elseif count == 4 then
  143.         d = 2
  144.         punkt()
  145.     end
  146. end
  147.  
  148. if (x >= 10 and x<= 12) and y == 1 then
  149.     count = count + 1
  150.     if count == 1 then
  151.         a = 3
  152.         term.setBackgroundColor(colors.black)
  153.         punkt()
  154.     elseif count == 2 then
  155.         b = 3
  156.         punkt()
  157.     elseif count == 3 then
  158.         c = 3
  159.         punkt()
  160.     elseif count == 4 then
  161.         d = 3
  162.         punkt()
  163.     end
  164. end
  165.  
  166. if (x >= 2 and x<= 4) and y == 3 then
  167.     count = count + 1
  168.     if count == 1 then
  169.         a = 4
  170.         term.setBackgroundColor(colors.black)
  171.         punkt()
  172.     elseif count == 2 then
  173.         b = 4
  174.         punkt()
  175.     elseif count == 3 then
  176.         c = 4
  177.         punkt()
  178.     elseif count == 4 then
  179.         d = 4
  180.         punkt()
  181.     end
  182. end
  183.  
  184. if (x >= 6 and x<= 8) and y == 3 then
  185.     count = count + 1
  186.     if count == 1 then
  187.         a = 5
  188.         term.setBackgroundColor(colors.black)
  189.         punkt()
  190.     elseif count == 2 then
  191.         b = 5
  192.         punkt()
  193.     elseif count == 3 then
  194.         c = 5
  195.         punkt()
  196.     elseif count == 4 then
  197.         d = 5
  198.         punkt()
  199.     end
  200. end
  201.  
  202. if (x >= 10 and x<= 12) and y == 3 then
  203.     count = count + 1
  204.     if count == 1 then
  205.         a = 6
  206.         term.setBackgroundColor(colors.black)
  207.         punkt()
  208.     elseif count == 2 then
  209.         b = 6
  210.         punkt()
  211.     elseif count == 3 then
  212.         c = 6
  213.         punkt()
  214.     elseif count == 4 then
  215.         d = 6
  216.         punkt()
  217.     end
  218. end
  219.  
  220. if (x >= 2 and x<= 4) and y == 5 then
  221.     count = count + 1
  222.     if count == 1 then
  223.         a = 7
  224.         term.setBackgroundColor(colors.black)
  225.         punkt()
  226.     elseif count == 2 then
  227.         b = 7
  228.         punkt()
  229.     elseif count == 3 then
  230.         c = 7
  231.         punkt()
  232.     elseif count == 4 then
  233.         d = 7
  234.         punkt()
  235.     end
  236. end
  237.  
  238. if (x >= 6 and x<= 8) and y == 5 then
  239.     count = count + 1
  240.     if count == 1 then
  241.         a = 8
  242.         term.setBackgroundColor(colors.black)
  243.         punkt()
  244.     elseif count == 2 then
  245.         b = 8
  246.         punkt()
  247.     elseif count == 3 then
  248.         c = 8
  249.         punkt()
  250.     elseif count == 4 then
  251.         d = 8
  252.         punkt()
  253.     end
  254. end
  255.  
  256. if (x >= 10 and x<= 12) and y == 5 then
  257.     count = count + 1
  258.     if count == 1 then
  259.         a = 9
  260.         term.setBackgroundColor(colors.black)
  261.         punkt()
  262.     elseif count == 2 then
  263.         b = 9
  264.         punkt()
  265.     elseif count == 3 then
  266.         c = 9
  267.         punkt()
  268.     elseif count == 4 then
  269.         d = 9
  270.         punkt()
  271.     end
  272. end
  273.  
  274. if (x >= 15 and x<= 17) and (y >= 2 and y<= 5) then
  275.     term.setCursorPos(15,5)
  276.     term.write("    ")
  277.     count = 0
  278. end
  279. count = 0
  280. end
  281.  
  282. function punkt()
  283.     if count == 1 then
  284.     term.setCursorPos(15,5)
  285.     term.write ("*")
  286.     elseif count == 2 then
  287.     term.setCursorPos(16,5)
  288.     term.write ("*")
  289.     elseif count == 3 then
  290.     term.setCursorPos(17,5)
  291.     term.write ("*")
  292.     elseif count == 4 then
  293.     term.setCursorPos(18,5)
  294.     term.write ("*")
  295.     sleep(0.1)
  296. end
  297.  
  298. function rand()
  299.     term.setBackgroundColor(farbe)
  300.     term.setCursorPos(1,1)
  301.     term.write("                  ")
  302.     term.setCursorPos(1,2)
  303.     term.write(" ")
  304.     term.setCursorPos(18,2)
  305.     term.write(" ")
  306.     term.setBackgroundColor(colors.black)
  307.     term.write(" ")
  308.     term.setBackgroundColor(farbe)
  309.     term.setCursorPos(1,3)
  310.     term.write(" ")
  311.     term.setCursorPos(18,3)
  312.     term.write(" ")
  313.     term.setBackgroundColor(colors.black)
  314.     term.write(" ")
  315.     term.setBackgroundColor(farbe)
  316.     term.setCursorPos(1,4)
  317.     term.write(" ")
  318.     term.setCursorPos(18,4)
  319.     term.write(" ")
  320.     term.setBackgroundColor(colors.black)
  321.     term.write(" ")
  322.     term.setBackgroundColor(farbe)
  323.     term.setCursorPos(1,5)
  324.     term.write("                  ")
  325.     term.setBackgroundColor(colors.black)
  326. end
  327.  
  328.  
  329. while true do
  330.     Rahmen()
  331.     Eingabe()
  332.     eingabe = (""..a..""..b..""..c..""..d.."")
  333.     zugang = (password-eingabe)
  334.     if password == eingabe then
  335.         term.clear()
  336.         term.setBackgroundColor(colors.black)
  337.         term.setTextColor(colors.lime)
  338.         farbe = 8192
  339.         rand()
  340.         term.setCursorPos(9,3)
  341.         term.write ("OK")
  342.         rs.setOutput(redout, true)
  343.         sleep(2.5)
  344.         rs.setOutput(redout, false)
  345.     else
  346.         term.clear()
  347.         term.setBackgroundColor(colors.black)
  348.         term.setTextColor(colors.red)
  349.         farbe = 16384
  350.         rand()
  351.         term.setCursorPos(8,3)
  352.         term.write("NOPE")
  353.         sleep (1)
  354.         term.setCursorPos(6,3)
  355.         term.write("       ")
  356.         term.setCursorPos(9,3)
  357.         term.write("05")
  358.         sleep(1)
  359.         term.setCursorPos(9,3)
  360.         term.write("04")
  361.         sleep(1)
  362.         term.setCursorPos(9,3)
  363.         term.write("03")
  364.         sleep(1)
  365.         term.setCursorPos(9,3)
  366.         term.write("02")
  367.         sleep(1)
  368.         term.setCursorPos(9,3)
  369.         term.write("01")
  370.         sleep(1)
  371.         term.setCursorPos(9,3)
  372.         term.write("00")
  373.         sleep(1)
  374.     end
  375. os.reboot()
  376. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement