Advertisement
Guest User

functions

a guest
Jan 26th, 2015
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. ----[[ Functions ]]----
  2.  
  3. function OS()
  4.  
  5.  term.setTextColor( colours.lime )
  6.  print("Kersey Operating System v0.6")
  7.  print()
  8.  
  9. end
  10.  
  11. ----------------
  12.  
  13. function clear()
  14.  
  15.  term.setBackgroundColour( colours.black )
  16.  term.setCursorPos( 1, 1 )
  17.  term.clear()
  18.  
  19. end
  20.  
  21. ---------------------
  22.  
  23. function afterClear()
  24.  
  25.  OS()
  26.  term.setTextColor( colours.white )
  27.  
  28. end
  29.  
  30. --------------------
  31.  
  32. function passColor()
  33.  
  34.  term.setBackgroundColor( colours.white )
  35.  term.setCursorPos( 1, 1 )
  36.  term.clear()
  37.  OS()
  38.  term.setTextColor( colours.blue )
  39.  
  40. end
  41.  
  42. -------------------
  43.  
  44. function other()
  45.  
  46.  term.setTextColor( colours.red )
  47.  print()
  48.  print("ACCESS DENIED!")
  49.  term.setTextColor( colours.blue )
  50.  sleep(1)
  51.  print("shutting down")
  52.  sleep(3)
  53.  os.shutdown()
  54.  
  55. end
  56.  
  57.  ----------------
  58.  
  59. function pass1()
  60.  
  61.  os.pullEvent = os.pullEventRaw
  62.  passColor()
  63.  pass = "Brennan Kersey"
  64.  write("First & Last name: ")
  65.  term.setTextColor( colours.black )
  66.  input = read()
  67.   if input == pass then
  68.    
  69.   else
  70.    other()
  71.    
  72.   end
  73.  end
  74.  
  75.  ----------------
  76.  
  77. function pass2()
  78.  
  79.  os.pullEvent = os.pullEventRaw
  80.  passColor()
  81.  pass = "Cloud"
  82.  write("Password: ")
  83.  term.setTextColor( colours.black )
  84.  input = read("*")
  85.   if input == pass then
  86.  
  87.   else
  88.    other()
  89.  
  90.   end  
  91.  end
  92.  
  93.  ----------------
  94.  
  95. function pass3()
  96.  
  97.  os.pullEvent = os.pullEventRaw
  98.  passColor()
  99.  pass = "1937"
  100.  write("PIN: ")
  101.  term.setTextColor( colours.black )
  102.  input = read("*")
  103.   if input == pass then
  104.  
  105.   else
  106.    other()
  107.    
  108.  end  
  109. end
  110.  
  111. ----[[ Main Program ]]----
  112.  
  113. pass1()
  114. pass2()
  115. pass3()
  116. clear()
  117. OS()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement