Advertisement
Enderlein

DoorController

Jun 21st, 2018 (edited)
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. rednet.open("right")
  2.  
  3. local function passwordEntry ()
  4.     while true do
  5.         term.clear()
  6.  
  7.         term.setCursorPos(1, 1)
  8.  
  9.         print("Please enter password to open/close door")
  10.  
  11.         input = read("*")
  12.  
  13.         if input == "password" then
  14.             redstone.setOutput("left", true)
  15.             sleep(2)
  16.             redstone.setOutput("left", false)
  17.         end
  18.     end
  19. end
  20.  
  21. local function listen ()
  22.     while true do
  23.         a, b, c, d, e = os.pullEvent()
  24.  
  25.         if c == "password" then
  26.             redstone.setOutput("left", true)
  27.             sleep(2)
  28.             redstone.setOutput("left", false)
  29.         end
  30.     end
  31. end
  32.  
  33. while true do
  34.     parallel.waitForAny(passwordEntry, listen)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement