Advertisement
MuChT007

toit arene

Aug 21st, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. -- codes couleurs --
  2.     white=1
  3.     orange=2
  4.     magenta=4
  5.     lightBlue=8
  6.     yellow=16      
  7.     lime=32        
  8.     pink=64        
  9.     gray=128        
  10.     lightGray=256  
  11.     cyan=512        
  12.     purple=1024    
  13.     blue=2048      
  14.     brown=4096      
  15.     green=8192      
  16.     red=16384      
  17.     black=32768
  18.     blank=0
  19.  -- état des sorties redstone et statut des portes --
  20.     Sortie=0
  21.     etat=fermer
  22.  
  23. -- function --
  24.  
  25. function fermeture()
  26.     print("Fermeture en cours")
  27.    for i = 1,6 do  
  28.     redstone.setBundledOutput("bottom", red)
  29.     sleep(1)
  30.     redstone.setBundledOutput("bottom", 0)
  31.     sleep(1)
  32.    end
  33. print("Fermer")
  34. end
  35. function ouverture()
  36.     print("Ouverture en cours")
  37.    for i = 1,6 do  
  38.     redstone.setBundledOutput("bottom", white)
  39.     sleep(1)
  40.     redstone.setBundledOutput("bottom", 0)
  41.     sleep(1)
  42.    end
  43. print("Ouvert")
  44. end
  45.  
  46. fermeture()
  47. etat = 0
  48. while true do
  49.  event = os.pullEvent()
  50.  
  51. if colors.test (redstone.getBundledInput("top"), colors.white) and etat==1 then
  52.     fermeture()
  53.     etat = 0
  54.     sleep(2)
  55.    end
  56.  
  57. if colors.test (redstone.getBundledInput("top"), colors.white) and etat==0 then
  58.     ouverture()
  59.     etat = 1
  60.     sleep(2)
  61.    end
  62.        
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement