Advertisement
DustinRosebery

Spawner Touchscreen

Nov 15th, 2014
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.24 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("top")
  3. m.clear()
  4.  
  5. function fillTable()
  6.    button.setTable("Cows On", spawn1on, 6,19,3,5)
  7.    button.setTable("Cows Off", spawn1off, 21,34,3,5)
  8.    button.setTable("Sheep On", spawn2on, 6,19,7,9)
  9.    button.setTable("Sheep Off", spawn2off, 21,34,7,9)
  10.    button.setTable("Zombies On", spawn3on, 6,19,11,13)
  11.    button.setTable("Zombies Off", spawn3off, 21,34,11,13)
  12.    button.setTable("Creepers On", spawn4on, 6,19,15,17)
  13.    button.setTable("Creepers Off", spawn4off, 21,34,15,17)
  14.    button.setTable("Skeletons On", spawn5on, 6,19,19,21)
  15.    button.setTable("Skeletons Off", spawn5off, 21,34,19,21)
  16.    button.setTable("Enderman On", spawn6on, 6,19,23,25)
  17.    button.setTable("Enderman Off", spawn6off, 21,34,23,25)
  18.    button.screen()
  19. end
  20.  
  21. function getClick()
  22.    event,side,x,y = os.pullEvent("monitor_touch")
  23.    button.checkxy(x,y)
  24. end
  25.  
  26. function spawn1on()
  27.    button.flash("Cows On")
  28.    rednet.broadcast("spawn 1 on")
  29. end
  30.  
  31. function spawn1off()
  32.    button.flash("Cows Off")
  33.    rednet.broadcast("spawn 1 off")
  34. end
  35.  
  36. function spawn2on()
  37.    button.flash("Sheep On")
  38.    rednet.broadcast("spawn 2 on")
  39. end
  40.  
  41. function spawn2off()
  42.    button.flash("Sheep Off")
  43.    rednet.broadcast("spawn 2 off")
  44. end
  45.  
  46. function spawn3on()
  47.    button.flash("Zombies On")
  48.    rednet.broadcast("spawn 3 on")
  49. end
  50.  
  51. function spawn3off()
  52.    button.flash("Zombies Off")
  53.    rednet.broadcast("spawn 3 off")
  54. end
  55.  
  56. function spawn4on()
  57.    button.flash("Creepers On")
  58.    rednet.broadcast("spawn 4 on")
  59. end
  60.  
  61. function spawn4off()
  62.    button.flash("Creepers Off")
  63.    rednet.broadcast("spawn 4 off")
  64. end
  65.  
  66. function spawn5on()
  67.    button.flash("Skeletons On")
  68.    rednet.broadcast("spawn 5 on")
  69. end
  70.  
  71. function spawn5off()
  72.    button.flash("Skeletons Off")
  73.    rednet.broadcast("spawn 5 off")
  74. end
  75.  
  76. function spawn6on()
  77.    button.flash("Enderman On")
  78.    rednet.broadcast("spawn 6 on")
  79. end
  80.  
  81. function spawn6off()
  82.    button.flash("Enderman Off")
  83.    rednet.broadcast("spawn 6 off")
  84. end
  85.  
  86.  
  87.  
  88.  
  89. fillTable()
  90. button.heading("Monster Spawner Controller")
  91. button.label(1,4,"Sp.1")
  92. button.label(1,8,"Sp.2")
  93. button.label(1,12,"Sp.3")
  94. button.label(1,16,"Sp.4")
  95. button.label(1,20,"Sp.5")
  96. button.label(1,24,"Sp.6")
  97. while true do
  98.    getClick()
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement