is there a way to turn off only one cable?
How do I turn off one color in a bundled cable?
Started by MoRBiiD Legacy, Apr 10 2015 12:11 AM
5 replies to this topic
#1
Posted 10 April 2015 - 12:11 AM
#3
Posted 10 April 2015 - 12:38 AM
KingofGamesYami, on 10 April 2015 - 12:22 AM, said:
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
#4
Posted 10 April 2015 - 01:29 AM
rs.setBundledOutput( "back", rs.getBundledOutput( "back" ) - *your color here* )
Removes 1 color.
#5
Posted 10 April 2015 - 07: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* ))
#6
Posted 10 April 2015 - 02:41 PM
Bomb Bloke, on 10 April 2015 - 07:59 AM, said:
... 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* ))
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











