Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- shell.run("stateCell")
- local tick = 0
- local firstTime = true
- local activeSide = "right"
- local outputSide = "front"
- local resetSide = "back"
- while true do
- if rs.getInput(activeSide) then
- if firstTime then
- print("------------")
- print("Timer Active")
- print("------------")
- print("Waiting for first pulse")
- os.pullEvent("redstone")
- print("First Pulse Recieved")
- firstTime = false
- end
- if tick ~= 0 then
- -- 60 Second
- if math.fmod(tick, 600) == 0 then
- redstone.setOutput(outputSide, true)
- end
- end
- -- Base time interval (1/10 second) == 1 Redstone tick == 2 Game Ticks
- sleep(.1)
- redstone.setOutput(outputSide, false)
- -- Reset tick count in case there is a max int size
- if tick == 36000 or rs.getInput(resetSide) then
- tick = 0
- end
- tick = tick + 1
- else
- term.clear()
- term.setCursorPos(1,1)
- redstone.setOutput(outputSide, false)
- print("Timer Disabled, Redstone high on ".. activeSide .." to enable.")
- os.pullEvent("redstone")
- if activeSide then
- firstTime = true
- tick = 0
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement