GetPlayerNetworkLatency(object, int)

From NWN Lexicon
Jump to navigationJump to search
Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Returns the network latency of this player device.

int GetPlayerNetworkLatency(
    object oPlayer,
    int bSmoothed = TRUE
);

Parameters

oPlayer
The player who you want to check the latency of.
bSmoothed
If TRUE it provides an average over a longer timeframe, else returns the current value, see Description. (default: TRUE)


Description

Returns the network latency of this player device.

The value is a round trip time (server->player->server) in milliseconds.

  • Players are pinged every 6000 milliseconds.
  • When bSmoothed is TRUE, returns a moving average over a longer timeframe. This average calculation is not strictly specified and subject to change, but intended to provide a reasonable average to rely on.
  • When bSmoothed is FALSE, returns the current/last received value.
  • Returns 0 if the client failed to respond to latency requests or no data is available. This is currently the case for clients that do not support this functionality (build <37).


Remarks

Mostly useful for those in server environments if you want to cater for potentially laggy clients.


Version

This function was added in 1.89.8193.37 of NWN:EE.

Example

See Also

functions:

GetPlayerDeviceProperty