This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
GamersUnited556's profile picture

Question about Bundled cables.

Started by GamersUnited556, 19 February 2016 - 01:11 AM
GamersUnited556 #1
Posted 19 February 2016 - 02:11 AM
So I need a bit of help. I have been trying to work and figure out if you can somehow get a Boolean Value onto the bundled cable statements
Ex: rs.setBundledOutput("back",1,true)

Or the ability to detect if the cable is emitting a signal WITHOUT it linking back to the main terminal. I'm trying to get it so i can have a bundled cable
with four outputs but i can see which is on to toggle them with a statement in the code.

http://pastebin.com/Mj485dJ1

It's a work in progress but the idea is there. Any help would be useful, Even if it is just saying it isn't possible.
Bomb Bloke #2
Posted 19 February 2016 - 03:28 AM
The idea is that you set the side to a single number, and the bits within that number indicate the states you want for each of the colours within the cable. The colours API helps out here.

Let's say you want to enable the orange wire, without touching the state of the others. You'd do:

rs.setBundledOutput("back", colours.combine(rs.getBundledOutput("back"), colours.orange))

Likewise, if you want to disable orange without touching the other colour states, you'd do:

rs.setBundledOutput("back", colours.subtract(rs.getBundledOutput("back"), colours.orange))