318 posts
Location
Somewhere on the planet called earth
Posted 27 July 2012 - 08:36 AM
So i am working on a admin pw, that open all 5 doors, i use a budled output, so that i can open all doors 1 by 1 too. I have everything made and working but i can't seem to be able to activate more than one bundled output. I need red, blue, yellow, lime, black all to come on and stay on for 10 seconds, could anyone tell me how i would do this?
If you could have taken you're time to make a code i would be so thankful.
1111 posts
Location
Portland OR
Posted 27 July 2012 - 08:45 AM
Theres a couple ways. The best is to use the colors API along with the redstone API. Here is a small example on how to achieve this..
local c = 0 -- declare c as 0 or all colors off put this at the top of your code
c = colors.combine( c, colors.red )
rs.setBundledOutput("side", c ) -- turns on red
c = colors.combine( c, colors.white )
rs.setBundledOutput("side", c ) -- turns on white, leaving red on as well
c = colors.subtract( c, colors.red)
rs.setBundledOutput("side", c ) -- turns off red, leaving white on
rs.setBundledOutput("side", 0 ) -- turns everything off
type help redpower from a terminal for more information.
318 posts
Location
Somewhere on the planet called earth
Posted 27 July 2012 - 08:55 AM
Err how would i add mulible ? Is it like this?
c= colors.combine( c, colors.red, colors.blue)
rs.setBundledOutput("back", c)
1111 posts
Location
Portland OR
Posted 27 July 2012 - 09:44 AM
Yes just like you have it.
10 posts
Posted 27 July 2012 - 02:14 PM
That's actually pretty useful. And here I was worried I was going to have to do all the 16-bit math by hand!
3790 posts
Location
Lincoln, Nebraska
Posted 27 July 2012 - 03:32 PM
Well if you're confused about the 16-bit math, you can always refer to this cheat sheet:
http://computercraft.info/wiki/index.php?title=Color_(API)