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

[Answered] Need help with clock

Started by ExtraRandom, 01 September 2012 - 09:04 PM
ExtraRandom #1
Posted 01 September 2012 - 11:04 PM
Hi there, I am making a Clock (Minecraft in game time not real life) for my server and i have a way to find the time and printing it but i want it to replace what it wrote instead of writing more and more, i hope this makes sense.

heres the code if you need it

function infiniteLoop()
while true do

local time = os.time()
time = textutils.formatTime(time, false)
print(time)
sleep(0.8)

end
end

infiniteLoop()
Xhisor #2
Posted 01 September 2012 - 11:07 PM
Hi there, I am making a Clock (Minecraft in game time not real life) for my server and i have a way to find the time and printing it but i want it to replace what it wrote instead of writing more and more, i hope this makes sense.

heres the code if you need it

function infiniteLoop()
while true do

local time = os.time()
time = textutils.formatTime(time, false)
print(time)
sleep(0.8)

end
end

infiniteLoop()

function infiniteLoop()
while true do
local time = os.time()
time = textutils.formatTime(time, false)
term.clear()
term.setCursorPos(1,1)
print(time)
sleep(0.8)
end
end
infiniteLoop()
There you go!
Matrixmage #3
Posted 01 September 2012 - 11:08 PM
add "term.clear" to clear the screen

Edit: ninja'd xD
Xhisor #4
Posted 01 September 2012 - 11:09 PM
add "term.clear" to clear the screen

Edit: ninja'd xD
MOHAHAHAHAHAHA! :)/>/>
ExtraRandom #5
Posted 01 September 2012 - 11:13 PM
oh thanks lol forgot about term.clear
jaytime104 #6
Posted 02 September 2012 - 05:22 PM
ok this program is sweet but can u make it to where itll scale wit my monitors the monitors are on top of my computer please help
Flipsanta #7
Posted 15 December 2012 - 11:54 PM
Hello
i am new to computer craft and i dont know why this code is not working for me.
i wrote that into a program called "clock" and got my monitor on the right, so i use th command:"monitor right clock" and then this error comes on the monitor: "textutils:30: attempt to compare function with number"
plz help me :D/>


function infiniteLoop()
while true do
local time = os.time()
time = textutils.formatTime(time, false)
term.clear()
term.setCursorPos(1,1)
print(time)
sleep(0.8)
end
end
infiniteLoop()
theoriginalbit #8
Posted 16 December 2012 - 12:40 AM
Hello
i am new to computer craft and i dont know why this code is not working for me.
i wrote that into a program called "clock" and got my monitor on the right, so i use th command:"monitor right clock" and then this error comes on the monitor: "textutils:30: attempt to compare function with number"
plz help me :D/>


function infiniteLoop()
while true do
local time = os.time()
time = textutils.formatTime(time, false)
term.clear()
term.setCursorPos(1,1)
print(time)
sleep(0.8)
end
end
infiniteLoop()

just try replacing term. with monitor. and running like normal. if that doesnt work add this to the front

mon = peripheral.wrap("right")

then replace all the term. with mon.