Advertisement
DOGGYWOOF

Unlock door debug

Jan 6th, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. -- Function to open the door based on the given side
  2. local function openDoor(side)
  3. -- Check the side input and perform actions accordingly
  4. if side == "left" then
  5. redstone.setOutput("left", true) -- Replace "left" with the actual side where the door is connected
  6. sleep(2) -- Keep the door open for 2 seconds (you can adjust this as needed)
  7. redstone.setOutput("left", false) -- Replace "left" with the same side to close the door
  8. elseif side == "right" then
  9. redstone.setOutput("right", true) -- Replace "right" with the actual side where the door is connected
  10. sleep(2) -- Keep the door open for 2 seconds (you can adjust this as needed)
  11. redstone.setOutput("right", false) -- Replace "right" with the same side to close the door
  12. else
  13. print("Invalid side input. Please enter 'left' or 'right'.")
  14. end
  15. end
  16.  
  17. -- Ask the user which side the door is on
  18. print("Which side is the door on? (left/right)")
  19. local sideInput = read() -- Read user input
  20.  
  21. -- Open the door based on the given side input
  22. openDoor(sideInput)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement