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

So i need redpower help

Started by CardingiSFun, 23 October 2012 - 10:20 PM
CardingiSFun #1
Posted 24 October 2012 - 12:20 AM
So im making a program on cc to control my auto crafters. And i was wondering how would i stop a output for a certain bundled cable color?
remiX #2
Posted 24 October 2012 - 12:29 AM
RedStone API
CardingiSFun #3
Posted 24 October 2012 - 12:35 AM
I dont want to set off all of the colors just one perticular color
ChunLing #4
Posted 24 October 2012 - 01:14 AM
Ah, you need to store the current output state, which colors are on and off, in a table that contains entries for all the colors that are on. When you want to turn a color off, you set that color entry to nil, Then you call a function that adds up all the integer values representing the different colors that are in the table and passes that total to redstone.setBundledOutput().

Actually, you don't need a table. You can store any combination of colors as a single integer, add/subtract a color value to turn it on/off. But that requires keeping track of which colors are already on or off in that integer value, or having a function that checks the integer value and returns whether it codes for a given color being on/off. I just think that using a table would be easier.
briman0094 #5
Posted 25 October 2012 - 02:02 AM
Ah, you need to store the current output state, which colors are on and off, in a table that contains entries for all the colors that are on. When you want to turn a color off, you set that color entry to nil, Then you call a function that adds up all the integer values representing the different colors that are in the table and passes that total to redstone.setBundledOutput().

Actually, you don't need a table. You can store any combination of colors as a single integer, add/subtract a color value to turn it on/off. But that requires keeping track of which colors are already on or off in that integer value, or having a function that checks the integer value and returns whether it codes for a given color being on/off. I just think that using a table would be easier.

Or you could use color.subtract(rs.getBundledOutput(side), colors.insertColorHere)…
ChunLing #6
Posted 25 October 2012 - 02:07 AM
Hmm…I presume that operation automatically checks for it the color is present before subtracting it? Good to know.