Advertisement
jakendrick3

02 Check

Feb 12th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. mon = peripheral.find("monitor")
  2. monX, monY = mon.getSize()
  3. mon.setTextScale(1)
  4.  
  5. if mon.isColor() then
  6.   colorPos = colors.green
  7.   colorNeg = colors.red
  8. else
  9.   colorPos = colors.white
  10.   colorNeg = colors.white
  11. end
  12.  
  13. SENSORDIR = "back"
  14.  
  15. while true do
  16.   mon.setBackgroundColor(colors.black)
  17.   mon.clear()
  18.  
  19.   o2pos = redstone.getInput(SENSORDIR)
  20.  
  21.   function get02()
  22.     if o2pos then
  23.       text = "%POS%"
  24.       mon.setBackgroundColor(colorPos)
  25.       redstone.setOutput("bottom", true)
  26.     else
  27.       text = "*NEG*"
  28.       mon.setBackgroundColor(colorNeg)
  29.       redstone.setOutput("bottom", false)
  30.     end
  31.   end
  32.  
  33.   get02()
  34.  
  35.   posX = math.ceil((monX / 2) - (#text / 2)) + 1
  36.   posY = monY / 2 + 1
  37.  
  38.   mon.setBackgroundColor(colors.blue)
  39.   mon.setCursorPos(monX / 2, monY / 2 - 1)
  40.   mon.write("02:")
  41.  
  42.   get02()
  43.  
  44.   mon.setCursorPos(posX, posY)
  45.   mon.write(text)
  46.  
  47.   time = os.startTimer(2)
  48.   event = os.pullEvent()
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement