Advertisement
Guest User

startup

a guest
Feb 27th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.38 KB | None | 0 0
  1. --colors.white      1  
  2. --colors.orange     2  
  3. --colors.magenta    4  
  4. --colors.lightBlue  8  
  5. --colors.yellow     16 
  6. --colors.lime       32
  7. --colors.pink       64
  8. --colors.gray       128
  9. --colors.lightGray  256
  10. --colors.cyan       512
  11. --colors.purple     1024
  12. --colors.blue       2048
  13. --colors.brown      4096
  14. --colors.green      8192
  15. --colors.red        16384
  16. --colors.black      32768
  17.  
  18.  
  19. term.clear()
  20. term.setCursorPos(1, 1)
  21. textutils.slowPrint("Booting...", 8)
  22.  
  23.  
  24. limeOut = "OFF"
  25. yellowOut = "CLOSED"
  26. splitterOutput = "OFF"
  27. oilOutput = "OFF"
  28. secretPassOutput = "OFF"
  29. nukeOutput = "OFF"
  30.  
  31. rsBack = 0
  32.  
  33. sleep(3)
  34. term.clear()
  35. sleep(2)
  36.  
  37. function menuMain()
  38.    sleep(0.1)
  39.    if redstone.testBundledInput("right", 2) == true then
  40.       passageState = "CLOSED"
  41.    elseif redstone.testBundledInput("right", 2) == false then
  42.       passageState = "OPEN"
  43.    else
  44.    term.clear()
  45.    end
  46.  
  47.    term.clear()
  48.    term.setCursorPos(20, 3)
  49.  
  50.    print ("GREETINGS "..username.."!")
  51.    term.setCursorPos(16, 5)
  52.    print ("WHAT WOULD YOU LIKE TO ACCESS?")
  53.    term.setCursorPos(18, 6)
  54.    print ("(enter corresponding number)")
  55.  
  56.    
  57.    term.setCursorPos(1, 8)
  58.      print ("1. Secret passage     - "..yellowOut)
  59.      print ("2. Information Screen - "..limeOut)
  60. --   print ("3. Splitter switch    - "..splitterOutput)
  61. --   print ("4. Oil Fabricator     - "..oilOutput)
  62.    print ("5. Change User")
  63.  
  64.    term.setCursorPos(1, 16)
  65.    answer = read()
  66.    
  67.    if answer == "711" then
  68.        if passageOutput == "OFF" then
  69.          redstone.setBundledOutput("right", 8)
  70.          passageOutput = "ON"        
  71.       else
  72.          redstone.setBundledOutput("right", 0)  
  73.          passageOutput = "OFF"        
  74.       end
  75.  
  76.    elseif answer == "1" then
  77.       if yellowOut == "OPEN" then
  78.          rsBack = rsBack-16
  79.          yellowOut = "CLOSED"
  80.       else
  81.          rsBack = rsBack+16
  82.          yellowOut = "OPEN"
  83.       end
  84.  
  85.    elseif answer == "2" then
  86.       if limeOut == "ON" then
  87.          rsBack = rsBack-32
  88.          limeOut = "OFF"
  89.       else
  90.          rsBack = rsBack+32
  91.          limeOut = "ON"
  92.       end
  93.  
  94.    elseif answer == "4" then
  95.       if oilOutput == "ON" then
  96.          rsBack = rsBack-32768
  97.          oilOutput = "OFF"
  98.       else
  99.          rsBack = rsBack+32768
  100.          oilOutput = "ON"
  101.       end
  102.  
  103.    elseif answer == "5" then
  104.       loginScreen()
  105.    elseif answer == "secret" then
  106.       menuSecret()
  107.    else
  108.       menuMain()
  109.    end
  110.    redstone.setBundledOutput("back", rsBack)
  111.    menuMain()
  112.  
  113. end
  114.  
  115. function loginScreen()
  116.    term.clear()
  117.    term.setCursorPos(16, 5)
  118.    print("TheWallOS v2.0")
  119.    sleep(2)
  120.  
  121.    term.setCursorPos(16, 10)
  122.    write("User: ")
  123.    term.setCursorPos(16, 11)
  124.    write("Pass: ")
  125.    term.setCursorPos(23, 8)
  126.    print("Login")
  127.    term.setCursorPos(23, 18)
  128.    print("WallOS (C) Ormzen")
  129.      
  130.    term.setCursorPos(22, 10)
  131.    username = read()
  132.  
  133.    term.setCursorPos(16, 11)
  134.    write("Pass: ")
  135.  
  136.    pass = read("*")
  137.    curspos = 12
  138.    
  139.    while pass ~= "k157" do
  140.       term.setCursorPos(16, curspos)
  141.    
  142.       print("Try again!")
  143.    
  144.       term.setCursorPos(16, 11)
  145.    
  146.       term.clearLine()
  147.    
  148.       write("Pass: ")
  149.       pass = read("*")
  150.    
  151.       if curspos < 18 then
  152.      
  153.          curspos = curspos + 1
  154.    
  155.       end
  156.    
  157.    end
  158.  
  159. menuMain()
  160.  
  161. end
  162.  
  163.  
  164.  
  165.  
  166. function menuSecret()
  167.  
  168.    term.clear()
  169.    term.setCursorPos(10, 3)
  170.  
  171.    print ("Welcome "..username..", to the secret menu.")
  172.    term.setCursorPos(16, 5)
  173.    print ("How may I help you?")
  174.    term.setCursorPos(18, 6)
  175.    print ("(enter corresponding number)")
  176.    
  177.    term.setCursorPos(1, 8)
  178.    print ("1. Secret nuclear passage - "..secretPassOutput)
  179.    print ("2. Nuclear power          - "..nukeOutput)
  180.    print ("3. Back to main menu")
  181.    print ("")
  182.    print ("")
  183.  
  184.    term.setCursorPos(1, 16)
  185.    answer = read()
  186.    
  187.    if answer == "1" then
  188.       if secretPassOutput == "ON" then
  189.          rsBack = rsBack-1024
  190.          secretPassOutput = "OFF"
  191.       else
  192.          rsBack = rsBack+1024
  193.          secretPassOutput = "ON"
  194.       end
  195.  
  196.    elseif answer == "2" then
  197.       if nukeOutput == "ON" then
  198.          rsBack = rsBack-1
  199.          nukeOutput = "OFF"
  200.       else
  201.          rsBack = rsBack+1
  202.          nukeOutput = "ON"
  203.       end
  204.  
  205.    elseif answer == "3" then
  206.       menuMain()
  207.    else
  208.       menuSecret()
  209.    end
  210.  
  211.    redstone.setBundledOutput("back", rsBack)
  212.    menuSecret()
  213.    
  214.  
  215. end
  216.  
  217. loginScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement