P

PlayMUD.online

Status Widgets

Status

Widgets update when their bound data changes.

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 = "gmcp.Char.Vitals.hp",
    maximum = "gmcp.Char.Vitals.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 onLoad(), a Lua trigger, or a Lua alias when you want the gauge created. Gauges do not poll; they repaint when GMCP, BatClient data, Lua state, or persistent Variables change.

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.

Gauge Builder

The Status tab includes a builder for gauges and status values. Pick a type, ID, label, value binding, color, location, order, width, and gauge thresholds when relevant, then click Create.

PlayMUD.online stores generated widgets in one enabled Script named Generated Status Widgets. The script is regular automation: you can open it in Automation, edit the generated OnLoad() definitions, move it to a folder, disable it, or delete it later. The builder suggests live scalar paths from state, variables, gmcp, and batclient.

Status Value

function ensureTargetStatus()
  status.create("target", {
    label = "Target",
    value = "variables.target",
    color = "#d8b45d",
    location = "status",
  })
end

Bindings may use state.name, variables.name, gmcp.Char.Vitals.hp, or batclient.vitals.hp. Unqualified bindings check temporary state first. Structured GMCP and BatClient bindings are read-only and must point at a scalar value, not a whole table.

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 Script lifecycle hooks, Lua triggers, or Lua aliases are owned by that Script, trigger, or alias. Disabling the responsible automation removes its widgets.