Posted 05 April 2012 - 06:08 PM
Hey im new on this site.
Only a few days ago i began playing with Computercraft.
I then wanted to make a clock to show the time, and found the pastebin to a clock
I fiddled a little with it and made it able to set the hour, minute, second value for the clock, but it doesn't reset my second value to 0 after the first run.
i would like to get a little guidance.
the code is below in the spoiler
Only a few days ago i began playing with Computercraft.
I then wanted to make a clock to show the time, and found the pastebin to a clock
I fiddled a little with it and made it able to set the hour, minute, second value for the clock, but it doesn't reset my second value to 0 after the first run.
i would like to get a little guidance.
the code is below in the spoiler
Spoiler
hours = 0
minutes = 0
seconds = 0
term.clear()
term.setCursorPos(1,1)
print("hours: ")
hours = io.read()
term.clear()
term.setCursorPos(1,1)
print("minutes: ")
minutes = io.read()
term.clear()
term.setCursorPos(1,1)
print("seconds: ")
seconds = io.read()
term.clear()
term.setCursorPos(1,1)
function clock()
for seconds = seconds, 60, 1 do
shell.run("clear")
print (hours, ":",minutes,":", seconds)
print ("hours:minutes:seconds")
if seconds == (60) then
minutes = minutes + 1
clock()
end
if minutes == (60) then
hours = hours + 1
minutes = 0
end
if hours == (24) then
hours = 0
end
sleep (1)
end
seconds = 0
end
clock()