Combinator counter with upper bound

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Britonix
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri May 24, 2019 9:15 pm
Contact:

Combinator counter with upper bound

Post by Britonix » Fri May 24, 2019 9:25 pm

I am currently working on a combinator counter. Although, I want it to stop counting once it reaches a certain value, let's say 100 for this example.

Here my current setup:

Code: Select all

[ AC ] -> [ DC ]
^___________|

=AC=
Input: [T] + 1
Output: [T]

=DC=
Input: [T] < 100
Output: T (input count)
I expect the circuit to count from 0 to 100 and to stop at 100.

Although, I get that the circuit counts from 0 to 100 in a loop, resetting itself to 1 without pausing at 100.

Reading the documentation, I expected the DC to stop outputting and so pause the circuit when [T] < 100 is false, but this does not seem to be the case.

What am I getting wrong with that setup and how can I fix it?

hale42
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Apr 03, 2018 6:26 am
Contact:

Re: Combinator counter with upper bound

Post by hale42 » Fri May 24, 2019 10:21 pm

why it resets is when dc hits 100 then doesnt send t to ac, then ac says 0+1=1 and sends t=1 and it resets

also every signal is present on every circuit so t is there its just 0 and hidden

if you increase dc's condition to less than 101 it will hit 100 instead of stopping at 99 and resetting (it will still reset tho)

User avatar
disentius
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Combinator counter with upper bound

Post by disentius » Sat May 25, 2019 8:05 pm

Came up with this:
(Digital display is DaveMcW's creation)

Set the C-value in both the upper right decider combinator, constant combinator, and the bottom deciter combinator to the desired stop value.
- constant combinator off -> counter (top left DC) counts to 100
- Constant combinator on -> reset to zero

Counter with limit and reset.png
Counter with limit and reset.png (732.4 KiB) Viewed 148 times

User avatar
disentius
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Combinator counter with upper bound

Post by disentius » Sat May 25, 2019 8:30 pm

Better version:

With this one you only need to set the X in the constant combinator to the desired upper bound. left DC is output.
resets to zero when there is no X.


Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: No registered users