Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
Ping Monitor #93
This only works if you client can already read the ping. if you see Ping: ?? then it won't work.
This monitors your ping every x seconds to look for spikes in ping.
I had used this for looking for lag spikes on servers.
Export Pings button, prints all pings and times to terminal window.
1.73kb | 61 lines.
 -- Edit these values
minPing = 100        -- logs pings over this amount
clearPingList = 500  -- clears list after 500 entries set to 0 to disable
 -- Edit these values

pingLst = {}
local pingPanel = nil
local pingLabel = nil
local uia = modules.game_stats.ui
pingPanel = uia:getChildById("pingPanel")
pingPanel = pingPanel or setupUI([[
  id: pingPanel
  height: 17
  anchor-bottom: parent.bottom
  anchor-left: parent.left
  anchor-right: parent.right
    id: pingLabel
    color: green
    background-color: #494949
    font: verdana-11px-rounded
    id: pingLabel
    text-auto-resize: true
    text: Ping Max: 0 ms (#0)
]], uia)

pingLabel = pingPanel.pingLabel
if pingLabel then
    local ping =  g_game.getPing()
    macro(500, 'Ping Monitor', function()
      if clearPingList > 0 and #pingLst > clearPingList then
        pingLst = {}
      ping = g_game.getPing()
      if g_proxy and g_proxy.getPing() > 0 then
          ping = g_proxy.getPing()
      if ping > minPing then
        table.insert(pingLst, {time = os.time(), ping = ping})
        table.sort(pingLst, function(a, b) return < end)
      local color
      if ping >= 500 then
          color = 'red'
      elseif ping >= 250 or ping < 0 then
          color = 'yellow'
          color = 'green'
      pingLabel:setText("Ping Max: "..pingLst[#pingLst].ping.." ms (#"..(#pingLst)..')')
    end, leftPanel)
  table.insert(pingLst, {time = os.time(), ping = ping})

UI.Button("Export Pings", function()
  for i, ping in ipairs(pingLst) do
    print('%d-%m-%Y %H:%M:%S',ping.time) .. ' - '..

08 May 2022