Advertisement
chezpaul

Redstone 2

Oct 13th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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. --# intialize a new button set on the top monitor
  14. local t = touchpoint.new("top")
  15.  
  16. --rs.getOutput LEFT.
  17. function leftAction()
  18. t:toggleButton("Pump")
  19. if rs.getOutput("left") == true then
  20. rs.setOutput("left", false)
  21. else
  22. rs.setOutput("left", true)
  23. end
  24. end
  25.  
  26. --rs.getOutput RIGHT.
  27. function rightAction()
  28. t:toggleButton("Refinery")
  29. if rs.getOutput("right") == true then
  30. rs.setOutput("right", false)
  31. else
  32. rs.setOutput("right", true)
  33. end
  34. end
  35.  
  36. --rs.getOutput BACK
  37. function backAction()
  38. t:toggleButton("BACK")
  39. if rs.getOutput("back") == true then
  40. rs.setOutput("back", false)
  41. else
  42. rs.setOutput("back", true)
  43. end
  44. end
  45.  
  46.  
  47. --this function must be below the three other functions.
  48. buttonLoads = function()
  49. t:add("Pump", leftAction, 4, 4, 16, 7, colors.red, colors.slime)
  50. t:add("BACK", backAction, 32, 4, 44, 7, colors.red, colors.slime)
  51. t:add("Refinery", rightAction, 18, 4, 30, 7, colors.red, colors.slime)
  52. t:draw()
  53. end
  54.  
  55. buttonLoads()
  56. t:run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement