Advertisement
pcchou

[ComputerCraft] PulseLimitor

Aug 23rd, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local inputSide = "back"
  2. local outputSide = "front"
  3. local isGetting = false
  4.  
  5. while true do
  6.   while true do
  7.     sleep(0)
  8.     local event = os.pullEvent()
  9.     if event == "redstone" then
  10.       print("Redstone action detected.")
  11.       break
  12.     end
  13.   end
  14.  
  15.   if rs.getInput(inputSide) == true and isGetting == false then
  16.     print("Outputing.")
  17.     isGetting = true
  18.     rs.setOutput(outputSide, true)
  19.     sleep(0.5)
  20.     rs.setOutput(outputSide, false)
  21.   elseif isGetting == true and rs.getInput(inputSide) == false then
  22.     print("Original pulse gone.")
  23.     isGetting = false
  24.   end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement