OnPlayerWebReady
A frame of a player’s web interface has loaded its page and is listening.
The page has called KcdMp.ready() - the page’s script does it by itself once the document has loaded, unless the page
asked to do it by hand. From now on it receives what the mode sends it without any waiting; what was sent earlier
was kept for it and has just been handed over. The callback runs again each time the frame’s page loads anew (a
frame made again, an interface that changed and was re-read), each time a hidden frame that was ready is shown again
with ShowPlayerWebFrame (its page is the same one, and so is everything it kept), and after a
reload once for every frame that is ready. Hiding a frame and showing it again from inside this
callback would run it again, so a mode that does that loops - the server counts such reports and stops passing them on
past a few a second.
A player’s game says this for itself: a modified game may say it for a frame that is not ready or never say it. Use it to send a page its first data, not to prove anything about the player.
Syntax
Section titled “Syntax”function OnPlayerWebReady(pid, frame) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
frame |
string | the frame’s name, as ui.toml gives it |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”function OnPlayerWebReady(pid, frame) if frame == "scoreboard" then SendPlayerWebMessage(pid, "scoreboard", { title = "Kuttenberg Arena", round = round }) endendSee also
Section titled “See also”IsPlayerWebFrameReady · OnPlayerWebStatus · SendPlayerWebMessage · ShowPlayerWebFrame · the Web interface group of the index
