IronClaymore

generic elevator program

Feb 13th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. local pullEvent = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. local password = "guest"
  4. local debug = "debug"
  5. while true do
  6. term.clear()
  7. term.setCursorPos(1, 1)
  8. print("You are on Level X - yyyyy")
  9. term.setCursorPos(1, 2)
  10. print("Type List to see a listing of all floors.")
  11. term.setCursorPos(1, 3)
  12. print("Or enter password to open elevator doors.")
  13. input = read()
  14. if input == password then
  15.     term.clear()
  16.     term.setCursorPos(1, 1)
  17.     print("Thank you. Door will remain open for 10 seconds")
  18.     redstone.setBundledOutput("bottom", 2)
  19.     sleep(10)
  20.     redstone.setBundledOutput("bottom", 0)
  21. end
  22. if input == debug then
  23.     term.clear()
  24.     term.setCursorPos(1, 1)
  25.     print("Debug mode activated, press CTRL + T after 5 seconds to exit program.")
  26.     sleep(5)
  27.     os.pullEvent = pullEvent
  28. end
  29. if input == "List" then
  30.     term.clear()
  31.     term.setCursorPos(1, 1)
  32.     print("Level 9 - Lobby")
  33.     term.setCursorPos(1, 2)
  34.     print("Level 8 - Living quarters")
  35.     term.setCursorPos(1, 3)
  36.     print("Level 7 - Factory floor")
  37.     term.setCursorPos(1, 4)
  38.     print("Level 6 - Biofuels production and R&D")
  39.     term.setCursorPos(1, 5)
  40.     print("Level 5 - Hydroponics")
  41.     term.setCursorPos(1, 6)
  42.     print("Level 4 - unused")
  43.     term.setCursorPos(1, 7)
  44.     print("Level 3 - unused")
  45.     term.setCursorPos(1, 8)
  46.     print("Level 2 - unused")
  47.     term.setCursorPos(1, 9)
  48.     print("Level 1 - Restricted!")
  49.     term.setCursorPos(1, 11)
  50.     print("You are on Level X - yyyyy.")
  51.     term.setCursorPos(1, 12)
  52.     print("Type any command to return to previous menu.")
  53.     input2 = read()
  54.     if input2 == debug then
  55.         term.clear()
  56.         term.setCursorPos(1, 1)
  57.         print("Debug mode activated, press CTRL + T after 5 seconds to exit program.")
  58.         sleep(5)
  59.         os.pullEvent = pullEvent
  60.     end
  61.     if input2 ~= debug then
  62.         sleep(0.2)
  63.     end
  64. end
  65. if input ~= password and input ~= debug and input ~= "List" then
  66.     term.clear()
  67.     term.setCursorPos(1, 1)
  68.     print("Invalid command.")
  69.     sleep(3)
  70. end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment