DMeville

Untitled

Jul 8th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. foundMonitor = false
  2. mw, mh = 0
  3. spawners = {}
  4. spawners[0] = false
  5. spawners[1] = true
  6. red = 16384
  7. green = 32
  8. scale = 2
  9.  
  10. mobs {"BLAZE", "MOB2"}
  11. function drawBox(x,y,w,h,c, label)
  12.     x = x/scale
  13.     y = y/scale
  14.     w = w/scale
  15.     h = h/scale
  16.    
  17.         i = x
  18.     _w = w + x
  19.     _h = h+y
  20.     while i < _w do
  21.     j = y
  22.         while j < _h do
  23.             paintutils.drawPixel(i,j,c)
  24.             j = j+1
  25.         end
  26.     i = i+1
  27.     end
  28.     mon.setCursorPos(x - w/2, y -h/2)
  29.     mon.write(label)
  30. end
  31. function drawGUI()
  32.     mon.setCursorPos(1,1)
  33.     if spawners[0] == false then
  34.         drawBox(4,scale*2,mw-4,6, red, mobs[0]..": OFF")
  35.     else
  36.         drawBox(4,scale*2,mw-4,6, green, mobs[0]..": ON")
  37.     end
  38.  
  39.     if spawners[1] == false then
  40.         drawBox(4,mh-scale*2,mw-4,6, red, mobs[1]..": OFF")
  41.     else
  42.         drawBox(4,mh-scale*2,mw-4,6, green, mobs[1]..": ON")
  43.     end
  44.  
  45. end
  46. function update()
  47. if spawners[0] == true then spawners[0] = false
  48. else spawners[0] = true
  49. end
  50.  
  51. function init()
  52. if peripheral.isPresent("bottom") then 
  53.     mon = peripheral.wrap("bottom")
  54.     mw, mh = mon.getSize()
  55.     mon.setBackgroundColor(1)
  56.     mon.setTextScale(scale)
  57.     mon.clear()
  58.     term.redirect(mon)
  59.     foundMonitor = true
  60. else
  61.     foundMonitor = false
  62.     print("Monitor not found - Aborting")
  63. end
  64. if foundMonitor == true then
  65.     while true do
  66.         update()
  67.         drawGUI()
  68.         sleep(1)
  69.     end
  70.     term.restore()
  71. end
  72. end
  73.  
  74. init()
Advertisement
Add Comment
Please, Sign In to add comment