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

Help me plz

Started by darkreaper_44, 18 November 2012 - 12:13 PM
darkreaper_44 #1
Posted 18 November 2012 - 01:13 PM
OK so i pretty much am looking for a couple things.

A: Is it possible to keep a computer on and running automatically, like when server resets the computer turns off then
i need to run the program onto the monitor again

B: I want to make a clock that is on 24/7 like auto turns on but cant do it without A, but maybe there is a forum post
that shows a program code that keeps it on after a server reset or turns itself on automatically

thats it for now, i want to get into more complicated stuff but i need to figure out simple stuff first
thanks for help ahead of time
Orwell #2
Posted 18 November 2012 - 01:18 PM
A: Put your code in a file called 'startup', so do 'edit startup' from command line.

B:

while true do
  local time = os.time()
  local timeFormatted = textutils.format(time, false)    -- change false to true for 24h format
  print( timeFormatted )
  sleep(1)
end
That prints the current time every second. You should be able to go further on from this. :)/>/>
that prints
Lyqyd #3
Posted 18 November 2012 - 01:19 PM
The computer should boot fine if it was on when the chunk it was in was unloaded. It will also run its startup file, so simply place code in there to start your program running on the monitor again.