Advertisement
Guest User

startup

a guest
Jan 31st, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. ---[[ Variables
  2. lockCheck = redstone.getInput("back")
  3.    
  4. --]]
  5.  
  6. ---[[
  7. function doorLock()
  8.      term.clear()
  9.      term.setCursorPos(1, 1)
  10.      print("Password?")
  11.      local pwd = read("*")
  12.     if pwd == "26845" then
  13.         redstone.setOutput("back", false)
  14.     end
  15.     if pwd == "lock" then
  16.         redstone.setOutput("back", true)
  17.     end
  18. end
  19.  
  20. --]]
  21.  
  22. ---[[ Function to wrap input to a new line
  23. function newLine()
  24.     local _,cY= term.getCursorPos()
  25.     term.setCursorPos(1,cY+1)
  26. end
  27. --]]
  28.  
  29.  
  30.  
  31. ---[[ Main menu
  32. function mainMenu()
  33.     redstone.getInput("back")
  34.     term.clear()
  35.     term.setCursorPos(1,1)
  36.     textutils.slowPrint("What would you like to do?")
  37.     sleep(1)
  38.     newLine()
  39.     sleep(0)
  40.     if redstone.getInput("back") == true then
  41.         print("1. Disengage Reactor Door Lock")
  42.     else
  43.         print("1. Engage Ractor Door Lock")
  44.     end
  45.     textutils.slowPrint("2. Grant Shell Access")
  46.     textutils.slowPrint("3. Exit")
  47.     newLine()
  48.     input = read()
  49.     newLine()
  50.     if input == "1" then
  51.         doorLock()
  52.     end
  53.     if input == "2" then
  54.         shell.run("shell")
  55.     end
  56.     if input == "3" then
  57.         print("Goodbye!")
  58.         sleep(1)
  59.         os.shutdown()
  60.     end
  61. end
  62. --]]
  63. while true do
  64.   mainMenu()
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement