Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m = peripheral.wrap("top")
- m.clear()
- rednet.open("back")
- button1 = 0
- button2 = 0
- button3 = 0
- button4 = 0
- button5 = 0
- button6 = 0
- function fillTable()
- button.setTable("Cows", spawn1on, 6,19,3,5)
- button.setTable("Sheep", spawn2on, 6,19,7,9)
- button.setTable("Zombies", spawn3on, 6,19,11,13)
- button.setTable("Creepers", spawn4on, 6,19,15,17)
- button.setTable("Skeletons", spawn5on, 6,19,19,21)
- button.setTable("Enderman", spawn6on, 6,19,23,25)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- function spawn1on()
- if button1 == 0 then
- button.toggleButton("Cows")
- rednet.broadcast("spawn 1 on")
- button1 = 1
- else
- button.toggleButton("Cows")
- rednet.broadcast("spawn 1 off")
- button1 = 0
- end
- end
- function spawn2on()
- if button2 == 0 then
- button.toggleButton("Sheep")
- rednet.broadcast("spawn 2 on")
- button2 = 1
- else
- button.toggleButton("Sheep")
- rednet.broadcast("spawn 2 off")
- button2 = 0
- end
- end
- function spawn3on()
- if button3 == 0 then
- button.toggleButton("Zombies")
- rednet.broadcast("spawn 3 on")
- button3 = 1
- else
- button.toggleButton("Zombies")
- rednet.broadcast("spawn 3 off")
- button3 = 0
- end
- end
- function spawn4on()
- if button4 == 0 then
- button.toggleButton("Creepers")
- rednet.broadcast("spawn 4 on")
- button4 = 1
- else
- button.toggleButton("Creepers")
- rednet.broadcast("spawn 4 off")
- button4 = 0
- end
- end
- function spawn5on()
- if button5 == 0 then
- button.toggleButton("Skeletons")
- rednet.broadcast("spawn 5 on")
- button5 = 1
- else
- button.toggleButton("Skeletons")
- rednet.broadcast("spawn 5 off")
- button5 = 0
- end
- end
- function spawn6on()
- if button6 == 0 then
- button.toggleButton("Enderman")
- rednet.broadcast("spawn 6 on")
- button6 = 1
- else
- button.toggleButton("Enderman")
- rednet.broadcast("spawn 6 off")
- button6 = 0
- end
- end
- fillTable()
- button.heading("Monster Spawner Controller")
- button.label(1,4,"Sp.1")
- button.label(1,8,"Sp.2")
- button.label(1,12,"Sp.3")
- button.label(1,16,"Sp.4")
- button.label(1,20,"Sp.5")
- button.label(1,24,"Sp.6")
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment