Status
Widgets update when their bound variables change.
Lua declares safe gauge and status definitions. PlayMUD.online owns their HTML, validates every binding, and renders them without exposing the browser DOM to scripts.
Gauge
function ensureHealthGauge()
gauge.create("health", {
label = "HP",
value = "state.hp",
maximum = "state.maxhp",
thresholds = {
red = 30,
yellow = 65,
redColor = "#e66a61",
yellowColor = "#d8b45d",
greenColor = "#69c27d",
},
location = {
zone = "top",
order = 10,
width = 4,
},
})
end
Put this helper in Scripts, then call it from a Lua trigger or Lua alias when you want the gauge created.
Thresholds compare the current percentage against red and yellow. Values above yellow use the green color. A width of 4 uses one third of a top or bottom row, so HP, SP, and EP can sit beside each other with ordering such as 10, 20, and 30.
Status Value
function ensureTargetStatus()
status.create("target", {
label = "Target",
value = "variables.target",
color = "#d8b45d",
location = "status",
})
end
Bindings may use state.name, variables.name, or an unqualified name. Unqualified bindings check temporary state first.
Location
Available zones are top, bottom, left, right, and status. The script supplies defaults. Location, order, and width changed in the Status tab are stored as a per-server user override. Mobile uses the same widget definitions and its own saved placement overrides.
Removing Widgets
gauge.remove("health")
status.remove("target")
Widgets created by Lua triggers or Lua aliases are owned by that trigger or alias. Disabling the responsible automation removes its widgets.