Jump to content




[Question][Lua]Restone Bundled cables


  • You cannot reply to this topic
2 replies to this topic

#1 exploder

  • Members
  • 69 posts
  • LocationLatvia

Posted 18 September 2012 - 12:55 PM

Hi everyone.

How can I turn off one color at once, because rs.setBundledOutput("bottom",0) turns all outputs off, so how could I just turn off only one color at a time.

Another thing is if one color is on and I turn the other color on then the first color is not being outputted anymore and the second color turn on.



function light()
if redstone.testBundledInput("bottom",2) == false then
term.setCursorPos(1,13)
print("			 +---------------------+")
print("			 :Lights are turning on:")
print("			 +---------------------+")
sleep(0.5)
rs.setBundledOutput("bottom",2)
term.clear()
elseif redstone.testBundledInput("bottom",2) == true then
term.setCursorPos(1,13)
print("			+----------------------+")
print("			:Lights are turning off:")
print("			+----------------------+")
sleep(0.5)
term.clear()
rs.setBundledOutput("bottom",0)
end
end

function windows()
if redstone.testBundledInput("bottom",1) == true then
term.setCursorPos(1,13)
print("			+----------------------+")
print("			:  Windows are opening :")
print("			+----------------------+")
sleep(0.5)
rs.setBundledOutput("bottom",0)
term.clear()
elseif redstone.testBundledInput("bottom",1) == false then
term.setCursorPos(1,13)
print("			+----------------------+")
print("			:  Windows are closing :")
print("			+----------------------+")
sleep(0.5)
rs.setBundledOutput("bottom",1)
term.clear()
end
end

Sorry for bad description, because I couldn't figure it out how to explain it to other people, and English is not my native language.

#2 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 18 September 2012 - 01:04 PM

well what you do is get the current output and take away the colour you don't want

local function addcol(col, side)
  rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side),col))
end
local function remcol(col, side)
  rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side),col))
end
remcol removes the colour from the specified side
addcol does the opposite

example of use:
remcol(colors.black, 'back')


#3 exploder

  • Members
  • 69 posts
  • LocationLatvia

Posted 18 September 2012 - 04:35 PM

View PostKaoS, on 18 September 2012 - 01:04 PM, said:

well what you do is get the current output and take away the colour you don't want

local function addcol(col, side)
  rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side),col))
end
local function remcol(col, side)
  rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side),col))
end
remcol removes the colour from the specified side
addcol does the opposite

example of use:
remcol(colors.black, 'back')

KaoS thank you for replying.

Yes, these things worked, thank you very much.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users