Advertisement
Muzze77

LavaStation

Apr 3rd, 2014
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. password = "KraftwerkLava"
  2. side = "back"
  3.  
  4. function betrieb()
  5.  
  6.     shell.run("clear")
  7.     sleep(0.05)
  8.     print("Anschalten oder Abschalten?")
  9.     wahl = io.read()
  10.     wahl = string.lower(wahl)
  11.     if wahl == "anschalten" then
  12.     rs.setOutput(side, true)
  13.     print("Angeschaltet")
  14.     rs.setOutput("left", true)
  15.     rs.setOutput("right", false)
  16.     sleep(2)
  17.     elseif wahl == "abschalten" then
  18.     rs.setOutput("back", false)
  19.     print("Abgeschaltet")
  20.     rs.setOutput("right", true)
  21.     rs.setOutput("left", false)
  22.     sleep(2)
  23.     else
  24.     sleep(0.1)
  25.     betrieb()
  26.     end
  27. end
  28.  
  29.  
  30. while true do
  31.    
  32.    
  33.     function password1()
  34.     shell.run("clear")
  35.     sleep(0.03)
  36.     print("Bitte Password eingeben: ")
  37.     term.setCursorPos(25, 1)
  38.     pw = read("*")
  39.     if pw == password then
  40.     betrieb()
  41.    
  42.     else
  43.     print("Falsche Eingabe")
  44.     sleep(0.1)
  45.     startup()
  46.     end
  47.     end
  48.    
  49.     function startup()
  50.             term.setTextColor(colors.red)
  51.         shell.run("clear")
  52.         sleep(0.01)
  53.         print("W-Taste zum fortfahren.")
  54.         local evt, key = os.pullEvent("char")
  55.         key = string.lower(key)
  56.         if key == "w" then
  57.         password1()
  58.         else
  59.         startup()
  60.         end
  61.     end
  62.     startup()
  63.     sleep(0.1)
  64.  
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement