Advertisement
Guest User

startup

a guest
May 20th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.44 KB | None | 0 0
  1. speaker = peripheral.find("speaker")
  2. os.pullEvent = os.pullEventRaw
  3. monitor = peripheral.find("monitor")
  4. monitor.setTextScale(0.5)
  5. --Enter Code
  6. code = "11829"
  7. --
  8. term.redirect(monitor)
  9. width, height = term.getSize()
  10. term.setBackgroundColor(colors.black)
  11. term.clear()
  12. paintutils.drawLine(2,height - 7,6,height - 7,colors.gray)
  13. right = false
  14. term.setCursorPos(2, height - 5)
  15. term.setBackgroundColor(colors.gray)
  16. term.setTextColor(colors.white)
  17. write("1")
  18. term.setCursorPos(4, height - 5)
  19. write("2")
  20. term.setCursorPos(6, height - 5)
  21. write("3")
  22. term.setCursorPos(2, height - 3)
  23. write("4")
  24. term.setCursorPos(4, height - 3)
  25. write("5")
  26. term.setCursorPos(6, height - 3)
  27. write("6")
  28. term.setCursorPos(2, height - 1)
  29. write("7")
  30. term.setCursorPos(4, height - 1)
  31. write("8")
  32. term.setCursorPos(6, height - 1)
  33. write("9")
  34. pass = ""
  35. redstone.setOutput("left",false)
  36. term.setTextColor(colors.black)
  37. term.setBackgroundColor(colors.gray)
  38. function display()
  39.     while true do
  40.         sleep(0.1)
  41.         term.setCursorPos(2,height - 7)
  42.         write(pass)
  43.     end
  44. end
  45. function control()
  46.     while true do
  47.         repeat
  48.         _, m, x, y = os.pullEvent("monitor_touch")
  49.         if string.len(pass) < 5 and pass ~= code then
  50.         if y == height - 5 then
  51.             if x == 2 then
  52.                 pass = pass.."1"
  53.             elseif x == 4 then
  54.                 pass = pass.."2"
  55.             elseif x == 6 then
  56.                 pass = pass.."3"
  57.             end
  58.         elseif y == height - 3 then
  59.             if x == 2 then
  60.                 pass = pass.."4"
  61.             elseif x == 4 then
  62.                 pass = pass.."5"
  63.             elseif x == 6 then
  64.                 pass = pass.."6"
  65.             end
  66.         elseif y == height - 1 then
  67.             if x == 2 then
  68.                 pass = pass.."7"
  69.             elseif x == 4 then
  70.                 pass = pass.."8"
  71.             elseif x == 6 then
  72.                 pass = pass.."9"
  73.             end
  74.         end
  75.         if pass == code then
  76.             right = true
  77.         end
  78.         else
  79.             pass = ""
  80.             paintutils.drawLine(2,height - 7,6,height - 7,colors.gray)
  81.         end
  82.         until right == true
  83.         right = false
  84.         redstone.setOutput("back",true)
  85.         pass = ""
  86.         paintutils.drawLine(2,height - 7,6,height - 7,colors.gray)
  87.         os.pullEvent("key")
  88.         redstone.setOutput("back",false)
  89.     end
  90. end
  91. parallel.waitForAll(control,display)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement