Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. local running = true
  2. local numFails = 0
  3.  
  4. while running == true do
  5. term.clear ()
  6.  
  7. print ("What would you like to do?")
  8. print ("")
  9. print ("Open")
  10. print ("Close")
  11. print ("Exit")
  12. print ("")
  13.  
  14. local input = read ("*")
  15.  
  16. if input == "Open" then
  17. print ("Enter password: ")
  18. local passInput read ("*")
  19.  
  20. if passInput == "password" then
  21. print ("Password correct.")
  22. print ("Door opening...")
  23.  
  24. redstone.setOutput ("back", true)
  25. sleep (4)
  26. redstone.setOutput ("back", false)
  27. redstone.setOutput ("left", true)
  28. sleep (1)
  29. redstone.setOutput ("left", false)
  30.  
  31. print ("Exiting...")
  32. running = false
  33. else
  34. print ("Password incorrect.")
  35.  
  36. if numFails >= 3 then
  37. ActivateSec ()
  38. numFails = 0
  39. end
  40.  
  41. print ("Exiting...")
  42. running = false
  43. end
  44. elseif input == "Close" then
  45. print ("Enter password: ")
  46. local passInput read ("*")
  47.  
  48. if passInput == "password" then
  49. print ("Password correct.")
  50. print ("Door closing...")
  51.  
  52. redstone.setOutput ("left", true)
  53. sleep (1)
  54. redstone.setOutput ("left", false)
  55. redstone.setOutput ("back", true)
  56. sleep (4)
  57. redstone.setOutput ("back", false)
  58.  
  59. print ("Exiting...")
  60. running = false
  61. else
  62. print ("Password incorrect.")
  63.  
  64. if numFails >= 3 then
  65. ActivateSec ()
  66. numFails = 0
  67. end
  68.  
  69. print ("Exiting...")
  70. running = false
  71. end
  72. elseif input == "Exit" then
  73. print ("Exiting...")
  74. running = false
  75. else
  76. print ("Sorry, did not recognise that input...")
  77.  
  78. print ("Exiting...")
  79. running = false
  80. end
  81. end
  82.  
  83. sleep (3)
  84. term.clear ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement