GauHelldragon

BeeWatch 0.2

Apr 4th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local left = redstone.getInput("left")
  2. local right = redstone.getInput("right")
  3.  
  4.  
  5. function SoundAlarm()
  6.     for i=1,5 do
  7.         redstone.setOutput("top",true)
  8.         os.sleep(0.5)
  9.         redstone.setOutput("top",false)
  10.         os.sleep(0.5)
  11.     end
  12. end
  13.  
  14. while true do
  15.     os.pullEvent("redstone")
  16.     newLeft = redstone.getInput("left")
  17.     newRight = redstone.getInput("right")
  18.     if ( (  newLeft == false and left == true ) or ( newRight == false and right == true) ) then
  19.         SoundAlarm()
  20.     end
  21.     left = newLeft
  22.     right = newRight
  23.     os.sleep(5)
  24. end
Add Comment
Please, Sign In to add comment