Curcuits: how to compare two unknown signal types?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Curcuits: how to compare two unknown signal types?

Post by wvlad »

I need to compare types, not amounts.

E.g. 1st constant combinators sends Oil = 1, 2nd sends Gas = 1, result should be 0
E.g. 1st constant combinators sends Gas = 1, 2nd sends Gas = 1, result should be 1

I need this to be able to set signal type in a one place of blueprint so I don't need to change things multiple times after placement so I have less mistakes.

Caine
Fast Inserter
Fast Inserter
Posts: 213
Joined: Sun Dec 17, 2017 1:46 pm
Contact:

Re: Curcuits: how to compare two unknown signal types?

Post by Caine »

Can the second one send -1 instead? Then you can add the signals. A nonzero signal means different types, no signal means equal types.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Curcuits: how to compare two unknown signal types?

Post by DaveMcW »

Multiply signal 2 by -1. If it matches the signals will cancel out, otherwise they won't.

wvlad
Fast Inserter
Fast Inserter
Posts: 215
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Curcuits: how to compare two unknown signal types?

Post by wvlad »

Ok, what if one of them is set manually but another can be in any amounts, e.g. 1 Oil and 5 Oil , 1 Oil and 100 Gas?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Curcuits: how to compare two unknown signal types?

Post by DaveMcW »

You can change any number to 1 with a decider combinator. Each > 1 → Each = 1

Caine
Fast Inserter
Fast Inserter
Posts: 213
Joined: Sun Dec 17, 2017 1:46 pm
Contact:

Re: Curcuits: how to compare two unknown signal types?

Post by Caine »

Yes, exactly. As comparison you can utilize for example: everything = 0 --> output 1. If they cancel out this will output 1 otherwise it will output 0.

Miravlix
Long Handed Inserter
Long Handed Inserter
Posts: 63
Joined: Wed Jun 01, 2016 8:48 am
Contact:

Re: Curcuits: how to compare two unknown signal types?

Post by Miravlix »

Can GAS be = 2?

Otherwise I would use binary.

1 Oil
2 Gas
3 Lube

So you only need one signal, it can contain a really high number of different binary values.

You check if any is active you do:
Signal AND 2 returns 0 if gas isn't active, 1 if active.

Post Reply

Return to “Gameplay Help”