Advertisement
Puffymania

Bundled Button test

Sep 18th, 2024
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ComputercraftButtonAPI")
  2. function red(state)
  3.     if state then
  4.      redstone.setBundledOutput("back",colors.combine(redstone.getBundledOutput("back"),colors.red))
  5.     else
  6.   redstone.setBundledOutput("back",colors.subtract(redstone.getBundledOutput("back"), colors.red))
  7.     end
  8. end
  9.  
  10. function white(state)
  11.  if state then
  12.   redstone.setBundledOutput("back",colors.combine(redstone.getBundledOutput("back"),colors.white))
  13.  else
  14.  redstone.setBundledOutput("back",colors.subtract(redstone.getBundledOutput("back"), colors.white))
  15.    end
  16. end  
  17.  
  18.  
  19. green = colors.green
  20. red = colors.red
  21.  
  22. whiteButton = ComputercraftButtonAPI.createNewButton(4, 10, "Cells", green, red, true, white)
  23. redButton = ComputercraftButtonAPI.createNewButton(4, 4, "Lighting", green, red, true, red)
  24. list = {redButton, whiteButton}
  25.  
  26.  
  27.  
  28. monitor = peripheral.wrap("top")
  29. monitor.setTextScale(0.5)
  30.  
  31. ComputercraftButtonAPI.drawButtons(monitor, list)
  32. while true do
  33.     ComputercraftButtonAPI.checkButtonsPressed(monitor, list, 0, print)
  34. end
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement