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

Christmas Timer Project

Started by minedablock, 04 November 2015 - 05:42 AM
minedablock #1
Posted 04 November 2015 - 06:42 AM
Hi every one,

I am setting up a christmas event for a server and I was wondering if any one could help me out :3

The idea is that on every day of december, a redstone pulse will be sent out of a advanced computer through to some dispensers were items will shoot out. I am having some trouble and was wondering if any one could help me out :D/>

It would be great if we could get a monitor that has a timer counting down day after day, but if you can't do it, it's no problem.

Hope you can help out <3
Edited on 04 November 2015 - 06:05 AM
Creator #2
Posted 04 November 2015 - 08:19 AM
Use os.date to find the date and use sleep(3600*24).
oeed #3
Posted 04 November 2015 - 08:32 AM
Use os.date to find the date and use sleep(3600*24).

The only issue with that is if the computer or server reboots it might mess up and os.date isn't actually the real world date, it's in-game.

You could use a time API to get the current date of the month. You then open a file with the last day that the had the date of the month the last item was spat out and see if they're equal. If they're not save the new date to that file and spit the item out. Then just setup a timer like Creator suggested (maybe with half the time though just to be sure) and run that code.

One thought though, items normally despawn after just a few minutes, so you might want to put them in a chest or something.