Advertisement
TJtheDJ701

Untitled

Sep 27th, 2021
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. cube = peripheral.wrap("left")
  2.  
  3. energy = cube.getEnergy()
  4.  
  5. term.clear()
  6.  
  7. local printcentred =
  8. function(text)
  9. local maxw, maxh = term.getSize() --screen dimensions
  10. local curx, cury = term.getCursorPos() --cursor pos
  11. term.setCursorPos((maxw-#text)/2,cury) --set it to the point where write will make the text centred
  12. term.write(text) --write the text
  13. term.setCursorPos(curx,cury+1) --return the cursor to the same position on the next line
  14. end
  15. local maxw, maxh = term.getSize() --screen dimensions
  16. term.setCursorPos(1,math.floor(maxh/2))--set cursor to the start of the upper middle line
  17. printcentred("urrent Power Levels:")--print centred on that line
  18. printcentred(energy .. " RF")--print centred on the next line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement