Page 1 of 1

[boskid] Selector Combinator Count Input

Posted: Sun Mar 16, 2025 8:35 pm
by Novacean
Hello all together,
i need some help with understanding the Selector Combinator.
My Problem is, that the Selector Combinator shows the right Count Input when connected to an Roboport Hub, but if i connect it to another combinator, the input is wrong. So what am i doing wrong here? I really do not get it and tried various combinations..

Thanks for your help

Re: Selector Combinator Count Input

Posted: Sun Mar 16, 2025 9:49 pm
by Tertius
There's no error, you just mistake one number for the other.

The value 94 you see in the selector combinator is taken from the input, it's the value of arithmetic combinators coming from the roboport, i. e. it's the amount of arithmetic combinators in the logistic network. It's a somewhat useless value to show in this moment, but it is what is shown here.

The value 179 is the actual number of distinct signals coming from the roboport.

Re: Selector Combinator Count Input

Posted: Sun Mar 16, 2025 10:20 pm
by Novacean
Thank you so much for your Reply!
But i still do not get it.
If the value 94 in the selector Combinator shows the actual number of arithemtic combinators coming from the roboport, then why does the value 179 show the actual number of distinct signals coming from the Roboport?
My arithmetic combinator is connected to the output of the Selector Combinator. Shouldnt my arithemtic combinator also show 94?
I do not understand why the "179" should show the actual number of distinct signals from the Robotport even it is not directly connected via a green wire.

Roboport -> Green wire -> Selector Combinator "94" -> Red Wire -> Arithmetic Combinator "179"

Thank you :)

Re: Selector Combinator Count Input

Posted: Sun Mar 16, 2025 10:54 pm
by Tertius
Novacean wrote: Sun Mar 16, 2025 10:20 pm If the value 94 in the selector Combinator shows the actual number of arithemtic combinators coming from the roboport, then why does the value 179 show the actual number of distinct signals coming from the Roboport?
The value 179 is generated by the selector combinator, because you configured it to "count inputs". It's the result of "count inputs". The signal (<arithmetic combinator>) was set by you.
By coincidence the signal <arithmethic combinator> is also present at the input of the selector combinator, with a value of 94. This value is irrelevant, it's only relevant in the sense that it is nonzero, so it contributes with 1 to the input count value.
It would be less confusing if you chose a virtual signal for output of the input count, for example the virtual signal <C> (C for count), since <C> can never have a value as output from the roboport inventory.
Novacean wrote: Sun Mar 16, 2025 10:20 pm My arithmetic combinator is connected to the output of the Selector Combinator. Shouldnt my arithemtic combinator also show 94?
I do not understand why the "179" should show the actual number of distinct signals from the Robotport even it is not directly connected via a green wire.

Roboport -> Green wire -> Selector Combinator "94" -> Red Wire -> Arithmetic Combinator "179"
What happens is this:
The input of the selector combinator is connected to the roboport with green wire. You configured the selector combinator to "count inputs". So the selector combinator count the inputs, and it finds 179 of them. You configured the selector combinator to output this value as the signal <arithmetic combinator>, so the output of the selector combinator is signal <arithmetic combinator> with the value of 179. And this is what the arithmetic combinator (the item you put on the map) receives with the red wire.

It seems you somehow misunderstand the operation "count inputs" or how values are assigned to signals. "count inputs" means the selector combinator looks at its input and counts how many signals with nonzero values exist. It doesn't add any values, it counts the amount of nonzero signals. A roboport outputs signals for each of the items available in the logistic network, and it seems your network contains 179 different items at the moment, so this is what the selector combinator returns with "count inputs".
This value must be stored with some signal, so it can be used. A signal is like a variable in programming. In Factorio, there are a bunch of predefined signals, one for each item, and a few virtual signals that can be used freely (the letters A-Z and a few more signals). You assigned the value to the signal predefined for arithmetic combinators, which is somewhat strange, but works. It would be more clear if you used a virtual signal, so it cannot be mistaken with a real item signal.

May be you explain what you intend to achieve with your 2 combinators on a high level. Don't mention combinators in that descripion. What value or what condition do you intend to get or compute or evaluate?

Re: Selector Combinator Count Input

Posted: Sun Mar 16, 2025 11:19 pm
by boskid
Oopsie, that slot was supposed to take value from the output of combinator, not from the input. Fixed for 2.0.42.

Re: Selector Combinator Count Input

Posted: Sun Mar 16, 2025 11:53 pm
by Novacean
Thanks Tertius for the explanation.
To clear things up i made it more easy now with "Train Stop". See the attached Screenshots.

The first Screenshot Shows that 10 "Train Stop" are in the Network. The Roboport Reads "Read logistic Network Contents".
The Second one shows that the Selector Combinator is Set to "Count Input Signal" and is connected via a Green wire to the Roboport. At this Point it Counts correctly the 10 "Train Stop" which are in my Network.
Now i connect it with a Red (or Green, does not matter) to the Arithmetic Combinator (on the output side ofc..).
In the third Screenshot the Arithmetic Combinator now shows me 177 "Train Stop" (fluctuates between 177 and 178) even it should show in my opinion 10 "Train Stop".
boskid wrote: Sun Mar 16, 2025 11:19 pm Oopsie, that slot was supposed to take value from the output of combinator, not from the input. Fixed for 2.0.42.
Booksie, if i understand you right this is a bug? But even if it is a bug i do not understand your answer :) Which Slot was supposed to take values from the output of the combinator? And Which Combinator do you mean? :)

-------------------------------------
The first Screenshot Shows that 10 &quot;Train Stations&quot; are in the Network. The Roboport Reads &quot;Read logistic Network Contents&quot;.
The first Screenshot Shows that 10 "Train Stations" are in the Network. The Roboport Reads "Read logistic Network Contents".
427520_5.jpg (240.41 KiB) Viewed 390 times
The Selector Combinator is Set to &quot;Count Input Signal&quot; and is connected via a Green wire to the Roboport. At this Point it Counts correctly the 10 &quot;Train Station&quot; which are in my Network.
The Selector Combinator is Set to "Count Input Signal" and is connected via a Green wire to the Roboport. At this Point it Counts correctly the 10 "Train Station" which are in my Network.
427520_6.jpg (740.87 KiB) Viewed 390 times
The Arithmetic Combinator now shows me &quot;177&quot;(fluctuates between 177 and 178) even it should show in my opinion &quot;10&quot;.
The Arithmetic Combinator now shows me "177"(fluctuates between 177 and 178) even it should show in my opinion "10".
427520_7.jpg (579.36 KiB) Viewed 390 times

Re: Selector Combinator Count Input

Posted: Sun Mar 16, 2025 11:59 pm
by boskid
Issue was inside of selector combinator gui where you configured the Mode of operation to be "count inputs". In this gui, the "count output signal" allows you to configure under what signal should the count be transmitted on the output. In that case this selector was sending a signal of "arithmetic-combinator signal of 179". This slot however was not taking value from the output (which would be 179) but it took a value from the input. In this case it happened that one of the signals on the input was an arithmetic-combinator signal with value of 94. this value of 94 was completly irrelevant for this selector combinator mode as selector counting inputs does not care about vaues of the incoming signals (as long they sum to non zero), it only cares about count of incoming signals.
03-17-2025, 01-01-04.png
03-17-2025, 01-01-04.png (217.61 KiB) Viewed 378 times

Re: Selector Combinator Count Input

Posted: Mon Mar 17, 2025 12:08 am
by Novacean
Thank you boskid again for the explanation.
But to understand how the Selector Combinator "Count Input" should work :
If you take a look at my examples "Train Stop", i should expect the Signal at the Arithmetic Combinators Input 10 "Train Stations", right?

Thanks

Re: Selector Combinator Count Input

Posted: Mon Mar 17, 2025 12:18 am
by boskid
"Count input" tells you how many unique signals are on the input.
Novacean wrote: Mon Mar 17, 2025 12:08 am If you take a look at my examples "Train Stop", i should expect the Signal at the Arithmetic Combinators Input 10 "Train Stations", right?
Wrong. It will be 177 since this is how many unique signals you got on the input.

Re: Selector Combinator Count Input

Posted: Mon Mar 17, 2025 1:02 am
by Novacean
Now i get it and also understand where the Bug lies.
Thanks all together :)