HUD¶
hud.add('beds', 'Bed Alert', function () {
return ['§bbeds §f' + count, '§7closest §f' + nearest + 'm'];
});
That is the whole API. Position, anchoring, the backing panel, the fade, drag-and-drop placement in /fkdr hud and saving all come from fkdr.
- Return an array of lines, a single string, or nothing. Nothing (or an empty array) means "no readout right now" and the element fades out. That is how it should behave in a lobby.
- The supplier is called once per frame. Compute on
tick, keep the lines, and only return them here. - Ids are namespaced with your script's name, so two scripts can both use
'main'. hud.remove('beds'),hud.list().- Everything a script registers is removed when it reloads or unloads.
var lines = [];
function onTick() {
var t = fkdr.threat.lobby();
lines = t < 0 ? [] : ['§bthreat §f' + t, '§7' + fkdr.threat.describe(t)];
}
function onLoad() {
hud.add('main', 'Lobby threat', function () { return lines; });
}
See the HUD editor guide for how users place and style elements.