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

[Lua] [Question] Turning on bundled cable

Started by Cikadamate, 22 April 2012 - 06:50 AM
Cikadamate #1
Posted 22 April 2012 - 08:50 AM
I'm very new to ComputerCraft and I just can't get my head around using the bundled cables from the RedPower mod..
I've got a terminal which I want to use to control one door and two piston doors.
I've got the door working but I don't know how to write a program which will open up the piston doors (withdraw the pistons)
Any help would be appreciated.

*edit*
Is bundled cable even the best way to control multiple doors etc. from a single terminal?
Luanub #2
Posted 22 April 2012 - 09:38 AM
Bundled cables are probably the best method yes. You will need to use both the redstone and colors apis. If you type help redpower from a terminal it will give you some good information. Here are a couple of examples


-- lets turn on a red cable
c = colors.combine( c, colors.red)
rs.setBundledOutput("side", c ) -- replace side with the side your cable is attached too

-- now red is on lets turn blue on as well
c = colors.combine( c, colors.blue )
rs.setBundledOutput("side", c )

-- now lets turn red off and leave blue on
c = colors.subtract( c, colors.red )
rs.setBundledOutput("side", c )

-- could also turn both off at the same time
c = colors.subtract( c, colors.blue, colors.red )
rs.setBundledOutput("side", c )

There are others way to do this as well, but this has always been the cleanest/least error prone method that I've used.