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

[Question] Bundled Cable Trouble

Started by The, 25 May 2012 - 07:46 PM
The #1
Posted 25 May 2012 - 09:46 PM
I am using a computer to control multiple sets of pistons at once by using bundled cables. I believe I have run into a problem regarding a cable (an orange one) which is followed by a NOT Gate. Of course this color can be turned on and thus the end of the output off by using:

rs.setBundledOutput("back", colors.orange)
This would render the end of the output false and the piston off, but what if I wish for it to be closed again in the same program? I ask becuase there is no boolean in the command to control such things.
MysticT #2
Posted 25 May 2012 - 09:51 PM
Just pass 0 to rs.setBundledOutput, wich is no colors:

rs.setBundledOutput("side", 0)
Luanub #3
Posted 26 May 2012 - 02:00 AM
Do you use multiple colors? If so use the colors api in conjunction with the redstone api so that if you have any other colors on when you turn orange off they will stay on. So something like this..


local c = 0 -- declares c as 0 or all colors off,put at the start of your code

c = colors.combine(c, colors.orange) -- add orange to list of colors
rs.setBundledOutput("side", c ) -- turns orange on

c = colros.combine(c, colors.red) -- adds red to the colors list
rs.setBundledOutput("side", c ) -- turns red on and leaves orange on

c = colors.subtract(c, colors.orange) -- remove orange from the list
rs.setBundledOutput("side", c ) -- turns orange off, and leaves red on

rs.setBundledOutput("side", 0) -- turns off all colors

Type help redpower from a terminal for more information.
Edited on 26 May 2012 - 12:01 AM