Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("top")
  3. m.clear()
  4. function fillTable()
  5. button.setTable("Test", Test, 2, 10, 2, 2, colors.red)
  6. button.setTable("Test2", Test2, 2, 10, 4, 4, colors.yellow)
  7. button.screen()
  8. end
  9. function getClick()
  10. event,side,x,y = os.pullEvent("monitor_touch")
  11. button.checkxy(x,y)
  12. end
  13. redstone.setBundledOutput("right", 0)
  14. function setBundledColor(side, color, state)
  15. if state then
  16. if not colors.test(redstone.getBundledOutput(side), color) then
  17. redstone.setBundledOutput(side, colors.combine(redstones.getBundledOutput(side), color))
  18. end
  19. else
  20. if colors.test(redstones.getBundledOutput(side), color) then
  21. redstone.setBundledOutput(side, colors.subtract(redstone.getBundledOutput(side), color))
  22. end
  23. end
  24. end
  25. function toggleBundledColor(side, color)
  26. redstone.setBundledOutput(side, (colors.test(redstone.getBundledOutput(side), color) and colors.subtract(redstone.getBundledOutput(side), color) or colors.combine(redstone.getBundledOutput(side), color)))
  27. end
  28.  
  29. function Test()
  30. button.toggleButton("Test")
  31. toggleBundledColor("right", colors.white)
  32. print("Test")
  33. end
  34. function Test2()
  35. button.toggleButton("Test2")
  36. toggleBundledColor("right", colors.yellow)
  37. print("Test2")
  38. end
  39. fillTable()
  40. while true do
  41. getClick()
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement