Guest User

fixed soem errors

a guest
May 6th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.42 KB | None | 0 0
  1. term.clear()
  2.  term.setCursorPos(1,1)
  3.  print("Defining Functions. Please Standby.")
  4.  write("0%")
  5.  
  6.  function MainScreen()
  7.     term.clear()
  8.     term.setCursorPos(1,1)
  9.     print("This console has been locked by an Administrator.")
  10.     print("Please choose from the following options:")
  11.     print("1: Local Login.")
  12.     print("2: Network Login.")
  13.     print("Please Select the number for the option chosen.")
  14.     while true do -- starts a loop
  15.         event ,var = os.pullEvent("char")
  16.         if var == ("1") then
  17.             LocalLogin()
  18.         elseif var == ("2") then -- added then here
  19.             NetworkLogin()
  20.         end
  21.     end
  22.  end
  23.  
  24.  term.clear()
  25.  term.setCursorPos(1,1)
  26.  write("10%")
  27.  
  28.  function LocalLogin()
  29.  term.clear()
  30.  term.setCursorPos(1,1)
  31.  print("This console has been locked by an administrator.")
  32.  print("Please input your credentials.")
  33.  print("Username: ")
  34.  var1 = read()
  35.  print("Password: ")
  36.  var2 = read()
  37.  if var1 == ("LocalAdmin") and var2 ==("AdminBypass") then
  38.  LocalAccepted()
  39.  else
  40.  LoginFailed()
  41.  end
  42.  end
  43.  
  44.  term.clear()
  45.  term.setCursorPos(1,1)
  46.  write("20%")
  47.  
  48.  function LocalAccepted()
  49.  var0 = ("0")
  50.  print("Local login accepted. Some features have been disabled.")
  51.  print("Please choose from the following options: ")
  52.  print("1: Initiate Tunnel Lockdown Procedure.")
  53.  print("2: Initiate Tunnel Release Procedure.")
  54.  print("3: Log Out.")
  55.  print("4: Shutdown.")
  56.  print("Please enter the number of the chosen option.")
  57.  r = os.pullEvent("char")
  58.  if r == ("1") then
  59.  Close()
  60.  elseif r == ("2") then -- added then
  61.  Open()
  62.  elseif r == ("3") then -- added then
  63.  MainScreen()
  64.  elseif r == ("4") then -- added then
  65.  Shutdown()
  66.  end
  67.  end
  68.  
  69.  term.clear()
  70.  term.setCursorPos(1,1)
  71.  write("30%")
  72.  
  73.  function NetworkLogin()
  74.  term.clear()
  75.  term.setCursorPos(1,1)
  76.  print("Please input your credentials for network login.")
  77.  print("Username: ")
  78.  var1 = read()
  79.  print("Password: ")
  80.  var2 = read()
  81.  rednet.open("top")
  82.  rednet.send(13, var1)
  83.  message = rednet.receive()
  84.  if message == ("Continue") then
  85.  rednet.send(13, var2)
  86.  else
  87.  LoginFailed()
  88.  end
  89.  message = rednet.receive()
  90.  if message == ("Approved") then
  91.  Menu()
  92.  else
  93.  LoginFailed()
  94.  end
  95.  end
  96.  
  97.  term.clear()
  98.  term.setCursorPos(1,1)
  99.  write("40%")
  100.  
  101.  function LoginFailed()
  102.  term.clear()
  103.  term.setCursorPos(1,1)
  104.  print("Login Failed. Try Again? Y/N")
  105.  r = os.pullEvent("char")
  106.  if r == ("y") then
  107.  MainScreen()
  108.  elseif r == ("n") then -- added then
  109.  Shutdown()
  110.  end
  111.  end
  112.  
  113.  term.clear()
  114.  term.setCursorPos(1,1)
  115.  write("50%")
  116.  
  117.  function LogOut()
  118.  term.clear()
  119.  term.setCursorPos(1,1)
  120.  textutils.slowWrite("Initiating console lock sequence. stand by.")
  121.  sleep(3)
  122.  MainScreen()
  123.  end
  124.  
  125.  term.clear()
  126.  term.setCursorPos(1,1)
  127.  write("60%")
  128.  
  129.  function Menu()
  130.  term.clear()
  131.  term.setCursorPos(1,1)
  132.  var0 = ("1")
  133.  print("Network Login Accepted. Please choose from the following Options.")
  134.  print("1: Initiate Tunnel Lockdown Procedure.")
  135.  print("2: Initiate Tunnel Release Procedure.")
  136.  print("3: Broadcast alert sequence.")
  137.  print("4: shutdown alert sequence.")
  138.  print("5: Log Out.")
  139.  print("6: Shutdown.")
  140.  r = os.pullEvent("char")
  141.  if r == ("1") then
  142.  Close()
  143.  elseif r == ("2") then
  144.  Open()
  145.  elseif r == ("5") then
  146.  LogOut()
  147.  elseif r == ("6") then
  148.  Shutdown()
  149.  end
  150.  end
  151.  
  152.  term.clear()
  153.  term.setCursorPos(1,1)
  154.  write("70%")
  155.  
  156.  function Open()
  157.  textutils.slowPrint("Sending release codes. Stand by.")
  158.  rednet.open("top")
  159.  rednet.send(ID, "open") -- dont quite understand what you are trying here -- rednet.send(##, "open")
  160.  rednet.close("top")
  161.  if var0 == ("0") then -- when comparing two vars we use == not =
  162.  LocalAccepted()
  163.  elseif var0 == ("1") then -- when comparing two vars we use == not =
  164.  Menu()
  165.  end
  166.  end
  167.  
  168.  term.clear()
  169.  term.setCursorPos(1,1)
  170.  write("80%")
  171.  
  172.  function Close()
  173.  textutils.slowPrint("Sending lockdown code. Stand by.")
  174.  rednet.open("top")
  175.  rednet.send(ID, "Close")  -- dont quite understand what you are trying here -- rednet.send(##, "Close")
  176.  rednet.close("top")
  177.  if var0 == ("0") then -- when comparing two vars we use == not =
  178.  LocalAccepted()
  179.  elseif var0 == ("1") then -- when comparing two vars we use == not =
  180.  Menu()
  181.  end
  182.  end
  183.  
  184.  term.clear()
  185.  term.setCursorPos(1,1)
  186.  write("90%")
  187.  
  188.  function Shutdown()
  189.  term.clear()
  190.  term.setCursorPos(1,1)
  191.  textutils.slowPrint("Shutting down Operating System...")
  192.  sleep(1)
  193.  os.shutdown()
  194.  end
  195.  
  196.  term.clear()
  197.  term.setCursorPos(1,1)
  198.  write("100%")
  199.  sleep(2)
  200.  MainScreen()
Advertisement
Add Comment
Please, Sign In to add comment