Defines the core Foundry options for a game setting.

interface CoreSetting {
    choices?: Record<string, string>;
    config?: boolean;
    default: string | number | boolean | object;
    filePicker?:
        | boolean
        | "folder"
        | "text"
        | "any"
        | "video"
        | "audio"
        | "font"
        | "image"
        | "imagevideo";
    hint?: string;
    name?: string;
    onChange?: (
        value: any,
        options?: { [key: string]: any },
        userId?: string,
    ) =>
        | void
        | Iterable<
            (
                value: any,
                options?: { [key: string]: any },
                userId?: string,
            ) => void,
            any,
            any,
        >;
    range?: { max: number; min: number; step?: number };
    requiresReload?: boolean;
    scope: "user" | "client" | "world";
    type:
        | NumberConstructor
        | StringConstructor
        | BooleanConstructor
        | ObjectConstructor
        | ArrayConstructor
        | (new (...args: any[]) => DataModel)
        | ((data: unknown) => unknown);
}
Index

Properties

choices?: Record<string, string>

If choices are defined, the resulting setting will be a select menu and type must be a string.

config?: boolean

Specifies that the setting appears in the configuration view; default: true.

default: string | number | boolean | object

A default value for the setting.

filePicker?:
    | boolean
    | "folder"
    | "text"
    | "any"
    | "video"
    | "audio"
    | "font"
    | "image"
    | "imagevideo"

Setting is a file picker and type must be a string. You may use a boolean for any file type or select a specific file type.

hint?: string

A description of the registered setting and its behavior.

name?: string

The displayed name of the setting.

onChange?: (
    value: any,
    options?: { [key: string]: any },
    userId?: string,
) =>
    | void
    | Iterable<
        (value: any, options?: { [key: string]: any }, userId?: string) => void,
        any,
        any,
    >

An onChange callback function or iterable list of callbacks to directly receive callbacks from Foundry on setting change.

range?: { max: number; min: number; step?: number }

If range is specified, the resulting setting will be a range slider.

requiresReload?: boolean

If true then a prompt to reload after changes occurs; default: false.

scope: "user" | "client" | "world"

Scope for setting. client uses local storage, world is saved in Foundry DB for the World / only accessible by GM for modification, and user is also saved in the Foundry DB associated w/ the current user.

type:
    | NumberConstructor
    | StringConstructor
    | BooleanConstructor
    | ObjectConstructor
    | ArrayConstructor
    | (new (...args: any[]) => DataModel)
    | ((data: unknown) => unknown)

A constructable object, function, or DataModel.