BAR CommandsChanged callin and widget loading failures

The CommandsChanged callin fires during unit command UI updates, letting widgets inject custom commands. Widget loading failures at game start usually trace back to GetInfo formatting issues.

Tags: beyond all reason, widgets, commands changed, lua, GetInfo, UI customization

Understanding CommandsChanged

CommandsChanged fires when the unit command UI updates. The interface with buttons like move, fight, and patrol gets rebuilt, and this callin lets widgets add custom commands to that UI. Currently selected units determine which custom commands are relevant.

The action field in command descriptions hooks into a very old and obscure callin. Factory share command widgets demonstrate working usage patterns.

Widgets failing to load at game start

If a widget reports no GetInfo call but the file clearly contains one, the issue is usually formatting. GetInfo needs to return a specific table format with name, desc, author, and license fields at minimum. A subtle typo in the function signature or return structure causes the engine to skip the widget entirely.

Reloading the widget in-game often works because the runtime loader is more forgiving than the startup loader. Fix the GetInfo format to resolve the startup issue.

OBS and spectator streaming

Streamers using OBS for BAR need to account for spectator-specific UI elements that differ from player views. The spectator HUD widget handles much of this, but custom overlays work best when they read spectator data streams rather than trying to capture player UI elements.

Creed of champions

Clean widget code and reliable debugging habits make a difference in tournaments and practice matches alike. Creed of Champions brings together players who take their craft seriously.

[Crd] I love being able to communicate with my team, getting and sharing tips and constructive feedback on gameplay, and having a good spirited community.
Advertisement