DerMarten

Door

May 3rd, 2015
232
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Computercraft Door System by DerMarten
  2. ------ Variablen -------------------------
  3. local doorSide = "right"
  4. local password = "1235"
  5. local input = ""
  6. local accept = false
  7. local run = true
  8. ------------------------------------------
  9. ------ Functionen ------------------------
  10. function readInput()
  11.     shell.run("clear")
  12.     write("Passwort: ")
  13.     input = io.read()
  14. end
  15. function checkPassword()
  16.     if input == password then
  17.         accept = true
  18.     else
  19.         accept = false
  20.     end
  21. end
  22. function doDoor()
  23.     rs.setOutput(doorSide,accept)
  24. end
  25. ------------------------------------------
  26. ----------- Main -------------------------
  27. function main()
  28.     while run do
  29.         readInput()
  30.         checkPassword()
  31.         doDoor()
  32.     end
  33. end
  34. main()-- Programm Starten
RAW Paste Data