the first thing that comes to mind to add in a pause thing is add a
parallel.waitForAny(function 1, function 2)
This makes it so if one finishes it will stop the other
With this though you will need to move the repeat part into a function and make a second function to watch for input
Something like (copying your last posted code so if it changed just put your new one in)
function Repeat()
repeat
if i > 0 then --if there are minutes
if j > 0 then --and seconds
j = j - 1 --subtract a second
else
j = 59 --otherwise no minutes left and seconds are now 59 and counting
i = i - 1
end
else
if j > 0 then --finish countdown of only seconds (no minutes remaining)
j = j - 1
end
end
sleep(1)
mon.setCursorPos(1,1)
mon.write(i) -- print minutes
mon.setCursorPos(2,1)
mon.write(":") -- print ":" seperator
mon.setCursorPos(3,1)
mon.write(j) -- print seconds (strangely shows up as "##.0")
until i == 0
rs.setOutput(left,true) -- trigger redstone output
sleep(1)
rs.setOutput(left,false) -- deactivate trigger
end
Should work for the countdown part
and something like
function CheckPause()
while true do
userInput = read()
if userInput == 'pause' then
pause = true
elseif userInput == 'reset' then
-- Where you would want it to reset to
end
end
end
Should work for the checking function
Then adding in a pause variable to the until check or something along the lines of
until i == 0 and pause ~= true
Then when you want it to start again you call to the
parallel.waitForAny(Function 1, Function 2)
again to start so it can be paused later if needed
Hope this helps and sorry if I did too much of it for you xD trying to get all the practice I can.