13 posts
Posted 10 April 2015 - 01:11 AM
is there a way to turn off only one cable?
3057 posts
Location
United States of America
Posted 10 April 2015 - 01:22 AM
is there a way to turn off only one cable?
Set the output to the cables you want to remain on, eg.
rs.setBundledOutput( 2^2 + 2^8 )
--#now turn off one
rs.setBundledOutput( 2^2 )
13 posts
Posted 10 April 2015 - 01:38 AM
is there a way to turn off only one cable?
Set the output to the cables you want to remain on, eg.
rs.setBundledOutput( 2^2 + 2^8 )
--#now turn off one
rs.setBundledOutput( 2^2 )
how about when you want all lights to be managed independently? (for example: turn on red, turn on blue, turn off blue, turn on red. not turn on red, turn on blue (deactivates red), turn off blue) this is what happens when i use my code:
- shell.run("clear")
- textutils.slowPrint("Welcome to *******'s light system!")
- textutils.slowPrint("")
- textutils.slowPrint("Red–Blue")
- textutils.slowWrite("Color: ")
- input = read()
- if (input) == ("red") then
- redstone.testBundledInput("back", colors.red)
- if (redstone.testBundledInput("back", colors.red)) == false then
- textutils.slowPrint("Status: Off")
- textutils.slowWrite("Turn on?: ")
- input = read()
- if (input) == ("yes") then
- redstone.setBundledOutput("back", colors.red)
- sleep(1)
- shell.run("a")
- else shell.run("a")
- end
- elseif (redstone.testBundledInput("back", colors.red)) == true then
- textutils.slowPrint("Status: On")
- textutils.slowWrite("Turn off?: ")
- input = read()
- if (input) == ("yes") then
- redstone.setBundledOutput("back", 0)
- sleep(1)
- shell.run("a")
- end
- end
- elseif (input) == ("blue") then
- redstone.testBundledInput("back", colors.blue)
- if (redstone.testBundledInput("back", colors.blue)) == false then
- textutils.slowPrint("Status: Off")
- textutils.slowWrite("Turn on?: ")
- input = read()
- if (input) == ("yes") then
- redstone.setBundledOutput("back", colors.blue)
- sleep(1)
- shell.run("a")
- else shell.run("a")
- end
- elseif (redstone.testBundledInput("back", colors.blue)) == true then
- textutils.slowPrint("Status: On")
- textutils.slowWrite("Turn off?: ")
- input = read()
- if (input) == ("yes") then
- redstone.setBundledOutput("back", 0)
- sleep(1)
- shell.run("a")
- else shell.run("a")
- end
- end
- else textutils.slowPrint("Sorry, not an option.")
- sleep(2)
- shell.run("a")
- end
3057 posts
Location
United States of America
Posted 10 April 2015 - 02:29 AM
rs.setBundledOutput( "back", rs.getBundledOutput( "back" ) - *your color here* )
Removes 1 color.
7083 posts
Location
Tasmania (AU)
Posted 10 April 2015 - 08:59 AM
… though that's a bit risky if the line might be executed when the colour is already disabled. Hence colours.subtract(), which can handle such a scenario correctly:
rs.setBundledOutput( "back", colours.subtract(rs.getBundledOutput( "back" ), *your color here* ))
43 posts
Posted 10 April 2015 - 03:41 PM
… though that's a bit risky if the line might be executed when the colour is already disabled. Hence colours.subtract(), which can handle such a scenario correctly:
rs.setBundledOutput( "back", colours.subtract(rs.getBundledOutput( "back" ), *your color here* ))
I have two functions to do basically this - add or subtract (a set of) color(s). I find it a whole lot more intuitive to use.