tommy2805

ascensore piccolo RGBcraft

Jun 5th, 2024 (edited)
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local inputTop = "top"
  2. local inputRight = "right"
  3. local outputLeft = "left"
  4. local statoPorta = false
  5.  
  6. local function apriPorta()
  7.     statoporta = false
  8.     rs.setOutput(outputLeft, false)
  9. end
  10.  
  11. local function chiudiPorta()
  12.     statoporta = true
  13.     rs.setOutput(outputLeft, true)
  14. end
  15.  
  16. while true do
  17.     if rs.getInput(inputTop) then
  18.         if statoporta then
  19.             apriPorta()
  20.         end
  21.         while rs.getInput(inputTop) do
  22.             sleep(0.1)
  23.         end
  24.         sleep(1)
  25.         chiudiPorta()
  26.     elseif rs.getInput(inputRight) then
  27.         if not statoporta then
  28.             chiudiPorta()
  29.         end
  30.         while rs.getInput(inputRight) do
  31.             sleep(0.1)
  32.         end
  33.         sleep(4)
  34.         apriPorta()
  35.     end
  36.     sleep(0.1)
  37. end
  38.  
Advertisement
Add Comment
Please, Sign In to add comment