Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.unloadAPI("output")
- os.unloadAPI("button")
- os.loadAPI("output") -- requires: fDvvvy0L
- os.loadAPI("button") -- requires: E9cdkHLf
- local grinderState = false -- fale == off
- local spawnerState = false -- false == off
- local doorState = false -- false == open
- local fanState = false -- false == off
- output.setside("bottom")
- function fillTable()
- button.heading("-----")
- button.addButton("Door", doDoor,1,7,2,3)
- button.addButton("Spawn", doSpawn,1,7,5,6)
- button.addButton("Kill", doKill,1,7,8,9)
- button.addButton("Fans", doFans,1,7,11,12)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- function doSpawn()
- spawnerState = not spawnerState
- output.set("blue", (not spawnerState))
- button.setState("Spawn", spawnerState)
- end
- function doKill()
- grinderState = not grinderState
- output.set("red", (not grinderState))
- button.setState("Kill", grinderState)
- end
- function doFans()
- fanState = not fanState
- output.set("yellow", (not fanState))
- button.setState("Fans", fanState)
- end
- function doDoor()
- if not spawnerState and not grinderState then
- doorState = not doorState
- output.set("white", doorState)
- button.setState("Door", doorState)
- else
- button.flash("Door")
- end
- end
- function onBoot()
- grinderState = true
- spawnerState = true
- fanState = true
- doorState = false
- doSpawn()
- doKill()
- doFans()
- doDoor()
- end
- fillTable()
- onBoot()
- while true do getClick() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement