Skip to content

SetPlayerInterface

Says who draws a component of one player’s screen - "native" or "hidden".

"native" is KCD:MP’s own piece, "hidden" draws nothing and its keys stop working (a hidden scoreboard still takes Tab); the words are read in any case. The component’s own logic keeps running behind a hidden drawer - hide the chat and its lines are still kept, hide the scoreboard and the roster is still known - and choosing "native" again shows it as it was. What hidden does to each component is in Change the interface.

For one player, "native" also overrides a "hidden" made for everyone with SetInterfaceForAll. There is no “as everyone has it” for a drawer: say "native" or "hidden".

The party drawer is the party frames: "hidden" is ShowPartyFrames with false, "native" with true, and the two calls read each other - GetPlayerInterface too.

The chat, the scoreboard, the hudtext (the mode’s HUD texts and its GameText), the sleep fade, the notices, the death screen, the party frames, the voice indicator, the emotes wheel, the shop (a mode’s list panel) and the dialogs (a mode’s dialogue page, the game’s own questions) have two more drawers, both drawn by the game’s web layer: "default" - KCD:MP’s own web version of the component, which the interface’s theme styles ([theme] in its ui.toml) - and the name of a frame of the mode’s interface ([frames.<name>] in its ui.toml), which then draws the component itself: it gets the component’s lines, roster, texts or notices and its keys, and calls its actions (the component’s contract: chat@1, scoreboard@1, hudtext@1, sleep@1, notices@1, death@1, party@1, voice@1, emotes@1, shop@1, dialog@1). A frame draws one component at a time. The party’s web drawer comes with its frames shown: "hidden" (or ShowPartyFrames with false) still switches them off, and showing them again brings the web drawer back. A player whose game cannot draw the web drawer - the web layer is off or failed, the page is not ready yet, its renderer stopped - gets the native piece meanwhile, and the web drawer the moment it can draw again; GetPlayerInterface’s second word says which one draws. The interface’s own [components.<name>] drawer and options are what a player has when the mode set nothing for them or for everyone.

The loading screen has a web version too (loading@1), but its drawer is the interface’s ui.toml alone - [components.loading] drawer is "default" or a frame’s name, and without the section a frame called loading draws it: it shows while the level loads, before anything the mode sends reaches the player’s game, so this call refuses it.

When it cannot be done the second value says why: "not connected", "unknown component 'x'", "the shop cannot be hidden" (a component that has no hidden drawer: death, dialog, loading, shop, voice, hud) or, for a word that is not a drawer of that component, what is wrong with it. The web drawers’ reasons: "the compass has no web version yet" (a component without one), "the loading screen's drawer is set in the interface's ui.toml ([components.loading])", "no interface is loaded" (a frame’s name while the mode has no interface), "no such frame in the interface", "the frame chat already draws the scoreboard".

SetPlayerInterface(pid, component, drawer)
Parameter Type
pid number the player
component string "chat", "scoreboard", "notices", "party", "emotes", "hudtext", "sleep", "nameplates", "compass" - or one of the six that only draw natively
drawer string "native" or "hidden" - or, for the components with a web version (the chat, the scoreboard, the hudtext, the sleep fade, the notices, the death screen, the party frames, the voice indicator, the emotes wheel, the shop and the dialogs), "default" or the name of a frame of the interface

true, or false, reason - the reason as a person reads it ("the shop cannot be hidden", "unknown component 'x'", "not connected" …)

-- a cutscene: no name plates, notices or compass blips on the player's screen while it plays
local QUIET = { "nameplates", "notices", "compass" }
function startCutscene(pid)
for _, component in ipairs(QUIET) do SetPlayerInterface(pid, component, "hidden") end
end
function endCutscene(pid)
for _, component in ipairs(QUIET) do SetPlayerInterface(pid, component, "native") end
end

GetPlayerInterface · SetInterfaceForAll · SetPlayerInterfaceOptions · ShowPartyFrames · the Interface group of the index