Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Original Code made by Jacen Caedus on 4/19/2015
- --Button API made by Direwolf20 on 1/09/2015
- os.loadAPI("button")--load button api
- m = peripheral.wrap("top")--find monitor peripheral
- xSize, ySize = m.getSize()--get size of the monitor
- xMin= (xSize/2)-4--the leftmost point of each button
- xMax = xMin + 10
- spawners = {["zombie"] = false, ["wither"] = false, ["blaze"] = false}--store the states of each spawner
- buttons = 3--number of buttons there are
- joe = false--whether or not killer joe is on
- function test(table)
- print(spawners[table])
- end
- function Spawner(table)
- spawners[table] = not spawners[table]--toggle the spawner
- Joe()
- if table == "zombie" then
- button.toggleButton("Zombie")--toggle the button
- end
- if table == "wither" then
- button.toggleButton("Wither")
- end
- test(table)
- -- test()
- end
- function Menu()
- button.clearTable()
- button.setTable("Zombie", Spawner, "zombie", xMin, xMax, math.floor(ySize/buttons), math.floor(ySize/buttons))
- -- button.setTable("Wither", Spawner, "wither", xMiddle, xMiddle+10, ySize/(buttons-1), (ySize/(buttons-1))+3)
- button.screen()
- end
- function Joe()
- local spawnerOn = false
- for i=1, #spawners do
- if spawners[i] == true then
- spawnerOn = true
- end
- end
- if spawnerOn then
- joe = true
- end
- end
- m.clear()
- m.setTextScale(1)
- Menu()
- while true do
- local event, side, x, y
- event, side, x, y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement