Triacontakai

coreMonitor

Jan 16th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local p = peripheral.wrap("draconic_rf_storage_2")
  2. local m = peripheral.wrap("right")
  3. local t = p.getMaxEnergyStored()
  4. local e_pre = 0
  5.  
  6. --functions
  7. function getPercent(x,y)
  8.    return x * 100 / y
  9. end
  10.  
  11. function newLine(n)
  12.    pos = {m.getCursorPos()}
  13.    m.setCursorPos(1,pos[2]+n)
  14. end
  15.  
  16. function clrScr()
  17.    m.clear()
  18.    m.setCursorPos(1,1)
  19. end
  20.  
  21. --main program
  22. while true do
  23.    local e = p.getEnergyStored()
  24.    clrScr()
  25.    m.write("Energy in core: "..e.."/"..t)
  26.    newLine(1)
  27.    m.write("Percentage: "..getPercent(e,t).."%")
  28.    newLine(2)
  29.    m.write("RF/tick: "..e-e_pre)
  30.    e_pre = e
  31.    sleep(0.05)
  32. end
Add Comment
Please, Sign In to add comment