38 posts
Location
Earth
Posted 14 April 2012 - 04:25 PM
Since im trying to detect what RedPower inputs have changed, i have to store the current ones in a list and compare the next colors to the previous colors.
1111 posts
Location
Portland OR
Posted 14 April 2012 - 10:39 PM
Use the colors api. Type help colors of help redpower for more information, but it would look something like..
to add colors to the array
c = colors.combine(c, colors.white, colors.red, etc... etc.. etc... )
to remove
c = colors.subtract(c , colors.white, colors.red, etc... etc... etc.. )
to utilize with the rs commands
rs.setBundledOutput("side", c )
I haven't tried it, but you should be able to use the var c in other statements so hopefully this helps you.
378 posts
Location
In the TARDIS
Posted 14 April 2012 - 10:43 PM
use the colors.combine function. I used so just go ahead and ask.
@Cloudy c is a combination of those colors so if you would write
c = colors.combine(colors.red, colors.green, colors.white)
rs.setBundledOutput(c, true)
red, white and green would turn on and every color else turns off
1111 posts
Location
Portland OR
Posted 14 April 2012 - 10:57 PM
Ya I guess I should have elaborated a little more on the syntax.
For the subtract you need to place the colors var as the first argument so it knows where to remove from
With combine if you do not place the colors var as the first argument, it will create a new list with only the colors listed.
If you use the color var as the first argument it will add the listed colors to the already existing list.
38 posts
Location
Earth
Posted 15 April 2012 - 10:33 AM
How can i then go through every color in the set? For loop doesn't seem to work.
2447 posts
Posted 15 April 2012 - 04:47 PM
If I want to iterate through every colour in the list, I do this:
for k, v in pairs(colors) do
if type(v) == "number" then -- we do this check as there are some functions in this table too.
-- k is the name of the colour, v is the value - do your stuff here!
end
end
38 posts
Location
Earth
Posted 30 April 2012 - 09:41 AM
-nevermind, solved-