Combinators Resulting in NULL Values
Combinators Resulting in NULL Values
Hi,
It seems to be a common issue with combinators that they give a NULL value as a result of their logic, I am building a base strongly dependent on combinators and the problem is sometimes crippling, you get a null value but you can't use a combinator to check if the value is null!! and there doesn't seem to be a reasonable solution for it in game.
It seems to be a common issue with combinators that they give a NULL value as a result of their logic, I am building a base strongly dependent on combinators and the problem is sometimes crippling, you get a null value but you can't use a combinator to check if the value is null!! and there doesn't seem to be a reasonable solution for it in game.
Re: Combinators Resulting in NULL Values
I think the key is to approach it the opposite way.
Make the Factory do something when there is a non-zero result, rather than when there is a zero result.
Just as an example, the use of a negative Constant Combinator added to the (positive, by default) contents of some chests to determine when to turn a Station on (Anything < 0 ... or Anything < -50 ... etc.).
It might require you to rethink your circuit logic a bit, but it works to avoid the 0 = NULL issue.
Make the Factory do something when there is a non-zero result, rather than when there is a zero result.
Just as an example, the use of a negative Constant Combinator added to the (positive, by default) contents of some chests to determine when to turn a Station on (Anything < 0 ... or Anything < -50 ... etc.).
It might require you to rethink your circuit logic a bit, but it works to avoid the 0 = NULL issue.
Re: Combinators Resulting in NULL Values
can't you use decider combinator, with condition set as "everything = 0" => "output 1 red signal " ? for example
Re: Combinators Resulting in NULL Values
Problem is the value is not zero, it's "No Value" the combinator giving the result says nothing in the output, if it were zero I wouldn't have a problem and simply check if the value is zero.
Re: Combinators Resulting in NULL Values
Which is why you have the Factory do something based on a non-zero result, rather than a zero result.Fiend wrote: ↑Tue Sep 08, 2020 8:22 pmProblem is the value is not zero, it's "No Value" the combinator giving the result says nothing in the output, if it were zero I wouldn't have a problem and simply check if the value is zero.
Re: Combinators Resulting in NULL Values
Thanks for the reply.astroshak wrote: ↑Tue Sep 08, 2020 8:15 pmI think the key is to approach it the opposite way.
Make the Factory do something when there is a non-zero result, rather than when there is a zero result.
Just as an example, the use of a negative Constant Combinator added to the (positive, by default) contents of some chests to determine when to turn a Station on (Anything < 0 ... or Anything < -50 ... etc.).
It might require you to rethink your circuit logic a bit, but it works to avoid the 0 = NULL issue.
The thing is that the combinator gets 2 signals from the network, one says 10, the other says -10, the result of those two is zero but the combinator returns the value of Null, if I go with teh combinator approach I'd have to use two constant combinators because in my case a positive value and a negative value can result in a different behavior downstream.
The Null behavior is completely unnecessary because you can't check for a null value anyway, it's very obviously a bug.
Re: Combinators Resulting in NULL Values
It is by design. A zero value is equal to no signal. It has been discussed at length in the past. Zero = Null is quite common in some programming languages, so some reverse logic in your algorithm needs to be applied as already suggested.
If your two signals result in zero, you can use a Decider Combinator with the condition Everything = 0 and output a different signal with a non zero value to indicate the zero result. If that's what you need.
As for needing those two inputs further down the line, it is possible to isolate them from the wire by passing them through an Arithmetic Combinator on each signal with a condition of signal + 0. These will need to be connected before the Decider Combinator, or at the source of the signals.
You don't say specifically whether your signals are on individual Red and Green wires, but when connected to a combinator, all values for [the same signal] are summed in the same way as a single signal wire.
[Edit for clarity]
If your two signals result in zero, you can use a Decider Combinator with the condition Everything = 0 and output a different signal with a non zero value to indicate the zero result. If that's what you need.
As for needing those two inputs further down the line, it is possible to isolate them from the wire by passing them through an Arithmetic Combinator on each signal with a condition of signal + 0. These will need to be connected before the Decider Combinator, or at the source of the signals.
You don't say specifically whether your signals are on individual Red and Green wires, but when connected to a combinator, all values for [the same signal] are summed in the same way as a single signal wire.
[Edit for clarity]
Re: Combinators Resulting in NULL Values
As I said, the trick is to make the system do something on a non-zero result. Set things up such that there is nothing for the system to do with a zero result. Its not always easy, we all understand that ... but its what you need to figure out to get the desired result you seek.Fiend wrote: ↑Tue Sep 08, 2020 8:31 pmThanks for the reply.astroshak wrote: ↑Tue Sep 08, 2020 8:15 pmI think the key is to approach it the opposite way.
Make the Factory do something when there is a non-zero result, rather than when there is a zero result.
Just as an example, the use of a negative Constant Combinator added to the (positive, by default) contents of some chests to determine when to turn a Station on (Anything < 0 ... or Anything < -50 ... etc.).
It might require you to rethink your circuit logic a bit, but it works to avoid the 0 = NULL issue.
The thing is that the combinator gets 2 signals from the network, one says 10, the other says -10, the result of those two is zero but the combinator returns the value of Null, if I go with teh combinator approach I'd have to use two constant combinators because in my case a positive value and a negative value can result in a different behavior downstream.
Re: Combinators Resulting in NULL Values
But Null does not equal Zero, that's what I meant by "you can't check if the signal is null" if I use you logic the combinator would return no value because its condition has failed.
Re: Combinators Resulting in NULL Values
Any test against "Everything" passes if all signals are null. Including the test for "Everything = 0".
Re: Combinators Resulting in NULL Values
The "Everything" input is a special case, and does return true when there is no input.
See the tooltip:
Here is a little circuit that I made to indicate via the lamp on the left when the Red and Green wires amount to zero. It lights when both Constant Combinators (top) are off, AND when they are both on. In the first instance no input, and in the second, Black signal -10 on Green AND Black signal 10 on Red. The Decider Combinator output on White is true for no input once again.
I have placed two Arithmetic Combinators to isolate the signals, and then added Black 2 via the lower right Constant Combinator. The bottom right lamp has the condition Black = 12. The extra 2 does not propagate back to the original signal on the Red circuit, so therefore is isolated from it.
I have labeled each of the devices with their properties.
Perhaps you could share what your use case is, and someone can give you some hints? It is frustrating, I know, but this is the realm of Nauvis, and our protagonist, The Engineer, uses this same logic in [his/her/insert appropriate identity here] world. It just needs some lateral thinking to get what you need done.
[Edit for correction] I transposed the values for the upper constants in the text.
Re: Combinators Resulting in NULL Values
Oh, this "zero signal is no signal" is so painful for me. I want my supply train to depart from station if one cargo type is fully unloaded by circuit network signal. I just don't get how to do it. My head don't work that way( And there is already nearly ten combinators to call train to station and send it further, when station demands are met.
Re: Combinators Resulting in NULL Values
Are you setting that parameter on the train schedule, or using enable/disable at the station?wisery wrote: ↑Sat Sep 12, 2020 11:10 pmOh, this "zero signal is no signal" is so painful for me. I want my supply train to depart from station if one cargo type is fully unloaded by circuit network signal. I just don't get how to do it. My head don't work that way( And there is already nearly ten combinators to call train to station and send it further, when station demands are met.
Re: Combinators Resulting in NULL Values
Schedule to departure, enable/disable to call supply train.starlinvf wrote: ↑Sat Sep 12, 2020 11:40 pmAre you setting that parameter on the train schedule, or using enable/disable at the station?wisery wrote: ↑Sat Sep 12, 2020 11:10 pmOh, this "zero signal is no signal" is so painful for me. I want my supply train to depart from station if one cargo type is fully unloaded by circuit network signal. I just don't get how to do it. My head don't work that way( And there is already nearly ten combinators to call train to station and send it further, when station demands are met.
Re: Combinators Resulting in NULL Values
You can do something like this:
check two conditions:
- Train at station and the resource you want to check = 0
- set read train, and read train contents at the station.
Let the train depart if both conditions are true (green=2)
check two conditions:
- Train at station and the resource you want to check = 0
- set read train, and read train contents at the station.
Let the train depart if both conditions are true (green=2)