Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 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 ("Door opening...")
  22.  
  23. redstone.setOutput ("back", true)
  24. sleep (4)
  25. redstone.setOutput ("back", false)
  26. redstone.setOutput ("left", true)
  27. sleep (1)
  28. redstone.setOutput ("left", false)
  29.  
  30. print ("Exiting...")
  31. running = false
  32. else
  33. if numFails >= 3 then
  34. ActivateSec ()
  35. numFails = 0
  36. end
  37.  
  38. print ("Exiting...")
  39. running = false
  40. end
  41. elseif input == "Close" then
  42. print ("Enter password: ")
  43. local passInput read ("*")
  44.  
  45. if passInput == "password" then
  46. print ("Door closing...")
  47.  
  48. redstone.setOutput ("left", true)
  49. sleep (1)
  50. redstone.setOutput ("left", false)
  51. redstone.setOutput ("back", true)
  52. sleep (4)
  53. redstone.setOutput ("back", false)
  54.  
  55. print ("Exiting...")
  56. running = false
  57. else
  58. if numFails >= 3 then
  59. ActivateSec ()
  60. numFails = 0
  61. end
  62.  
  63. print ("Exiting...")
  64. running = false
  65. end
  66. elseif input == "Exit" then
  67. print ("Exiting...")
  68. running = false
  69. else
  70. print ("Sorry, did not recognise that input...")
  71.  
  72. print ("Exiting...")
  73. running = false
  74. end
  75. end
  76.  
  77. sleep (3)
  78. term.clear ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement