80 posts
Posted 27 March 2013 - 07:42 AM
So, the title there. What I'm trying to do is create a massive UU-Matter factory in Tekkit Lite that automatically generates the entire chain of desired components; i.e. it spits out UU-Matter, crafts it into Iron Ore, and then smelts that into ingots. So far, so good- I can make the actual factory.
My plan was then to make an 'overseer' program for each 'section' (ores, building materials, etc.) so I can turn off each section as needed. But how do I get it so the program can turn off, say, the black in a red-black-white bundle without turning off the OTHERS?
758 posts
Location
Budapest, Hungary
Posted 27 March 2013 - 09:05 AM
You can use the following code as an API (shout if you need further explanation)
Pastebin link (8SBHiceH) hereSpoiler
local outputColor, outputSide
local inited = false
local init = function(side, color)
-- color here is the original color value (eg. white + red + black =
-- colors.white + colors.red + colors.black = 1 + 16384 + 32768 = 49153)
outputSide = side
outputColor = color
inited = true
end
local toggleOutput = function(color) -- color here is the color you want to turn off or on
if (inited) then
outputColor = bit.bxor(outputColor, color)
rs.setBundledOutput(outputSide, outputColor)
end
end
7508 posts
Location
Australia
Posted 27 March 2013 - 10:00 AM
local function turnOff( ... )
local off = 0
local old = rs.getBundledInput( 'right' )
for _, c in pairs(arg) do
off = off + c
end
rs.setBundledOutput( 'right', colors.subtract( old, off ) )
end
then you can call it in these ways (and more)
turnOff(colors.red)
turnOff(colors.red, colors.blue, colors.black)
turnOff(colors.yellow, colors.red, colors.lime, colors.black, colors.brown)
basically you can enter any number of colours you wish.
8543 posts
Posted 27 March 2013 - 10:12 AM
If either of those functions don't work for you, one or both of the first two functions in my
Useful Snippets post may interest you.
80 posts
Posted 27 March 2013 - 02:03 PM
I'll be trying these tonight- my sever ate the world while I was out. Will update, and thanks for all the advice :)/>
80 posts
Posted 29 March 2013 - 11:42 PM
You guys nailed it- thanks ;)/>