Skip to content

HUD Overlay

The HUD script belongs to the whole module: open it from the “HUD overlay” button in the module editor header (next to “Init Code”). It takes no logic slot and no trigger key; while the game is connected the client runs it every 50 ms and it only draws — declare nodes in Hud.Init and any logic script can update them with Hud.*; it cannot send keys or Sleep. The HUD is a transparent, always-on-top, click-through window over the game client area, shown only while the game is in the foreground (Settings has “Always show while debugging”). Exclusive fullscreen hides it; use borderless or windowed mode.

Coordinates are virtual units: the client area is always 1080 tall and the width scales. anchor picks one of nine points on the parent (default: the whole client area); x/y offset from it. Declaring the same id again only updates it; put one-time declarations inside Hud.Init. The HUD is vector-drawn: it stays sharp at any game window size and at any “HUD scale” setting (50%–200%).

Function Purpose
Hud.Init(fn) Runs fn once; put node declarations here. The engine is rebuilt only when the module content changes (saving an edited module) and inherits which nodes were visible, so re-declaring the same nodes replays no enter transition or sound.
Hud.Frame / Text / Bar / Icon(id, spec) Create or update a frame / text / bar / icon. spec may contain anchor x y w h parent z hidden alpha color bg border borderw radius text size bold align shadow value dir spark texture icon rotation mirror glow sound exitsound smooth enter exit loop.
Hud.Texture / Ring / Sprite(id, spec) Textures (the built-in WeakAuras library; white masks are tinted by color and take rotation / mirror), ring / pie progress (thick from to ccw inverse) and stop-motion sprites (texture rows cols frames fps mode).
Hud.Sound(name) / Hud.StopSound() / Hud.Countdown(id, s) Play / stop a built-in sound (a table { name, volume, loop, every } is accepted; stopping can fade out); a node’s sound / exitsound play automatically when it is shown / hidden. Hud.Countdown is a BigWigs-style countdown voice: pass the seconds remaining every tick and it speaks 5…1 once each (voice Jim / David / Amy).
Hud.Set(id, key, value) Change one property; pass a table to change several at once. On a node with smooth = ms, number and color changes glide to the target with a critically damped spring (settles in about that many ms, stays smooth even when the script retargets every tick).
Hud.Animate(id, {k = v}, ms, ease) Tween position, size, opacity, progress, font size, rotation or color to target values (default 300 ms, outCubic).
Hud.Show(id, bool)
Hud.Remove(id) / Hud.Clear()
Show or hide, remove (with children), clear everything. Transitions and sounds are settled once at the end of each script run from the net change: a node created and hidden in the same run never appears or plays, and hide-then-show within one run is a no-op.
Hud.Flash(id, color, ms) One-shot highlight (default white, 400 ms).
Hud.Loop(id, spec) Set or clear a continuous animation (same as the loop key): breathe, blink, bounce, float, shake, beat; no argument means breathe, false clears.
Hud.Pulse(id, on) / Hud.Blink(id, on, ms) Legacy on/off toggles for breathing / blinking; prefer the declarative loop key.
Hud.Screen() / Hud.Visible() Virtual size of the client area / whether the overlay is currently shown.

Example: a health bar, a combat label and an icon. Property names must match the property table (the built-in 生命百分比 and 战斗中 here):

-- 模块 HUD 脚本:不绑键,每 50 毫秒运行一次;只负责显示,不能发键或 Sleep。逻辑脚本可用 Hud.* 更新这里声明的节点
Hud.Init(function()
Hud.Bar("hp", { anchor = "TOP", y = 140, w = 360, h = 22, color = "#2ecc71", bg = "#00000099", radius = 6, smooth = 150 })
Hud.Text("hpText", { parent = "hp", anchor = "CENTER", size = 16, color = "#ffffff", bold = true })
Hud.Text("combat", { anchor = "TOP", y = 100, size = 28, color = "#ff4d4d", bold = true, text = "战斗中", hidden = true, enter = "pop", exit = "fade", loop = "breathe" })
Hud.Icon("power", { anchor = "TOPRIGHT", x = -40, y = 140, w = 28, h = 28, icon = "zap", color = "#3fa9f5" })
end)
local hp = Prop("生命百分比") -- 0~1
Hud.Set("hp", "value", hp)
Hud.Set("hpText", "text", string.format("%d%%", math.floor(hp * 100)))
Hud.Set("hp", "color", hp < 0.3 and "#e74c3c" or "#2ecc71")
if hp < 0.3 and CoolDown("hud.lowhp", 1000) then Hud.Flash("hp", "#ffffff", 400) end
local fighting = Prop("战斗中") > 0
Hud.Show("combat", fighting)

Colors are #RRGGBB or #RRGGBBAA; string.format("%d") needs an integer, so math.floor fractions first. Three consecutive script errors disable the HUD; fix and save to re-enable. Limits: 200 nodes, 256-character text.

Transitions: give enter / exit a preset — fade, slideLeft, slideRight, slideUp, slideDown, zoom, pop — or a table such as { kind = "slide", dir = "left", dist = 80, ms = 250, ease = "outBack" }; they play automatically when the node is shown or hidden, and zoom carries the children along. Give bars smooth = 150 and they stop stepping with the 50 ms script cadence. Continuous animation goes in loop: breathe, blink, bounce, float, shake, beat (scales the children along), or a table such as { kind = "bounce", dist = 12, ms = 800 }; it runs while the node is visible and stops when hidden. Easings: linear, inQuad, outQuad, inOutQuad, inCubic, outCubic, inOutCubic, outBack, outElastic, outBounce. The renderer evaluates every animation per frame and draws nothing while nothing moves.

Textures and sounds: 201 textures ported from WeakAuras and BigWigs (shapes, rings, gradients, bar textures including BigWigs’ Smooth / Glaze / Charcoal, beams and the PowerAuras auras / glyphs / words) and 175 sounds (alerts, animals, “Voice:” call-outs, the BigWigs Amy / David / Jim countdown voices and full countdown tracks) are built in; names are listed in the AI specification and in the editor dropdowns. Hud.Texture draws a texture (masks are tinted by color and can be rotated / mirrored / desaturated; loop = "spin" keeps it turning); give a bar texture = "Statusbar_Stripes" for a textured fill and spark for a spark; Hud.Ring is a vector ring / pie progress (start / end angle, counter-clockwise, inverse for cooldown countdowns); Hud.Sprite plays the stopmotion sheet as a stop-motion animation (loop / bounce / once / by progress). Add shadow to text for readability and glow to any sized node for a pixel glow. A node’s sound plays when it is shown and exitsound when hidden (hiding stops a looping sound); Hud.Sound / Hud.StopSound give explicit control and Hud.Countdown(id, seconds_left, { voice = "Jim" }) speaks a countdown (each whole second once, no repeat on a timer reset); the Settings HUD card can mute sounds or set the volume; node sounds are muted while the visual editor is open — only its Preview button plays.

Visual editing: the HUD script editor has Code and Visual tabs. The Visual tab is a simulated canvas scaled to the game client area (it shares the layout and drawing code with the real overlay, so proportions match): add frames / text / bars / icons / textures / rings / stop-motion sprites, drag to move, resize with the corner handle, nudge with the arrow keys, and edit anchor, size, font, colors, text, texture (with thumbnails), rotation, ring and sprite parameters, sounds (with preview) and enter / exit / loop animations in the side panel. Changes are written back into the literal values in your code and previewed live; properties written as expressions stay code-only. A new HUD script starts empty — begin with Add.