I need again help.
Situation:
I have scoreclock who runs after pressing button from left side. I need stop this time and after some time continue countdown. I would like use this button on left side for starting countdown and pausing.
If somebody can help….
Code:
rs.setOutput("right",true)
print("Set countdown to game") --only need minutes
print("Minutes?") --only need minutes
write("-> ")
minute = tonumber(read()) --input directly as number(avoid string)
print("Seconds") --only need minutes
write("-> ")
sec = tonumber(read()) --input directly as number(avoid string)
print("TIme added, press button to start countdown")
local j = sec --declare seconds variable
local i = minute ---declare minutes variable
min = i
sleep(1)
--Returning Results
mon.setTextScale(5)
mon.setCursorPos(7,5)
mon.write(min..":"..sec)
os.pullEvent("redstone")
if rs.getInput("left") then
rs.setOutput("right",true)
repeat
if i > 0 then
if j > 0 then
j = j - 1
else
j = 59
i = i - 1
end
else
if j > 0 then
j = j - 1
else
done = true
end
end
if j > 9 then
sec = j
else
sec = "0"..j
end
min = i
sleep(1)
--Returning Results
mon.setTextScale(5)
mon.setCursorPos(7,5)
mon.write(min..":"..sec.." ")
until j == 0 and i == 0
mon.setCursorPos(8,3)
mon.write("1")
rs.setOutput("right",true) -- trigger redstone output
sleep(1)
end