This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
sjele's profile picture

[help] Setting time for a countdown timer

Started by sjele, 29 July 2012 - 07:06 PM
sjele #1
Posted 29 July 2012 - 09:06 PM
So have been working on a countdown timer, to set off something. I don't know what yet :ph34r:/>/>
So i tried setting the hour time using this code, and that dident work. Beacuse i think when i add it up to the var h, witch is hour i allso add in read(). As thats how fail my code is.

os.pullEvent = os.pullEventRaw
--Vars
s = 0 --Seconds
m = 0 --Minutes
h = 0 --Hours
hh = 0 -- What to add to h.
print ("Count down timer for: ")
print ("Follow instruction on screen on how to set the time")
print (" Set the hour time")
write ("Hours : ")
input = read()
input = hh
h = h + hh
sleep(2)
print("Hour time set as "..h.."")

So how would i set the var (hh) with an input?

Thanks
ChiknNuggets #2
Posted 29 July 2012 - 09:40 PM
i just tryed this out didnt work, so i changed input = read() with hh = read() and removed input = hh and worked fine
sjele #3
Posted 29 July 2012 - 09:58 PM
Will it print the number you inserted into terminal then?
If it worked could you send me /post the code here?
ChiknNuggets #4
Posted 29 July 2012 - 10:15 PM

os.pullEvent = os.pullEventRaw
--Vars
s = 0 --Seconds
m = 0 --Minutes
h = 0 --Hours
hh = 0 -- What to add to h.
print ("Count down timer for: ")
print ("Follow instruction on screen on how to set the time")
print (" Set the hour time")
write ("Hours : ")
hh = read()
h = h + hh
sleep(2)
print("Hour time set as "..h.."")