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

[LUA][QUESTION][PROGRAMMING] rs.setBundledOutput...

Started by TheEisbaer, 25 September 2012 - 06:23 PM
TheEisbaer #1
Posted 25 September 2012 - 08:23 PM
I want to set the Computer 2 Colored Outputs to one bundled Cable.

I type in
rs.setBundletOuput("back", colors.organge) –> Orange Wire gets powered

Next, I type this
rs.setBundletOuput("back", colors.red) –> Red Wire gets powered , orange wire gets unpowered

—————-

This is what i'm trying

rs.setBundletOuput("back", colors.organge) –> Orange Wire gets powered
rs.setBundletOuput("back", colors.red) –> Red ANDOrange Wire gets powered

How do I have to do this?
Matrixmage #2
Posted 25 September 2012 - 08:26 PM
Hope it helps!
 
rs.setBundledOutput("back", colors.orange, colors.red)
Cranium #3
Posted 25 September 2012 - 08:27 PM
You are looking for the colors.combine() and colors.subtract() functions. Try this:

rs.setBundledOutput("back",colors.combine(colors.orange)) --orange wire on
rs.setBundledOutput("back",colors.combine(colors.red)) --orange stays on, red also turned on.
rs.setBundledOutput("back",colors.subtract(colors.orange)) --orange wire turned off, red still on
rs.setBundledOutput("back",0) --all colors turned off, no matter what
Hope that helps!

Edit: You can also add multiple colors at a time, by adding more colors in the parenthesis for colors.combine or colors.subtract. Like this:

rs.setBundledOutput("back",colors.combine(colors.red,colors.orange)) --both colors added at the same time.
Edited on 25 September 2012 - 06:29 PM
TheEisbaer #4
Posted 25 September 2012 - 08:30 PM
Hope it helps!

rs.setBundledOutput("back", colors.orange, colors.red)
-
TheEisbaer #5
Posted 25 September 2012 - 08:31 PM
You are looking for the colors.combine() and colors.subtract() functions. Try this:

rs.setBundledOutput("back",colors.combine(colors.orange)) --orange wire on
rs.setBundledOutput("back",colors.combine(colors.red)) --orange stays on, red also turned on.
rs.setBundledOutput("back",colors.subtract(colors.orange)) --orange wire turned off, red still on
rs.setBundledOutput("back",0) --all colors turned off, no matter what
Hope that helps!

Edit: You can also add multiple colors at a time, by adding more colors in the parenthesis for colors.combine or colors.subtract. Like this:

rs.setBundledOutput("back",colors.combine(colors.red,colors.orange)) --both colors added at the same time.
Thanks :P/>/>

Hope it helps!

rs.setBundledOutput("back", colors.orange, colors.red)
Thank you very much!
TheEisbaer #6
Posted 25 September 2012 - 08:38 PM
You are looking for the colors.combine() and colors.subtract() functions. Try this:

rs.setBundledOutput("back",colors.combine(colors.orange)) --orange wire on
rs.setBundledOutput("back",colors.combine(colors.red)) --orange stays on, red also turned on.
rs.setBundledOutput("back",colors.subtract(colors.orange)) --orange wire turned off, red still on
rs.setBundledOutput("back",0) --all colors turned off, no matter what
Hope that helps!

Edit: You can also add multiple colors at a time, by adding more colors in the parenthesis for colors.combine or colors.subtract. Like this:

rs.setBundledOutput("back",colors.combine(colors.red,colors.orange)) --both colors added at the same time.
Sry.. I tried in Lua Live Editor.. i think thats the problem :$$


rs.setBundledOutput("back",colors.combine(colors.orange)) orange wire on
rs
.setBundledOutput("back",colors.combine(colors.red)) orange stays on, red also turned on.
Doyle3694 #7
Posted 25 September 2012 - 09:10 PM
use notepad++, it's the best :P/>/>
Cranium #8
Posted 25 September 2012 - 09:19 PM
I agree. Notepad++ is by far my favorite text editor now.