Page 1 of 1

Stop Watch / Count / Reset

Posted: Sat Jul 23, 2022 1:04 pm
by mFokus
Hi,

I am new to the Forum but have some 1,400 hours experience playing Factorio.
So far, I have made very limited use of circuit networks. A little counting to activate belts and inserters, that's all.
I have now started looking into timers and counters and encountered some issues.

This is, what I have:

Code: Select all

0eNrNmM1uqzAQhd9l1qQKDoQf5e66yKardldFiIDTWgKDjIluFPHuHUNvFW4UgoGKSBGSzczx2J+jOeIM+6SkuWBcgn8GFmW8AP/9DAX74GGi5uQpp+ADkzQFA3iYqlFMIxZTsYiydM94KDMBlQGMx/Qv+Ga1M4ByySSjjVo9OAW8TPdUYECXjgF5VmBqxtXqKLcwV5YBJ/AJMZ9sXCZmgkZNADEAS5YiS4I9/QyPDAUw61s2wHdxLVWo2QMThQyudnZkQpY481NUE7F4U1tSByJDdTrrpRqleSjqMn34gxlZKfNSQ/O10cxPWFrJZXAQWRowjhrgH8KkoFWzJm82WJdtqseHoJRfniWLsSSMZSIqmayHpNphNrkZ7rTDEVOFy13RIbp0yBx0Xn+BzsukdBw9Om4/OitdOss56Lz8Ap3tpHRcPTpePzqWJh3izkFn26ZDrAnoPE9Kx9OjYy774bF/qv63+3v/HufJ/iZEehI6sERScaOL3uk1pcJhXjbSEe3g1iGsh3Zf8kjddzPgjr513FEpypHN12i9tu9c2StY7XSzH0tnaK8mj9SrNxM7KW2WTjdLc6TPaquRfmjdoY2ePFKj30xsw7TRut1oyUiT1lZb9UPrDXUJZEaXMAna7ZRovW60q5EOr61m9UOrnIge2/UcbJ/vOMDNxA5Qm+3/jo504xhmEHdG81nDv/gKYsAR3VsDwDUtxyOOvcaf5VbVF5sT41Y=
This inserts ticks (T) and gives seconds (S), minutes (M), hours (H) and days (D):

Image

Here is what I want to do with this:
  • Start the timer with some input. I will probably use a crate as trigger (something is in crate = run, crate is empty = reset timer).
  • Stop the timer when a certain quantity of a certain element is reached.
  • Reset the clock (T=0, S=0, M=0, H=0, D=0) when said crate is emptied (or any other mechanism, if that's easier).
I hope this makes sense. Sitting at home with Covid at not quite on top...

Thanks!

Re: Stop Watch / Count / Reset

Posted: Sat Jul 23, 2022 3:34 pm
by Amarula
You may find the wiki tutorial helpful: https://wiki.factorio.com/Tutorial:Comb ... sic_clocks

Re: Stop Watch / Count / Reset

Posted: Sat Jul 23, 2022 5:43 pm
by mFokus
Thanks @amurala.
Here again, I only see a solution for resetting and immediately restarting the timer. I have that implemented for the minutes / seconds calculations.
I am looking for a solution to pause the clock and reset it when I decide to start over.
Or am I misinterpreting the tutorial?

Re: Stop Watch / Count / Reset

Posted: Sat Jul 23, 2022 6:29 pm
by asheiduk
A quick idea is this:


stopableclock.gif
stopableclock.gif (61.09 KiB) Viewed 2525 times
C=Counter/Clock
T=Tick (1: Clock is running, 0: Clock is stopped)
R=Reset (0: Clock is running, !=0: Reset counter)

Another quick idea: I think it is easier to have simple counter which is incremented. The HH:MM:SS conversion can be done after that by simple modulo calculations.