Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# load the Touchpoint API
- loadup = function()
- shell.run("pastebin", "get", "h2qXpRLG", "touchpoint")
- os.loadAPI("touchpoint")
- print("Touchpoint API Loaded")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- end
- loadup()
- --# Redstone Cable Bug
- function colours.subtract(cols, ...)
- for i = 1, #arg do
- if bit.band(cols, arg[i]) == arg[i] then
- cols = cols - arg[i]
- end
- end
- return cols
- end
- colors.subtract = colours.subtract
- --# intialize a new button set on the top monitor
- local t = touchpoint.new("top")
- --# rs.setBundledOutput ORANGE.
- function OrangeAction()
- t:toggleButton("Pump")
- rs.setBundledOutput("back", (colors.test(rs.getBundledOutput("back"), colors.orange) and colors.subtract(rs.getBundledOutput("back"), colors.orange) or colors.combine(rs.getBundledOutput("back"), colors.orange)))
- end
- --# rs.setBundledOutput GREY.
- function GrayAction()
- t:toggleButton("Refinery")
- rs.setBundledOutput("back", (colors.test(rs.getBundledOutput("back"), colors.gray) and colors.subtract(rs.getBundledOutput("back"), colors.gray) or colors.combine(rs.getBundledOutput("back"), colors.gray)))
- end
- --# rs.setBundledOutput YELLOW.
- function YellowAction()
- t:toggleButton("Central")
- rs.setBundledOutput("back", (colors.test(rs.getBundledOutput("back"), colors.yellow) and colors.subtract(rs.getBundledOutput("back"), colors.yellow) or colors.combine(rs.getBundledOutput("back"), colors.yellow)))
- end
- --# rs.setBundledOutput BLUE.
- function BlueAction()
- t:toggleButton("Fluid")
- rs.setBundledOutput("back", (colors.test(rs.getBundledOutput("back"), colors.blue) and colors.subtract(rs.getBundledOutput("back"), colors.blue) or colors.combine(rs.getBundledOutput("back"), colors.blue)))
- end
- --# Main Function.
- buttonLoads = function()
- t:add("REFINERY", nil, 4, 1, 16, 3, colors.black, colors.black)
- t:add("REACTOR", nil, 18, 1, 30, 3, colors.black, colors.black)
- t:add("Pump", OrangeAction, 4, 4, 16, 7, colors.red, colors.lime)
- t:add("Refinery", GrayAction, 4, 9, 16, 12, colors.red, colors.lime)
- t:add("Central", YellowAction, 18, 4, 30, 7, colors.red, colors.lime)
- t:add("Fluid", BlueAction, 18, 9, 30, 12, colors.red, colors.lime)
- t:draw()
- end
- buttonLoads()
- t:run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement