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

rs.setBundledOutput

Started by matt55284, 27 November 2013 - 09:01 AM
matt55284 #1
Posted 27 November 2013 - 10:01 AM
Hello, I was wondering how to turn a specific wire off, rather than reset all of them,

For example,

rs.setBundledOutput("back", colors.combine(colors.red, colors.yellow))
sleep (1)
rs.setBundledOutput("back", 0)

rs.setBundledOutput("back",0) turns both the red and the yellow off, how can I turn just one off?


Also is there a way to keep the state of the wire when the program is turned off?

For example, making a program that allows you to toggle the lights in an area on and off, if you turn them on, then terminate or shutdown the terminal, the lights will turn off because it is no longer being powered. is there a way for it to remember the state of what the lights were in, or would I need to use something outside of computer craft for this?

Thanks,
Matt :)/>
matt55284 #2
Posted 27 November 2013 - 11:17 AM
Dont worry about the second question, RS Latch from RP works great for that.
Engineer #3
Posted 27 November 2013 - 03:46 PM
Dont worry about the second question, RS Latch from RP works great for that.
*RP doesnt get updated*

Anyway, no, there is not really something where you are looking for. Well, actually there is, its called variables. Read up on them and read the next section of this post after that.

You can something along the lines of:

local currentColors = colors.combine( colors.yellow, colors.black ) 
rs.setBundledOutput( "right", currentColors )

-- ...
-- ...

sleep( 1 )
currentColors = colors.subtract( currentColors, colors.black )
rs.setBundledOutput("right", 0 ) -- Not sure if this is necessary, just incase
rs.setBundledOutput("right", currentColors )

I would suggest that you make a function out of it in some sort.
Bomb Bloke #4
Posted 27 November 2013 - 04:35 PM
Well, there is rs.getBundledOutput(). Which allows:

rs.setBundledOutput("back", colours.subtract( rs.getBundledOutput("back"), colours.yellow) )
Engineer #5
Posted 27 November 2013 - 06:49 PM
Well, there is rs.getBundledOutput(). Which allows:

rs.setBundledOutput("back", colours.subtract( rs.getBundledOutput("back"), colours.yellow) )
It's the same concept :D/>
Didnt even know such a function existed :P/>
matt55284 #6
Posted 28 November 2013 - 12:40 PM
Well, there is rs.getBundledOutput(). Which allows:

rs.setBundledOutput("back", colours.subtract( rs.getBundledOutput("back"), colours.yellow) )
Well, there is rs.getBundledOutput(). Which allows:

rs.setBundledOutput("back", colours.subtract( rs.getBundledOutput("back"), colours.yellow) )
It's the same concept :D/>
Didnt even know such a function existed :P/>

Thanks for the help both of you :P/>
Got it working now :D/>

And what I meant about the RS Latch, is that its a toggle gate so it remembers the input it received. :P/>