Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- local m = peripheral.wrap("monitor_0")
- Bottom = Grinder
- Top = Lights
- Left = MobSpawner
- local function default()
- rs.setOutput("left", true)
- rs.setOutput("bottom", false)
- button.toggleButton("Grinder")
- rs.setOutput("top", false)
- end
- function menu()
- m.clear()
- button.setTable("Lights", lights, 4,26 ,2,6)
- button.setTable("Grinder", grinder, 4,26 ,8,12)
- button.setTable("Spawner", spawner, 4,26 ,14,17)
- button.setTable("Reboot", reboot, 2,28, 19,20)
- button.screen()
- default()
- end
- function reboot()
- os.reboot()
- end
- function grinder()
- if rs.getOutput("bottom")
- then grinderOn() else grinderOff()
- end
- end
- function spawner()
- if rs.getOutput("left")
- then spawnerOn() else spawnerOff()
- end
- end
- function lights()
- if rs.getOutput("top") then
- lightsOn() else lightsOff()
- end
- end
- function lightsOn()
- rs.setOutput("top", false)
- button.toggleButton("Lights")
- end
- function lightsOff()
- rs.setOutput("top", true)
- button.toggleButton("Lights")
- end
- function grinderOn()
- rs.setOutput("bottom", false)
- button.toggleButton("Grinder")
- end
- function grinderOff()
- rs.setOutput("bottom", true)
- button.toggleButton("Grinder")
- end
- function spawnerOn()
- rs.setOutput("left", false)
- button.toggleButton("Spawner")
- activatorOn()
- end
- function spawnerOff()
- rs.setOutput("left", true)
- button.toggleButton("Spawner")
- activatorOff()
- end
- function getClick()
- local event,side,x,y = os.pullEvent()
- if event=="monitor_touch" then
- button.checkxy(x,y)
- end
- end
- menu()
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement