Advertisement
Guest User

t

a guest
Jan 29th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1.  
  2. -- Simple MFSU monitor
  3.  
  4. local mon = peripheral.wrap("monitor_5")
  5. local gen = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_0")
  6. local cable = peripheral.wrap("back")
  7.  
  8. ringIt = false
  9. ringTime = 30
  10. ticks = 0
  11.  
  12. function UpdateData(stored, max)
  13. --  print(stored)
  14.  
  15.   if stored >= 40000000 then
  16.  
  17.  
  18.   rs.setBundledOutput("back", colors.red)
  19.  
  20.   rs.setBundledOutput("back", colors.gray)
  21.  
  22.   mon.setCursorPos(10,20)
  23.   mon.setTextColor(colors.red)
  24.   mon.write("Error, Starting alarm")
  25.    
  26.  
  27.   elseif stored <= 50000000 then
  28.   rs.setBundledOutput("back", 0)
  29.   rs.setBundledOutput("back", colors.green)
  30.   mon.setCursorPos(10,13)
  31.   mon.setTextColor(colors.white)
  32.   mon.write("Every thing is ok")
  33.   end
  34.  
  35. end
  36.  
  37. while true do
  38.   local stored = math.floor(gen.getEnergyStored())
  39.   local max = math.floor(gen.getMaxEnergyStored())
  40.   local percent = stored/max*100
  41.   mon.clear()
  42.   mon.setCursorPos(10,10)
  43.   mon.setTextScale(1.0)
  44.   mon.setBackgroundColor(colors.black)
  45.   mon.setTextColor(colors.lime)
  46.   mon.write(stored.." RF/t ")
  47.   mon.setCursorPos(10,11)
  48.   mon.setTextColor(colors.yellow)
  49.   mon.write("Energy is at ".. math.floor(percent).."%")
  50.   UpdateData(stored, max)  
  51.   sleep(3)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement