ScriptingHUD¶
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 /bitchos hud and persistence in hud.json all come from the host.
- 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
tickand format here;lobby-threat.jsshows the pattern. - 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 = bitchos.threat.lobby();
lines = t < 0 ? [] : ['§bthreat §f' + t, '§7' + bitchos.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.