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

Tower Clock on Server

Started by fussel01, 09 October 2012 - 09:23 AM
fussel01 #1
Posted 09 October 2012 - 11:23 AM
I would like to have a clock tower on my server.
This is my first code of the clock.


monitor = peripheral.wrap("back")
monitor.setTextScale(5)
while true do
shell.run("clear")
shell.run("time")
sleep(0.2)
end


My problem is that every time I restart my server, i must clock
manually start the Program with "monitor back turmuhr".
How I have to rewrite the program so that I "clock tower"
can save it as a startup and the monitor output is also back?

Fussel01
JoshhT #2
Posted 09 October 2012 - 11:48 AM
I would probably put a disk drive next to your computer, and make these files on a floppy. That way it won't be lost.

Set your directory to /disk then create a new file called "startup".


mon = peripheral.wrap("back")
mon.setTextScale(5)
term.redirect(mon)
while true do
  term.clear()
  time = os.time()
  time = textutils.formatTime(time, false)
  term.write(time)
  sleep(0.2)
end

Should work just fine, let me know if there's any problems :D/>/>
fussel01 #3
Posted 09 October 2012 - 11:59 AM
Thanks for your help.
But if i start your Program there is no Output at the Back-Monitor ?
remiX #4
Posted 09 October 2012 - 12:04 PM
on the pc do edit startup
shell.run("programPath")

Save it then it should run when you open it even after a restart. Not sure how to make the pc boot up by itself though.
fussel01 #5
Posted 09 October 2012 - 01:23 PM
Ok, with that startup my (JoshhT´s) Program from above starts at reboot.
But there still is a blank screen on the Monitor !

PS.
Is there a Way to Display the Time in a 24 Hours Format without AM / PM ?
JoshhT #6
Posted 10 October 2012 - 07:59 AM
Ok, with that startup my (JoshhT´s) Program from above starts at reboot.
But there still is a blank screen on the Monitor !

PS.
Is there a Way to Display the Time in a 24 Hours Format without AM / PM ?

Perhaps try this instead, same deal, startup file.


mon = peripheral.wrap("back")
mon.setScale(5)

while true do
  mon.clear()
  time = os.time()
  time = textutils.formatTime(time, true) -- true = 24 hour time. false = 12 hour.
  mon.write(time)
  sleep(0.2)
end
fussel01 #7
Posted 10 October 2012 - 08:41 AM
Thank you very much. Thats it.
Now all is right !!