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

Computer clock/time not working properly

Started by Ziqi, 18 May 2014 - 10:46 AM
Ziqi #1
Posted 18 May 2014 - 12:46 PM
Hello! I am trying to make a script that (for now it uses random numbers) will show the in game time. The problem i have (it is not very big, but I can't seem to get it working) is that the ':' in the time is not flashing every second. My code is at this link; http://pastebin.com/nKXHmr9z


EDIT: Updated the link.
Edited on 18 May 2014 - 02:12 PM
RoD #2
Posted 18 May 2014 - 02:58 PM
The pastebin has been removed. If you want to make it flash you will need to use sleep(1) and make it blink every second. There are a few ways of doing this, if i have a look at your code i can tell you the best way.
Ziqi #3
Posted 18 May 2014 - 05:04 PM
The pastebin has been removed. If you want to make it flash you will need to use sleep(1) and make it blink every second. There are a few ways of doing this, if i have a look at your code i can tell you the best way.
I updated the pastebin link.
Bubba #4
Posted 18 May 2014 - 06:57 PM
The pastebin has been removed. If you want to make it flash you will need to use sleep(1) and make it blink every second. There are a few ways of doing this, if i have a look at your code i can tell you the best way.
I updated the pastebin link.

No you didn't. The link is still broken.
viluon #5
Posted 18 May 2014 - 07:50 PM
The link should be http://pastebin.com/nKXHmr9z

Here you go

local hours=12
local minutes=8
local function c()
 term.clear()
 term.setCursorPos(1,1)
end
while true do
 write(hours..":"..minutes)
 sleep(1)
 c()
 write(hours.." "..minutes)
 sleep(1)
 c()
end
Edited on 18 May 2014 - 05:55 PM
flaghacker #6
Posted 18 May 2014 - 08:38 PM
It works for me… Are you having lag issues or something? Or does it give an error?
Ziqi #7
Posted 18 May 2014 - 09:18 PM
The link should be http://pastebin.com/nKXHmr9z

Here you go

local hours=12
local minutes=8
local function c()
term.clear()
term.setCursorPos(1,1)
end
while true do
write(hours..":"..minutes)
sleep(1)
c()
write(hours.." "..minutes)
sleep(1)
c()
end
Thank you. This solved my problem. I just changed your term.clear() to term.clearLine(). Thank you. And no, i don't have lag issues.
RoD #8
Posted 19 May 2014 - 08:44 AM
lol he updated the text but not the link XD
Ziqi #9
Posted 19 May 2014 - 02:20 PM
lol he updated the text but not the link XD
As you might tell i'm quite new to this forum. ;p
RoD #10
Posted 19 May 2014 - 07:42 PM
lol he updated the text but not the link XD
As you might tell i'm quite new to this forum. ;p

Ah, its just html. You delete the previous link (the full url from the http:// to the pastebin code) and then click on the link button under the size tab in the editor ( you can select text to be like a button ) and paste there your url. If you select a text, lets say "hello world" and click on the link you can now paste there a link to a website, in this case i will paste the youtube website. The result is:

hello world

Hope you get it :)/> any question just shoot.
Edited on 19 May 2014 - 05:43 PM