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

Redstone questions.

Started by [email protected], 16 May 2012 - 09:50 AM
[email protected] #1
Posted 16 May 2012 - 11:50 AM
I want to do simple things, and can't get answer how to do them.

First thing. I want to check if some of colored cables in budle cable are set to true. Can't figureout how code have to be done in case of bundle cables. Would be happy if some sample preneted would be.

Next thing. Want to set separatly outputs on bundled cables. Also don't know how.
Luanub #2
Posted 16 May 2012 - 01:14 PM
Here's an example hopefully it helps. It uses the redstone and colors api's.


local c = 0

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

if rs.testBundledInput("left", colors.red ) then -- check left to see if red is on
 do stuff for red being on
else
 do stuff for red being off
end

c = colors.combine( c, colors.blue ) -- adds blue
rs.setBundledOutput("left", c ) -- turns on blue, leaving red on as well

c = colors.subtract( c, colors.red) -- removes red
rs.setBundledOutput("left", c ) -- turns off red leaving blue on

Type help redpower from a terminal for more information.