Advertisement
chezpaul

Redstone Cables

Oct 14th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. --# load the Touchpoint API
  2. loadup = function()
  3. shell.run("pastebin", "get", "pFHeia96", "touchpoint")
  4. os.loadAPI("touchpoint")
  5. print("Touchpoint API Loaded")
  6. sleep(1)
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. loadup()
  12.  
  13. --# Redstone Cable Bug
  14. function colours.subtract(cols, ...)
  15. for i = 1, #arg do
  16. if bit.band(cols, arg[i]) == arg[i] then
  17. cols = cols - arg[i]
  18. end
  19. end
  20. return cols
  21. end
  22. colors.subtract = colours.subtract
  23.  
  24. --# intialize a new button set on the top monitor
  25. local t = touchpoint.new("top")
  26.  
  27. --# rs.setBundledOutput ORANGE.
  28. function OrangeAction()
  29. t:toggleButton("Pump")
  30. 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)))
  31. end
  32.  
  33.  
  34.  
  35. --# rs.setBundledOutput GREY.
  36. function GrayAction()
  37. t:toggleButton("Refinery")
  38. 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)))
  39. end
  40.  
  41. --# rs.setBundledOutput YELLOW.
  42. function YellowAction()
  43. t:toggleButton("Central")
  44. 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)))
  45. end
  46.  
  47.  
  48. --# Main Function.
  49. buttonLoads = function()
  50. t:add("Command Center", nil, 1, 1, 30, 3, colors.black, colors.black)
  51. t:add("Pump", OrangeAction, 4, 4, 16, 7, colors.red, colors.lime)
  52. t:add("Refinery", GrayAction, 18, 4, 30, 7, colors.red, colors.lime)
  53. t:add("Central", YellowAction, 32, 4, 44, 7, colors.red, colors.lime)
  54.  
  55. t:draw()
  56. end
  57.  
  58. buttonLoads()
  59. t:run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement