Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m = peripheral.wrap("right")
- m.clear()
- color1 = 1
- color2 = 1
- color3 = 1
- function fillTable()
- button.setTable("Color 1", changeColor1, 2,12,2,11)
- button.setTable("Color 2", changeColor2, 15,25,2,11)
- button.setTable("Color 3", changeColor3, 28,38,2,11)
- button.setTable("Set Colors", setColors, 4,36, 14, 17)
- button.screen()
- end
- function getClick()
- event, side, x, y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- function changeColor(colorNum)
- colorNum = colorNum * 2
- if colorNum > 32786 then
- colorNum = 1
- end
- return colorNum
- end
- function changeColor1()
- color1 = changeColor(color1)
- button.setColor("Color 1", color1)
- end
- function changeColor2()
- color2 = changeColor(color2)
- button.setColor("Color 2", color2)
- end
- function changeColor3()
- color3 = changeColor(color3)
- button.setColor("Color 3", color3)
- end
- function setColors()
- chest = peripheral.wrap("top")
- if chest == nil then
- print("No Chest")
- else
- if peripheral.getType("top") == "ender_chest" then
- chest.setColors(color1, color2, color3)
- else
- chest.setColors(color3, color2, color1)
- end
- end
- end
- fillTable()
- button.setColor("Color 1", color1)
- button.setColor("Color 2", color2)
- button.setColor("Color 3", color3)
- while true do
- getClick()
- end
Add Comment
Please, Sign In to add comment