1 posts
Posted 17 November 2016 - 10:54 PM
hey so im using the time command with a monitor but i'm having trouble making it constantly update can someone help me
8543 posts
Posted 18 November 2016 - 01:49 AM
Moved to Ask a Pro.
119 posts
Posted 18 November 2016 - 02:26 AM
Use a
while true do
to print the os.time() command.
3057 posts
Location
United States of America
Posted 18 November 2016 - 02:46 AM
Don't forget to yield somewhere in that loop!
749 posts
Location
BOO!!
Posted 18 November 2016 - 02:20 PM
Don't forget to yield somewhere in that loop!
If you want it to constantly show time, queue an event before yielding
9 posts
Posted 18 November 2016 - 04:20 PM
Its accualy pretty easy
while true do
os.time()
sleep(0)
end
the sleep(0) makes it loop forever without stopping(if you leave the chunks it wil stop, or if you terminate it)
Also to run it on the monitor
monitor (side) (program)
Edited on 18 November 2016 - 03:22 PM
8543 posts
Posted 18 November 2016 - 05:43 PM
When showing in-game time, you should sleep for 0.6 seconds at a minimum. The time doesn't change more often than that.
7083 posts
Location
Tasmania (AU)
Posted 20 November 2016 - 02:14 AM
Truth be told, sleep(0) yields for a twentieth of a second anyway - which happens to be how often the clock increments. This is because the timer events used by the sleep function can only be generated upon a server tick.
Manually queuing and instantly pulling your own events will indeed waste a lot of processor power.