osmarks

SCTPS

Aug 13th, 2018
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local c = peripheral.wrap "back".canvas()
  2. local w,h = c.getSize()
  3. local out = c.addText({9, h - 16}, "NO TPS")
  4.  
  5. while true do
  6.     local game_time_start = os.epoch "utc"
  7.     sleep(1)
  8.     local game_time_end = os.epoch "utc"
  9.     local utc_elapsed_seconds = (game_time_end - game_time_start) / 1000
  10.     _G.tps = 20 / utc_elapsed_seconds
  11.     out.setText(string.format("TPS: %.2f", tps))
  12.     local c
  13.     if tps > 19 then c = 0x00FF00FF
  14.     elseif tps > 15 then c = 0xFFFF00FF
  15.     elseif tps > 10 then c = 0xFF8800FF
  16.     else c = 0xFF0000FF end
  17.     out.setColor(c)
  18.    
  19.     sleep(1)
  20. end
Add Comment
Please, Sign In to add comment