Guest User

test

a guest
Jun 26th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local monitor = peripheral.wrap("monitor_0")
  2.  
  3. --password function
  4. function PWD()
  5.   while true do
  6.     redstone.setOutput("back", true)
  7.     term.clear()
  8.     term.setCursorPos(1, 1)
  9.     print("Enter Password:")
  10.     input = read("*")
  11.     if input == "friend" then
  12.       redstone.setOutput("back", false)
  13.       Right()
  14.       sleep(4)
  15.       redstone.setOutput("back", true)
  16.     else
  17.       Wrong()
  18.       sleep(5)
  19.       Greet()
  20.     end
  21.   end
  22. end
  23.  
  24. --greeting function
  25. function Greet()
  26.   monitor.setBackgroundColor(colors.blue)
  27.   monitor.setTextColor(colors.yellow)
  28.   monitor.setCursorPos(1,1)
  29.   monitor.setTextScale(3)
  30.   monitor.clear()
  31.   monitor.write("Speak Friend")
  32.   monitor.setCursorPos(3,2)
  33.   monitor.write("and Enter")
  34. end
  35.  
  36. function Wrong()
  37.   monitor.setBackgroundColor(colors.red)
  38.   monitor.setTextColor(colors.black)
  39.   monitor.setCursorPos(2,2)
  40.   monitor.setTextScale(4)
  41.   monitor.clear()
  42.   monitor.write("WRONG!")
  43. end
  44.  
  45. function Right()
  46.   Greet()
  47.   monitor.clear
  48.   monitor.write("Welcome!")
  49.   sleep(5)
  50.   Greet()
  51. end
  52.  
  53.  
  54. Greet()
  55. --PWD()
Advertisement
Add Comment
Please, Sign In to add comment