SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("button")
| |
| 2 | m = peripheral.wrap("top")
| |
| 3 | m.clear() | |
| 4 | rednet.open("back")
| |
| 5 | button1 = 0 | |
| 6 | - | button.setTable("Cows On", spawn1on, 6,19,3,5)
|
| 6 | + | button2 = 0 |
| 7 | - | button.setTable("Cows Off", spawn1off, 21,34,3,5)
|
| 7 | + | button3 = 0 |
| 8 | - | button.setTable("Sheep On", spawn2on, 6,19,7,9)
|
| 8 | + | button4 = 0 |
| 9 | - | button.setTable("Sheep Off", spawn2off, 21,34,7,9)
|
| 9 | + | button5 = 0 |
| 10 | - | button.setTable("Zombies On", spawn3on, 6,19,11,13)
|
| 10 | + | button6 = 0 |
| 11 | - | button.setTable("Zombies Off", spawn3off, 21,34,11,13)
|
| 11 | + | |
| 12 | - | button.setTable("Creepers On", spawn4on, 6,19,15,17)
|
| 12 | + | |
| 13 | - | button.setTable("Creepers Off", spawn4off, 21,34,15,17)
|
| 13 | + | button.setTable("Cows", spawn1on, 6,19,3,5)
|
| 14 | - | button.setTable("Skeletons On", spawn5on, 6,19,19,21)
|
| 14 | + | button.setTable("Sheep", spawn2on, 6,19,7,9)
|
| 15 | - | button.setTable("Skeletons Off", spawn5off, 21,34,19,21)
|
| 15 | + | button.setTable("Zombies", spawn3on, 6,19,11,13)
|
| 16 | - | button.setTable("Enderman On", spawn6on, 6,19,23,25)
|
| 16 | + | button.setTable("Creepers", spawn4on, 6,19,15,17)
|
| 17 | - | button.setTable("Enderman Off", spawn6off, 21,34,23,25)
|
| 17 | + | button.setTable("Skeletons", spawn5on, 6,19,19,21)
|
| 18 | button.setTable("Enderman", spawn6on, 6,19,23,25)
| |
| 19 | button.screen() | |
| 20 | end | |
| 21 | ||
| 22 | function getClick() | |
| 23 | event,side,x,y = os.pullEvent("monitor_touch")
| |
| 24 | button.checkxy(x,y) | |
| 25 | end | |
| 26 | ||
| 27 | - | button.flash("Cows On")
|
| 27 | + | |
| 28 | - | rednet.broadcast("spawn 1 on")
|
| 28 | + | if button1 == 0 then |
| 29 | button.toggleButton("Cows")
| |
| 30 | rednet.broadcast("spawn 1 on")
| |
| 31 | - | function spawn1off() |
| 31 | + | button1 = 1 |
| 32 | - | button.flash("Cows Off")
|
| 32 | + | else |
| 33 | - | rednet.broadcast("spawn 1 off")
|
| 33 | + | button.toggleButton("Cows")
|
| 34 | rednet.broadcast("spawn 1 off")
| |
| 35 | button1 = 0 | |
| 36 | end | |
| 37 | - | button.flash("Sheep On")
|
| 37 | + | |
| 38 | ||
| 39 | function spawn2on() | |
| 40 | if button2 == 0 then | |
| 41 | - | function spawn2off() |
| 41 | + | button.toggleButton("Sheep")
|
| 42 | - | button.flash("Sheep Off")
|
| 42 | + | |
| 43 | button2 = 1 | |
| 44 | else | |
| 45 | button.toggleButton("Sheep")
| |
| 46 | rednet.broadcast("spawn 2 off")
| |
| 47 | - | button.flash("Zombies On")
|
| 47 | + | button2 = 0 |
| 48 | end | |
| 49 | end | |
| 50 | ||
| 51 | - | function spawn3off() |
| 51 | + | |
| 52 | - | button.flash("Zombies Off")
|
| 52 | + | if button3 == 0 then |
| 53 | button.toggleButton("Zombies")
| |
| 54 | rednet.broadcast("spawn 3 on")
| |
| 55 | button3 = 1 | |
| 56 | else | |
| 57 | - | button.flash("Creepers On")
|
| 57 | + | button.toggleButton("Zombies")
|
| 58 | rednet.broadcast("spawn 3 off")
| |
| 59 | button3 = 0 | |
| 60 | end | |
| 61 | - | function spawn4off() |
| 61 | + | |
| 62 | - | button.flash("Creepers Off")
|
| 62 | + | |
| 63 | function spawn4on() | |
| 64 | if button4 == 0 then | |
| 65 | button.toggleButton("Creepers")
| |
| 66 | rednet.broadcast("spawn 4 on")
| |
| 67 | - | button.flash("Skeletons On")
|
| 67 | + | button4 = 1 |
| 68 | else | |
| 69 | button.toggleButton("Creepers")
| |
| 70 | rednet.broadcast("spawn 4 off")
| |
| 71 | - | function spawn5off() |
| 71 | + | button4 = 0 |
| 72 | - | button.flash("Skeletons Off")
|
| 72 | + | |
| 73 | end | |
| 74 | ||
| 75 | function spawn5on() | |
| 76 | if button5 == 0 then | |
| 77 | - | button.flash("Enderman On")
|
| 77 | + | button.toggleButton("Skeletons")
|
| 78 | rednet.broadcast("spawn 5 on")
| |
| 79 | button5 = 1 | |
| 80 | else | |
| 81 | - | function spawn6off() |
| 81 | + | button.toggleButton("Skeletons")
|
| 82 | - | button.flash("Enderman Off")
|
| 82 | + | |
| 83 | button5 = 0 | |
| 84 | end | |
| 85 | end | |
| 86 | ||
| 87 | function spawn6on() | |
| 88 | if button6 == 0 then | |
| 89 | button.toggleButton("Enderman")
| |
| 90 | rednet.broadcast("spawn 6 on")
| |
| 91 | button6 = 1 | |
| 92 | else | |
| 93 | button.toggleButton("Enderman")
| |
| 94 | rednet.broadcast("spawn 6 off")
| |
| 95 | button6 = 0 | |
| 96 | end | |
| 97 | end | |
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | fillTable() | |
| 103 | button.heading("Monster Spawner Controller")
| |
| 104 | button.label(1,4,"Sp.1") | |
| 105 | button.label(1,8,"Sp.2") | |
| 106 | button.label(1,12,"Sp.3") | |
| 107 | button.label(1,16,"Sp.4") | |
| 108 | button.label(1,20,"Sp.5") | |
| 109 | button.label(1,24,"Sp.6") | |
| 110 | while true do | |
| 111 | getClick() | |
| 112 | end |