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

Time on monitor

Started by WhatThePiep, 22 July 2012 - 05:26 PM
WhatThePiep #1
Posted 22 July 2012 - 07:26 PM
How u get a program that displays the time on a monitor the monitor is 4x2 and i want the time on the first row with scale 5 :)/>/> if thats possible..
I can use now shell.run("monitor","front","time") but idk how to scale then :C
so help ;D?
KevinW1998 #2
Posted 22 July 2012 - 07:29 PM
You want to display the time then use os.time()

ymon = peripheral.wrap(yourside) --replace it with the side of the monitor
ymon.setTextScale(5)
term.redirect(ymon)
print(textutils.formatTime(os.time(),true))
term.restore()
WhatThePiep #3
Posted 22 July 2012 - 07:33 PM
You want to display the time then use os.time()

ymon = peripheral.wrap(yourside) --replace it with the side of the monitor
ymon.setTextScale(5)
term.redirect(ymon)
print(textutils.formatTime(os.time(),true))
term.restore()
ty :)/>/>
WhatThePiep #4
Posted 22 July 2012 - 07:39 PM
You want to display the time then use os.time()

ymon = peripheral.wrap(yourside) --replace it with the side of the monitor
ymon.setTextScale(5)
term.redirect(ymon)
print(textutils.formatTime(os.time(),true))
term.restore()
It doesnt really update… its stuck on 4:50
everytime i reboot it it updates but i dont wanna reboot all the time..
KevinW1998 #5
Posted 22 July 2012 - 07:42 PM
yep If you want to update the time you should use a while true do loop

ymon = peripheral.wrap(yourside) --replace it with the side of the monitor
ymon.setTextScale(5)
term.redirect(ymon)
while true do
sleep(0)
term.setCursorPos(1,1)
write(textutils.formatTime(os.time(),true))
end
term.restore()
If you whant to stop it use Ctrl + T!
WhatThePiep #6
Posted 22 July 2012 - 07:51 PM
yep If you want to update the time you should use a while true do loop

ymon = peripheral.wrap(yourside) --replace it with the side of the monitor
ymon.setTextScale(5)
term.redirect(ymon)
while true do
sleep(0)
term.setCursorPos(1,1)
write(textutils.formatTime(os.time(),true))
end
term.restore()
If you whant to stop it use Ctrl + T!
Thank you so much bro! :o/>/>
any way to get the date also? or is that not possible :)/>/>
KevinW1998 #7
Posted 22 July 2012 - 07:55 PM
Nope the mincraft Days haven't got a date so far :)/>/>
WhatThePiep #8
Posted 22 July 2012 - 08:39 PM
Nope the mincraft Days haven't got a date so far :)/>/>
The Clock buggs when a new day starts.. well minecraft day its says now: 07:579 , the 9 doesnt supose to be there :X know how to fix?
Boomer_RAWR #9
Posted 22 July 2012 - 08:44 PM
i also saw it :)/>/> is it just a server bug?
KevinW1998 #10
Posted 22 July 2012 - 09:03 PM
uhm you should clear the line

ymon = peripheral.wrap(yourside) --replace it with the side of the monitor
ymon.setTextScale(5)
term.redirect(ymon)
while true do
sleep(0)
term.setCursorPos(1,1)
write(textutils.formatTime(os.time(),true).."    ")
end
term.restore()
I've just added some spaces :)/>/>
Lyqyd #11
Posted 22 July 2012 - 09:11 PM
Wait, why would you want a death chest that lasts only three minutes (screenshot)? The dropped items last five!
WhatThePiep #12
Posted 22 July 2012 - 09:21 PM
uhm you should clear the line

ymon = peripheral.wrap(yourside) --replace it with the side of the monitor
ymon.setTextScale(5)
term.redirect(ymon)
while true do
sleep(0)
term.setCursorPos(1,1)
write(textutils.formatTime(os.time(),true).."	")
end
term.restore()
I've just added some spaces :)/>/>
Doesnt work now something wrong with line 6
KevinW1998 #13
Posted 22 July 2012 - 09:25 PM
haven't change anything on line 6
WhatThePiep #14
Posted 22 July 2012 - 09:35 PM
haven't change anything on line 6
line 7 i mean sorry
KevinW1998 #15
Posted 22 July 2012 - 10:45 PM
try to use

write(tostring(textutils.formatTime(os.time(),true)).."   ")