Illprotectjew

spawn control

Nov 16th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("button")
  2. m = peripheral.wrap("top")
  3. m.clear()
  4. rednet.open("back")
  5. button1 = 0
  6. button2 = 0
  7. button3 = 0
  8. button4 = 0
  9. button5 = 0
  10. button6 = 0
  11.  
  12. function fillTable()
  13.    button.setTable("Cows", spawn1on, 6,19,3,5)
  14.    button.setTable("Sheep", spawn2on, 6,19,7,9)
  15.    button.setTable("Zombies", spawn3on, 6,19,11,13)
  16.    button.setTable("Creepers", spawn4on, 6,19,15,17)
  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. function spawn1on()
  28.   if button1 == 0 then
  29.     button.toggleButton("Cows")
  30.      rednet.broadcast("spawn 1 on")
  31.         button1 = 1
  32.     else
  33.      button.toggleButton("Cows")
  34.      rednet.broadcast("spawn 1 off")
  35.         button1 = 0
  36. end
  37. end
  38.  
  39. function spawn2on()
  40.  if button2 == 0 then
  41.    button.toggleButton("Sheep")
  42.    rednet.broadcast("spawn 2 on")
  43.     button2 = 1
  44.     else
  45.    button.toggleButton("Sheep")
  46.    rednet.broadcast("spawn 2 off")
  47. button2 = 0
  48. end
  49. end
  50.  
  51. function spawn3on()
  52. if button3 == 0 then
  53.    button.toggleButton("Zombies")
  54.    rednet.broadcast("spawn 3 on")
  55.     button3 = 1
  56.     else
  57.    button.toggleButton("Zombies")
  58.    rednet.broadcast("spawn 3 off")
  59. button3 = 0
  60. end
  61. end
  62.  
  63. function spawn4on()
  64. if button4 == 0 then
  65.    button.toggleButton("Creepers")
  66.    rednet.broadcast("spawn 4 on")
  67. button4 = 1
  68.     else
  69.    button.toggleButton("Creepers")
  70.    rednet.broadcast("spawn 4 off")
  71. button4 = 0
  72. end
  73. end
  74.  
  75. function spawn5on()
  76. if button5 == 0 then
  77.    button.toggleButton("Skeletons")
  78.    rednet.broadcast("spawn 5 on")
  79. button5 = 1
  80.     else
  81.    button.toggleButton("Skeletons")
  82.    rednet.broadcast("spawn 5 off")
  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
Advertisement
Add Comment
Please, Sign In to add comment