Here is a simple program that sort of does what you want. (assuming it works, as I haven't tested it)
Code:
local sleepTime = 3
local toAdd = 5
local i = 0
while true do
print(i)
sleep(sleepTime)
i = i + toAdd
end
This will just write the number to a new line on the screen itself. Luckily you can change that using the monitor command
http://www.computercraft.info/wiki/Monitor
If the monitor is placed on the top that should thus be
Code:
monitor top {name of this script}
Note that this counter will reset if the chunk gets unloaded as the computer will shutdown.
So.... some way to improve this would be to use the file api to store the number and read it on startup and write to it every time the number changes.
https://www.lua.org/pil/21.2.html
Read on how to work with files here:
https://www.lua.org/pil/21.2.html
Also, making use of the term api instead of the print function would improve it. That way you can have the number at a fixed place
http://www.computercraft.info/wiki/index.php?title=Term_(API)&redirect=no
Combined with using the monitor directly from withing the code would probably also be nice. This would allow you to name it startup to automatically start it if the computer boots up.
I'm currently not really in a position to add all those things as frankly its way too late right now and I'm not going to start minecraft just to make sure it would run. Hopefully though this script together with the provided links and pointers to improve the script are a nice start
.