Skip to content
Void Monster Docs

Type to search guides and API reference.

    OBS Utils/Developer docs

    Class: ObsUtilsApi

    Early access 5.4.1API 1.1.0-ea.5.4.1

    @faeyumbrea/obs-utils-api-types


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

    Defined in: public-api.d.ts:351

    new ObsUtilsApi(): ObsUtilsApi

    Defined in: public-api.d.ts:359

    ObsUtilsApi

    directorTabs: Map<string, DirectorTabRegistration | DirectorTabSvelte5Registration>

    Defined in: public-api.d.ts:358


    obsRemoteEventTypes: Map<string, OBSRemoteEventTypeRegistration>

    Defined in: public-api.d.ts:356


    overlayTriggers: Map<string, OverlayTriggerRegistration>

    Defined in: public-api.d.ts:357


    overlayTypeNames: Map<string, string>

    Defined in: public-api.d.ts:353


    overlayTypes: Map<string, OverlayType>

    Defined in: public-api.d.ts:352


    singleInstanceOverlays: Set<Component>

    Defined in: public-api.d.ts:354


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

    Defined in: public-api.d.ts:355

    buildLegacyRollOverlayCanvas(config): OverlayData

    Defined in: public-api.d.ts:420

    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: public-api.d.ts:386

    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: public-api.d.ts:378

    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: public-api.d.ts:445

    Promise<any> | undefined


    getSelectedActors(): string[] | undefined

    Defined in: public-api.d.ts:428

    string[] | undefined


    isOBS(): boolean

    Defined in: public-api.d.ts:446

    boolean


    playPreset(preset): void

    Defined in: public-api.d.ts:456

    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: public-api.d.ts:461

    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: public-api.d.ts:370

    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: public-api.d.ts:372

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

    DirectorTabSvelte5Registration

    void


    registerOBSRemoteEventType(reg): void

    Defined in: public-api.d.ts:361

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

    OBSRemoteEventTypeRegistration

    void


    registerOverlayTrigger(reg): void

    Defined in: public-api.d.ts:363

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

    OverlayTriggerRegistration

    void


    registerOverlayType(key, readableName, type): void

    Defined in: public-api.d.ts:407

    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: public-api.d.ts:444

    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: public-api.d.ts:421

    Component

    void


    registerUniqueOverlaySvelte5(mount): void

    Defined in: public-api.d.ts:427

    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: public-api.d.ts:430

    ActorValues

    void


    setAVDataGrouped(groups): void

    Defined in: public-api.d.ts:437

    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: public-api.d.ts:429

    string[]

    Promise<void>


    setTrackingMode(slot, mode): Promise<void>

    Defined in: public-api.d.ts:380

    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: public-api.d.ts:396

    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>