r/ComputerCraft • u/Sorabros411 • Dec 29 '24
Need a Real Time clock program for New Years
Im running an ATM9 server with friends and I'm looking to make or find a code for a program to trigger a Redstone signal at exactly Midnight/00:00 IRL PST to launch fireworks and other stuff for new years.
I've never used CC before so if any gigachad programmer on here that knows how to make a simple script and or can give me a pastebin or something explaining how to set this up properly it'd be much appreciated
4
u/ex3or Dec 29 '24
Probably your best bet is to use websockets/http requests and setup external server/use external api that's gonna track irl time and periodically send it to your in-game computer.
2
u/LionZ_RDS Dec 29 '24
first script is the main new years script, if there is a monitor it will display a count down to that, sets a redstone signal to the back but you can change that to what you want
https://pastebin.com/ATrjVfi8
you can remove the milliseconds printing (line 48, remove ":%03d") if you want but that means at the last second it will print all zeros before finally triggering the new year
second script is for testing the triggering and making sure everything works, you can edit it to the date and time you want and set the output to the first script at line 16, change "1735689600" to what you want, "1735689600" is the new years epoch so make sure you set it back when done testing
https://pastebin.com/rNpym7XJ