Posted 01 April 2016 - 05:16 AM
First off I'll start by saying it's beyond funny how bad I am at coding, secondly, I've searched for a solution for an hour or so and can't find one that quite fits what I need so here's my question.
I have set up a redstone system that will power on some engines for a length of time dictated by the numeric value I've input. But, I want said numeric value to be displayed on a 2 x 2 monitor (left of the computer) ticking down, second after second. I'm not bothered about second/minute format (unless it won't be too much bother to add that in). Here's my code so far (don't judge exactly how sloppy it is):
The two monitor things I have written in there are prep to display the number.
I have set up a redstone system that will power on some engines for a length of time dictated by the numeric value I've input. But, I want said numeric value to be displayed on a 2 x 2 monitor (left of the computer) ticking down, second after second. I'm not bothered about second/minute format (unless it won't be too much bother to add that in). Here's my code so far (don't judge exactly how sloppy it is):
while true do
term.clear()
term.setCursorPos(1,1)
print("Turn the engines on? Y/N")
input = read()
if input == "Y" then
print("How long for? (Seconds)")
sleep(1)
redstone.setOutput("back",true)
local s = tonumber(read())
local mon = peripheral.wrap("left")
mon.clear()
sleep(s)
redstone.setOutput("back",false)
elseif input == "debug" then
os.exit()
end
end
os.reboot()
The two monitor things I have written in there are prep to display the number.
Edited by