Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("Button")
- p = peripheral.wrap("back")
- m = peripheral.wrap("right")
- m.clear()
- local lit = {["state"] = false}
- local wind = {["state"] = false}
- function fillTable()
- Button.setTable("Lights", lights, 4,14,3,5)
- Button.setTable("Fans", fans, 4,14,7,9)
- Button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- Button.checkxy(x,y)
- end
- function lights()
- Button.toggleButton("Lights")
- if not lit.state then
- p.setBundledOutput(colors.combine(p.getBundledOutput()colors.purple))
- lit.state = true
- print("Lights on")
- else
- p.setBundledOutput(colors.subtract(p.getBundledOutput()colors.purple))
- lit.state = false
- print("Lights off")
- end
- end
- function fans()
- Button.toggleButton("Fans")
- if not wind.state then
- p.setBundledOutput(colors.combine(p.getBundledOutput()colors.white))
- wind.state = true
- print("Fans on")
- else
- p.setBundledOutput(colors.subtract(p.getBundledOutput()colors.white))
- wind.state = false
- print("Fans off")
- end
- end
- fillTable()
- Button.heading("MobFarm")
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment