Guest User

Untitled

a guest
Jul 8th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. foundMonitor = false
  2. mw, mh = 0
  3. spawners = {}
  4. spawners[0] = false
  5. spawners[1] = true
  6. red = 16384
  7. green = 32
  8. function drawBox(x,y,w,h,c)
  9.     i, j = 0;
  10.     for i = x, w do
  11.         for j = y, h do
  12.             paintutils.drawPixel(i,j,c)
  13.         end
  14.     end
  15. end
  16. function drawGUI()
  17.     if spawners[0] == true then
  18.         drawBox(mw - mw/2, mh - mh/w, 5,2, green)
  19.     else
  20.         drawBox(mw - mw/2, mh - mh/w, 5,2, red)
  21.     end
  22.     if spawners[1] == true then
  23.         drawBox(mw - mw/2, mh + mh/w, 5,2, green)
  24.     else
  25.         drawBox(mw - mw/2, mh + mh/w, 5,2, red)
  26.     end
  27. end
  28. function init()
  29. if peripheral.isPresent("top") then
  30.     mon = peripheral.wrap("top")
  31.     mw, mh = mon.getSize()
  32.     foundMonitor = true
  33. else
  34.     foundMonitor = false
  35.     print("Monitor not found - Aborting")
  36. end
  37. if foundMonitor == true then
  38.     while true do
  39.         term.redirect(mon)
  40.         mon.clear()
  41.         update()
  42.         drawGUI()
  43.         term.restore()
  44.         sleep(1)
  45.     end
  46. end
  47. end
  48.  
  49. init()
Advertisement
Add Comment
Please, Sign In to add comment