Jump to content




[Question] trouble with displaying time


  • You cannot reply to this topic
3 replies to this topic

#1 Oneredweasel

  • New Members
  • 2 posts

Posted 26 November 2012 - 07:17 AM

Ok, firstly I'm a complete noob to CC and Lua so if I'm making a really obvious mistake cut me a little slack.

Anyway what I want to do is fairly simple: have a monitor that displays a short message and the time. Displaying my message was easy but adding in the time is confusing me. This is the program I have now (named "Text"):

term.clear
term.setCursorPos(5, 3)
nTime == os.time()
print ("Welcome Player")\(
print ("The time is "..textutils.formatTime ( nTime, false))

every time i try to run this I get this error code; bios:206: [string "text"]:2: '=' expected
it says to add an = sign but I don't think I need one anywhere it's really anoying

also will I need some sort of loop to refresh the time and keep it updated (I'll be displaying all this on a big monitor)
thanks!

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 26 November 2012 - 07:18 AM

On the first line, there should be () after term.clear.

Also, on line 4, that ( probably shouldn't be there.

#3 JoshhT

  • New Members
  • 64 posts
  • LocationAustralia

Posted 26 November 2012 - 10:28 PM

Kingdaro pointed out two errors.
I also spotted this.
nTime == os.time()

Should be

nTime = os.time()


#4 Oneredweasel

  • New Members
  • 2 posts

Posted 27 November 2012 - 12:14 AM

THANKS! that was a quick response and this has been bothering me to no end, all I had to do was add that () and then turn the == on line 3 into a =.
p.s. the \( on line 4 was just a typo, my actual program didn't have that





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users