DMeville

Untitled

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