Advertisement
Guest User

startup

a guest
Mar 11th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.74 KB | None | 0 0
  1. x = "mitchel2010"
  2. y = "minecraft1992"
  3. local program = 0
  4. local i = 1
  5. local doorMenu = 0
  6.  
  7. function lightC()
  8.   if true then
  9.   lightcontrol = 0
  10.   term.clear()
  11.   term.setCursorPos(1,4)
  12.   print("Light Control Menu")
  13.   print("...................")
  14.   os.sleep(1)
  15.   term.setCursorPos(1,7)
  16.  
  17.   print("hallLightOn")
  18.   print("hallLightOff")
  19.   print("backToMenu")
  20.   write("select: ")
  21.   lightcontrol = read()
  22.   end
  23.  
  24.   if lightcontrol == "hallLightOn" then
  25.     rs.setOutput("top", true)
  26.     os.sleep(0.2)
  27.     rs.setOutput("top", false)
  28.     os.sleep(0.2)
  29.     rs.setOutput("top", true)
  30.     lightC()
  31.     elseif lightcontrol == "hallLightOff" then
  32.       rs.setOutput("top", false)
  33.       lightC()
  34.       elseif lightcontrol == "backToMenu" then
  35.       mainMenu()
  36.      
  37.     end
  38. end
  39.      
  40.    
  41.  
  42.  
  43.    
  44.    
  45. function doorC()
  46. if true then
  47. term.clear()
  48. term.setCursorPos(1,1)
  49.  
  50.     print("openDoors")
  51.     os.sleep(1)
  52.     print("backToMenu")
  53.    
  54.     write = ("Please Select Program")
  55.     doorMenu = read()
  56. end  
  57.         if doorMenu == "openDoors" then
  58.         print("Opening Doors... standby")
  59.         os.sleep(2)
  60.         doorSystem()
  61.         elseif doorMenu == "backToMenu" then
  62.        print("Back To Menu")
  63.        os.sleep(3)
  64.        mainMenu()
  65.        end
  66. end
  67.  
  68. function mainMenu()
  69. program = 0
  70.  
  71. if true then
  72.  
  73. term.clear()
  74. term.setCursorPos(1,4)
  75.  
  76.  
  77.    print("Main Menu")
  78.    print(".........")
  79.    os.sleep(2)
  80.    term.setCursorPos(1,7)
  81.    print("openDoors")
  82.    os.sleep(1)
  83.    print("lights")
  84.    os.sleep(1)
  85.    print("logout")
  86.    os.sleep(1)
  87.  
  88.    write("Please Select Program: ")
  89.    program = read()
  90. end
  91.  
  92.        if program == "openDoors" then
  93.            print("please standby doors are opening...")
  94.                os.sleep(3)
  95.                rs.setOutput("back", true)
  96.                os.sleep(10)
  97.                print("doors are closing")
  98.                os.sleep(3)
  99.                rs.setOutput("back", false)
  100.                mainMenu()
  101.            elseif program == "lights" then
  102.           -- print("lightControl Works!")
  103.            lightC()
  104.            elseif program == "logout" then
  105.            password()
  106.            else
  107.            print("invalid program")
  108.             mainMenu()
  109.        end
  110. end
  111.  
  112. function password()
  113. term.clear()
  114. term.setCursorPos(1,1)
  115.  if x ~= 0 then
  116.  
  117.  write("Enter User Name: ")
  118.  
  119.  user = read()
  120.  
  121.  term.clear()
  122.  
  123.  
  124. write("Enter Password: ")
  125. pass = read()
  126.  
  127.  
  128.    if user == x and pass == y then
  129.        print("loging in... please standby")
  130.        os.sleep(3)
  131.        print("login Succesful")
  132.        os.sleep(3)
  133.     mainMenu()
  134.            else
  135.            print("loging in... please standby")
  136.            os.sleep(3)
  137.            print("login failed.. please try again")
  138.   os.sleep(3)
  139.            password()
  140.     end
  141.     end
  142. end
  143.  
  144. password()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement