well now according to
http://computercraft...etBundledOutput You are triyng to combine an invalid color.
print(colors.combine(colors.white, colors.magenta, colours.lightBlue)) (from
http://computercraft...=Colors.combine])
As far as i'm aware, tree is not valid color. Try fixing it to use valid colors. If i am, however completely wrong, do let me know.
"tree" is a variable used to contain the colors. It's perfectly valid to do that.
There's an example of how to do it:
local tree = colors.red -- set the initial value of the variable
rs.setBundledOutput("back", tree) -- output now is red
tree = colors.combine(tree, colors.white, colors.blue) -- add some colors
rs.setBundledOutput("back", tree) -- output now is red, white and blue
tree = colors.subtract(tree, colors.white) -- remove the white
rs.setBundledOutput("back", tree) -- output now is red and blue
These are two functions I use to add and remove output easier:
local function AddOutput(sSide, ...)
local c = colors.combine(rs.getBundledOutput(sSide), ...)
rs.setBundledOutput(sSide, c)
end
local function RemoveOutput(sSide, ...)
local c = colors.subtract(rs.getBundledOutput(sSide), ...)
rs.setBundledOutput(sSide, c)
end
You use them like this:
AddOutput("back", colors.white, colors.brown, colors.black)
RemoveOutput("back", colors.black)
Come back with any questions you have and we'll try to help :)/>/>
So I would need a single variable to contain all of the colors I want to have receiving a signal at the same time? I was using multiple variables just in case because I just started learning lua, although it isn't very different from other programming languages I know.
So, for example, I could do this?:
local tree = colors.blue
if(blah == true) then
tree = colors.combine(tree, colors.green, colors.red)
rs.setBundledOutput("back", tree)
end
if(otherBlah == true) then
tree = colors.combine(tree, colors.white)
rs.setBundledOutput("back", tree)
end
This would maintain the original color, blue, and the other colors would be added afterwards, correct?(This code might have errors, it's just an example I thought of while typing this) The code I have right now is similar to the one above, but I have a different variable for each new color I want to add, like this:
if(blah == true) then
tree = colors.combine(tree, colors.white)
rs.setBundledOutput("back", tree)
end
if(otherBlah == true) then
reactor = colors.combine(reactor, colors.blue)
rs.setBundledOutput("back", reactor)
end
This would cause the problems I had described above correct?
Well, after reading this post through I realized I am just being dumb and failed to notice the colors.COMBINE, but some of the questions asked have a point and if you could correct me if I was wrong in anything I said that would be nice. Thanks for the help!