Advertisement
SirBaconBitz

Untitled

Apr 22nd, 2015
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. --Original Code made by Jacen Caedus on 4/19/2015
  2. --Button API made by Direwolf20 on 1/09/2015
  3. os.loadAPI("button")--load button api
  4.  
  5. m = peripheral.wrap("top")--find monitor peripheral
  6. xSize, ySize = m.getSize()--get size of the monitor
  7. xMin= (xSize/2)-4--the leftmost point of each button
  8. xMax = xMin + 10
  9. spawners = {["zombie"] = false, ["wither"] = false, ["blaze"] = false}--store the states of each spawner
  10. buttons = 3--number of buttons there are
  11. joe = false--whether or not killer joe is on
  12.  
  13. function test(table)
  14.   print(spawners[table])
  15. end
  16.  
  17. function Spawner(table)
  18.   spawners[table] = not spawners[table]--toggle the spawner
  19.   Joe()
  20.  
  21.   if table == "zombie" then
  22.     button.toggleButton("Zombie")--toggle the button
  23.   end
  24.   if table == "wither" then
  25.     button.toggleButton("Wither")
  26.   end
  27.   test(table)
  28. --  test()
  29. end
  30.  
  31. function Menu()
  32.   button.clearTable()
  33.   button.setTable("Zombie", Spawner, "zombie", xMin, xMax, math.floor(ySize/buttons), math.floor(ySize/buttons))
  34. --  button.setTable("Wither", Spawner, "wither", xMiddle, xMiddle+10, ySize/(buttons-1), (ySize/(buttons-1))+3)
  35.   button.screen()
  36. end
  37.  
  38. function Joe()
  39.   local spawnerOn = false
  40.   for i=1, #spawners do
  41.     if spawners[i] == true then
  42.       spawnerOn = true
  43.     end
  44.   end
  45.   if spawnerOn then
  46.     joe = true
  47.   end
  48. end
  49.  
  50. m.clear()
  51. m.setTextScale(1)
  52. Menu()
  53. while true do
  54.   local event, side, x, y
  55.   event, side, x, y = os.pullEvent("monitor_touch")
  56.   button.checkxy(x,y)
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement