Code I have written for it: http://pastebin.com/FxsSYycf
EDIT: I fixed the image.
You could use possibly use Project:Red cables. As an alternative, you could use another computer and use rednet to communicate which redstone outputs on that second computer you wish to use.
Im having a hard time getting this to work. Do you think you could write a few lines?
local args = {...}
local side = "right" --# The side of the bundled cable
local currentOutput = rs.getBundledOutput(side)
if args[1] then --# We got the first argument, toggle yellow
if colors.test( currentOutput , colors.yellow ) then --# is yellow already on?
rs.setBundledOutput( side , colors.subtract(currentOutput , colors.yellow) )
else --# Yellow wasn't on
rs.setBundledOutput( side , colors.combine(currentOutput , colors.yellow) )
end
else --# Didn't get the first arguemnt, toggle black
if colors.test( currentOutput , colors.black ) then --# is black already on?
rs.setBundledOutput( side , colors.subtract(currentOutput , colors.black) )
else --# Black wasn't on
rs.setBundledOutput( side , colors.combine(currentOutput , colors.black) )
end
end
local side = "left"
local addColor = colors.red
rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), addColor))
The code does "get the current otput, add red to it and set it as the new output".
function enableColor(side, color)
rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), color))
end
Turning red on while keeping the current output would look something like this:The code does "get the current otput, add red to it and set it as the new output".local side = "left" local addColor = colors.red rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), addColor))
Turning red off is almost the same, just replace "colors.combine" with "colors.subtract". You can write a couple of functions to make it eaven easier:function enableColor(side, color) rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), color)) end
Again, with disableColor being the same with "subtract" instead of "combine".
edit: ninja'd
local side = "top"
while true do
term.clear()
term.setCursorPos(1,1)
print("Which mobs would you like to toggle?")
print("1. Enderman")
print("2. Blaze")
print("B. Back")
local input = io.read()
if input == "1" then
if rs.testBundledInput(side, colors.brown) then
rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side), colors.brown))
else
rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), colors.brown))
end
elseif input == "2" then
if rs.testBundledOutput(side, colors.green) then
rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side), colors.green))
else
rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), colors.green))
end
elseif input == "B" then
term.clear()
term.setCursorPos(1,1)
break
end
end
You've got to be careful where you put your brackets - for example, colors.combine(rs.getBundledOutput(side, addBrown)) should be colors.combine(rs.getBundledOutput(side), addBrown). You don't want to pass "addBrown" to the "getBundledOutput" function!
There's also a function definition in there that you never end up later calling, and things get even worse with the Blaze toggle.
Here's a fixed version:Spoiler
local side = "top" while true do term.clear() term.setCursorPos(1,1) print("Which mobs would you like to toggle?") print("1. Enderman") print("2. Blaze") print("B. Back") local input = io.read() if input == "1" then if rs.testBundledInput(side, colors.brown) then rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side), colors.brown)) else rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), colors.brown)) end elseif input == "2" then if rs.testBundledOutput(side, colors.green) then rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side), colors.green)) else rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), colors.green)) end elseif input == "B" then term.clear() term.setCursorPos(1,1) break end end
if colours.test(rs.getBundledOutput(side), colors.brown) then
local side = "top"
while true do
term.clear()
term.setCursorPos(1,1)
print("Which mobs would you like to toggle?")
print("1. Enderman")
print("2. Blaze")
print("B. Back")
local input = io.read()
if input == "1" then
if colors.test(rs.getBundledOutput(side),colors.brown) == true then
rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side), colors.brown))
else
rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), colors.brown))
end
elseif input == "2" then
if colors.test(rs.getBundledOutput(side), colors.green) == true then
rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side), colors.green))
else
rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side), colors.green))
end
elseif input == "B" then
term.clear()
term.setCursorPos(1,1)
break
end
end