Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --PeachMaster's Digital Signal Controller
- --Edit if you want
- local bundledIO = peripheral.wrap("left")
- os.loadAPI("touchpoint")
- local redstoneOut = false
- t = touchpoint.new("monitor_8")
- local function bundledOutputContains(color)
- if bundledIO.testBundledOutput(colors.combine(bundledIO.getBundledOutput(), color)) then
- return true
- else
- return false
- end
- end
- local function addBundledOutput(color)
- bundledIO.setBundledOutput(colors.combine(bundledIO.getBundledOutput(), color))
- end
- local function removeBundledOutput(color)
- bundledIO.setBundledOutput(colors.subtract(bundledIO.getBundledOutput(), color))
- end
- local function toggleRedstone()
- if redstoneOut == true then
- redstone.setOutput("top", false)
- redstoneOut = false
- else
- redstone.setOutput("top", true)
- redstoneOut = true
- end
- end
- local function toggleBundledOutput(color)
- if bundledOutputContains(color) then
- removeBundledOutput(color)
- else
- addBundledOutput(color)
- end
- local file = fs.open("status", "w")
- file.write(bundledIO.getBundledOutput())
- file.close()
- end
- bundledIO.setBundledOutput(0)
- local file = fs.open("status", "r")
- bundledIO.setBundledOutput(tonumber(file.readAll()))
- file.close()
- toggleRedstone()
- toggleRedstone()
- t:add("Eastbound NS Track", function()
- toggleBundledOutput(colors.red)
- toggleRedstone()
- t:toggleButton("Eastbound NS Track")
- end,2, 2, 22, 4, colors.red, colors.lightBlue)
- t:add("Northbound NS Track", function()
- toggleBundledOutput(colors.yellow)
- toggleRedstone()
- t:toggleButton("Northbound NS Track")
- end, 24, 2, 44, 4, colors.yellow, colors.lightBlue)
- t:add("MCRR Jct. Track", function()
- toggleBundledOutput(colors.orange)
- toggleRedstone()
- t:toggleButton("MCRR Jct. Track")
- end, 46, 2, 56, 4, colors.orange, colors.lightBlue)
- t:add("Johnson West Wye", function()
- toggleBundledOutput(colors.purple)
- toggleRedstone()
- t:toggleButton("Johnson West Wye")
- end, 2, 6, 22, 8, colors.purple, colors.lightBlue)
- t:add("Johnson North Wye", function()
- toggleBundledOutput(colors.pink)
- toggleRedstone()
- t:toggleButton("Johnson North Wye")
- end, 24, 6, 44, 8, colors.pink, colors.lightBlue)
- t:add("SB Crossover NB", function()
- toggleBundledOutput(colors.green)
- toggleRedstone()
- t:toggleButton("SB Crossover NB")
- end, 2, 10, 22, 12, colors.green, colors.lightBlue)
- t:add("SB Crossover SB", function()
- toggleBundledOutput(colors.brown)
- toggleRedstone()
- t:toggleButton("SB Crossover SB")
- end, 24, 10, 44, 12, colors.brown, colors.lightBlue)
- t:add("TUS South Enterance", function()
- toggleBundledOutput(colors.blue)
- toggleRedstone()
- t:toggleButton("TUS South Enterance")
- end, 2, 14, 22, 16, colors.blue, colors.lightBlue)
- t:add("TUS North Enterance", function()
- toggleBundledOutput(colors.cyan)
- toggleRedstone()
- t:toggleButton("TUS North Enterance")
- end, 24, 14, 44, 16, colors.cyan, colors.lightBlue)
- t:add("North Crossover SB", function()
- toggleBundledOutput(colors.lightGray)
- toggleRedstone()
- t:toggleButton("North Crossover SB")
- end, 2, 18, 22, 20, colors.lightGray, colors.lightBlue)
- t:add("North Crossover NB", function()
- toggleBundledOutput(colors.gray)
- toggleRedstone()
- t:toggleButton("North Crossover NB")
- end, 24, 18, 44, 20, colors.gray, colors.lightBlue)
- t:draw()
- print(bundledOutputContains(colors.red))
- t:run()
- print("Here?")
- if bundledOutputContains(colors.red) then
- print("Red!")
- t:toggleButton("Eastboound NS Track")
- elseif bundledOutputContains(colors.yellow) then
- t:toggleButton("Northbound NS Track")
- elseif bundledOutputContains(colors.orange) then
- t:toggleButton("MCRR Jct. Track")
- elseif bundledOutputContains(colors.purple) then
- t:toggleButton("Johnson West Wye")
- elseif bundledOutputContains(colors.pink) then
- t:toggleButton("Johnson North Wye")
- elseif bundledOutputContains(colors.green) then
- t:toggleButton("SB Crossover NB")
- elseif bundledOutputContains(colors.brown) then
- t:toggleButton("SB Crossover SB")
- elseif bundledOutputContains(colors.blue) then
- t:toggleButton("TUS South Enterance")
- elseif bundledOutputContains(colors.cyan) then
- t:toggleButton("TUS North Enterance")
- elseif bundledOutputContains(colors.blue) then
- t:toggleButton("North Crossover NB")
- end
- event, p1, p2, p3, p4, p5 = t:handleEvents(os.pullEvent())
Advertisement
Add Comment
Please, Sign In to add comment