41 posts
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?
2088 posts
Location
South Africa
Posted 24 October 2012 - 12:29 AM
41 posts
Posted 24 October 2012 - 12:35 AM
I dont want to set off all of the colors just one perticular color
2005 posts
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.
18 posts
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)…
2005 posts
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.