Page 1 of 1

Copy counter value on signal

Posted: Thu Oct 14, 2021 9:00 am
by ShyLion
Hi. I have a circling belt with items A and one item R.
My counter counts A and resets on R.
I can put another item S right before R.
Is there any way to save A value on S pulse, right before A resets?

Re: Copy counter value on signal

Posted: Thu Oct 14, 2021 12:28 pm
by Amarula
If there will be only one item S, use an arithmetic combinator with inputs A and S, outputs A x S: if S is zero, output is zero, otherwise, it outputs A...

Re: Copy counter value on signal

Posted: Thu Oct 14, 2021 12:41 pm
by mmmPI
I'm not sure it's the best way but i made this :
I
beltcircling2.jpg
beltcircling2.jpg (428.19 KiB) Viewed 1609 times
copper plate is item A
iron plate is item R
red belt is item S


Combinator A i suppose is what you have already to count.

B is a decider that let through the number of copper plate from the counter A only when red belt>0

C is a decider that will loop the total amount of copper, that's where you read the total amount of copper plate

Rest is a way to manually reset the save because otherwise it will add up the number everytime.

it should be made different if you want to only save once and then disable the counter, or if you want to reset it everytime there is an S item. ( which in the latter case i didnt see the point, since the counter A already reset everytime).
beltcircling 2.zip
(4.17 MiB) Downloaded 178 times

Re: Copy counter value on signal

Posted: Thu Oct 14, 2021 12:51 pm
by DaveMcW
Here is my solution, which uses the same item for save and reset.

The arithmetic combinators stop saved values from adding together. If you want them to add, it can be done in 3 combinators.



copy_counter.jpg
copy_counter.jpg (167.91 KiB) Viewed 1608 times

Re: Copy counter value on signal

Posted: Thu Oct 14, 2021 2:49 pm
by ShyLion
DaveMcW wrote:
Thu Oct 14, 2021 12:51 pm
Here is my solution, which uses the same item for save and reset.
Thanks! It works!