Advertisement
TurboTheSergal

[German] ComputerCraft Password Door (First Program Ever)

Jun 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. local seite = "left"
  2. local passwort = "enterme"
  3. local richtigzeit = 3
  4. local falschzeit = 10
  5. local richtigfarbe = colors.lime
  6. local falschfarbe = colors.red
  7. local standartfarbe = colors.black
  8. monitor = peripheral.wrap("top")
  9. monitor.clear()
  10. monitor.setCursorPos(1,1)
  11. monitor.setTextScale(3)
  12. while true do
  13.     term.clear()
  14.     term.setCursorPos(1,1)
  15.     term.setBackgroundColor(standartfarbe)
  16.     term.setCursorPos(99,99)
  17.     write("by: @TurboTheSergal")
  18.     term.setCursorPos(1,1)
  19.     write("Zum öffnen der Tür passwort eingeben!")
  20.     term.setCursorPos(1,2)
  21.     write("Passwort:")
  22.     monitor.clear()
  23.     monitor.setCursorPos(1,1)
  24.     monitor.setTextScale(0.5)
  25.     monitor.write("Hallo,")
  26.     monitor.setCursorPos(1,2)
  27.     monitor.setTextScale(0.5)
  28.     monitor.write("Um den Raum zu betreten")
  29.     monitor.setCursorPos(1,3)
  30.     monitor.setTextScale(0.5)
  31.     monitor.write("Passwort im Computer eingeben!")
  32.     local input = read("*")
  33.     if input == passwort then
  34.         term.clear()
  35.         term.setCursorPos(1,1)
  36.         term.setBackgroundColor(richtigfarbe)
  37.         print("Passwort richtig!")
  38.         rs.setOutput(seite,true)
  39.         sleep(richtigzeit)
  40.         rs.setOutput(seite,false)
  41.         os.shutdown()
  42.     else
  43.         term.clear()
  44.         term.setCursorPos(1,1)
  45.         term.setBackgroundColor(falschfarbe)
  46.         print("Passwort falsch!")
  47.         sleep(falschzeit)
  48.         os.shutdown()
  49.     end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement