Posted 19 November 2012 - 04:41 AM
I'm trying to make a timer that starts and finishes on a redstone signal but don't not how to code it. Can anybody help?
ticks = 16
for i = 1, ticks do
rs.setOutput("back", true)
sleep(0.5)
rs.setOutput("back", false)
end
local on = true
local timer = os.startTimer(0)
local interval = 0.5
while on do
local event, p1, p2, p3 = os.pullEvent()
if event == "timer" and p1 == timer then
timer = os.startTimer(interval)
end
end
this is superior as it gives easy and working acess to events.