Skip to content
Void Monster Docs

Type to search guides and API reference.

    OBS Utils/Developer docs

    Interface: ObsUtilsApi

    Public 5.3.0API 5.3.0

    @faeyumbrea/obs-utils-api-types


    @faeyumbrea/obs-utils-api-types / ObsUtilsApi

    Defined in: api.d.ts:88

    Public compile-time contract for modules integrating with OBS Utils.

    directorTabs: Map<string, DirectorTabRegistration | DirectorTabSvelte5Registration>

    Defined in: api.d.ts:95


    obsRemoteEventTypes: Map<string, OBSRemoteEventTypeRegistration>

    Defined in: api.d.ts:93


    overlayTriggers: Map<string, OverlayTriggerRegistration>

    Defined in: api.d.ts:94


    overlayTypeNames: Map<string, string>

    Defined in: api.d.ts:90


    overlayTypes: Map<string, OverlayType>

    Defined in: api.d.ts:89


    singleInstanceOverlays: Set<Component>

    Defined in: api.d.ts:91


    singleInstanceOverlaysSvelte5: Set<(target) => () => void>

    Defined in: api.d.ts:92

    buildLegacyRollOverlayCanvas(config): OverlayData

    Defined in: api.d.ts:157

    Build a wysiwyg (canvas) overlay that emulates the 4.x roll overlay. Shared by the v4 migration (5.0 type: 'roll' entries) and the docs snippet that pulls the user’s legacy flat settings out of the world.

    The returned overlay is a 250×250 layer with tileBy: 'players', a core.onPlayerRoll transition out of the idle track, and the pre / roll / post phases chained through transition-on-end.

    Push the result into streamOverlays (or import it through the composer) — this helper is data-only and does not touch settings.

    LegacyRollOverlayConfig

    OverlayData


    fireOverlayTrigger(key, payload): void

    Defined in: api.d.ts:123

    Public — modules call this when their in-system event fires (e.g. a chat message is created, a roll is made). Dispatches via Foundry’s Hooks bus so any number of overlay renderers can react without tight coupling.

    string

    Record<string, any>

    void


    getDirectorState(): DirectorState

    Defined in: api.d.ts:115

    Public — snapshot of Director state (tracking modes, combat, focused user). Subscribe to obs-utils.director.stateChanged to react to changes; the hook payload is (next: DirectorState, prev: DirectorState | undefined).

    DirectorState


    getOBSWebsocketClient(): Promise<any> | undefined

    Defined in: api.d.ts:182

    Promise<any> | undefined


    getSelectedActors(): string[] | undefined

    Defined in: api.d.ts:165

    string[] | undefined


    isOBS(): boolean

    Defined in: api.d.ts:183

    boolean


    playPreset(preset): void

    Defined in: api.d.ts:193

    Public — play a camera preset on the OBS client. The DM that calls this claims active-GM control, swaps the current tracking mode to cloneDM, pauses their outgoing viewport stream, and broadcasts the preset so it runs locally on every OBS client. The DM’s own view does not move.

    For previewing a preset in the editor (no broadcast, no state changes), call playSequence directly from cameraSequencePlayer.

    CameraPreset

    void


    previewPreset(preset): SequenceController

    Defined in: api.d.ts:198

    Local-only preview play. Use this from the preset editor when scrubbing or auditioning — doesn’t touch tracking state and doesn’t broadcast.

    CameraPreset

    SequenceController


    registerDirectorTab(reg): void

    Defined in: api.d.ts:107

    Public — register a tab in the Director window.

    DirectorTabRegistration

    void

    A Svelte 5 component from another module fails to mount here (effect_orphan). Use registerDirectorTabSvelte5, which lets your module mount its own UI. Still fine for OBS Utils’ own (same-bundle) tabs.


    registerDirectorTabSvelte5(reg): void

    Defined in: api.d.ts:109

    Public — register a Director tab whose UI your module mounts itself (cross-bundle-safe).

    DirectorTabSvelte5Registration

    void


    registerOBSRemoteEventType(reg): void

    Defined in: api.d.ts:98

    Public — modules call this in their init hook to expose a new event type.

    OBSRemoteEventTypeRegistration

    void


    registerOverlayTrigger(reg): void

    Defined in: api.d.ts:100

    Public — modules call this to expose a new overlay trigger type.

    OverlayTriggerRegistration

    void


    registerOverlayType(key, readableName, type): void

    Defined in: api.d.ts:144

    Register a new overlay type. Surfaces in the Stream Composer’s “+ new” menu and elsewhere the type list is consumed.

    string

    Stable key written into OverlayData.type (e.g. ‘wysiwyg’).

    string

    i18n key for the display label. Resolved via game.i18n.localize() at render time. Pass a literal string only if you intentionally ship a single-locale module.

    OverlayType

    The OverlayType instance with the renderer and editor wired up.

    void


    registerStarterOverlays(overlays): void

    Defined in: api.d.ts:181

    Public — system modules call this in their init hook to register their own starter overlay set. The burger menu in the overlay editor imports whichever set is registered (or the generic default if none). Last writer wins.

    OverlayData[]

    void


    registerUniqueOverlay(overlay): void

    Defined in: api.d.ts:158

    Component

    void


    registerUniqueOverlaySvelte5(mount): void

    Defined in: api.d.ts:164

    Register a unique overlay rendered once on the stream, for Svelte 5 modules. Pass a mount callback that mounts your overlay into the given element with your own module’s Svelte mount() and returns a cleanup function — OBS Utils can’t mount a Svelte 5 component from another bundle itself (effect_orphan).

    (target) => () => void

    void


    setAVData(actorValueArray): void

    Defined in: api.d.ts:167

    ActorValues

    void


    setAVDataGrouped(groups): void

    Defined in: api.d.ts:174

    Public — system modules call this with a hierarchical layout. The picker UI renders groups in the dropdown. Group labels are i18n keys, localized at flatten time. Calling this replaces any previously-set AV data (grouped or flat) — last writer wins, same as setAVData.

    ActorValueGroup[]

    void


    setSelectedActors(actorArray): Promise<void>

    Defined in: api.d.ts:166

    string[]

    Promise<void>


    setTrackingMode(slot, mode): Promise<void>

    Defined in: api.d.ts:117

    Public — set one of the tracking-mode slots. Mirrors the Controls tab UI.

    "inCombat" | "outOfCombat"

    string

    Promise<void>


    triggerOBSRemoteEvent(key, context?): Promise<void>

    Defined in: api.d.ts:133

    Public — modules call this when their in-system condition fires (e.g. on updateActor with system.attributes.hp.value changed). Looks up every configured instance for the type, runs the matcher, and executes the configured OBS actions for instances that pass.

    Safe to call from any client; the actual OBS action execution is already gated to the OBS-mode client by triggerOBSAction.

    string

    Record<string, any>

    Promise<void>