rednode API - v0.80.1
    Preparing search index...

    Variable questsConst

    quests: {
        fact(name: string): Promise<number>;
        facts(names: string[]): Promise<Record<string, number>>;
        setFact(name: string, value: number): Promise<void>;
        watch(
            names: string[],
            handler: (change: FactChange) => void,
        ): Promise<() => Promise<void>>;
    } = ...

    The game's quest facts: named counters the quests read and set. An unset fact reads 0.

    Type Declaration

    • fact: function
    • facts: function
      • Several facts at once, by name.

        Parameters

        • names: string[]

        Returns Promise<Record<string, number>>

    • setFact: function
      • Sets a fact. It changes the player's save.

        Parameters

        • name: string
        • value: number

        Returns Promise<void>

    • watch: function
      • Calls handler with each change of the named facts, as the game makes it: no polling. Kept across save loads. Resolves with a function that stops watching.

        Parameters

        • names: string[]
        • handler: (change: FactChange) => void

        Returns Promise<() => Promise<void>>

    import { quests } from "rednode";

    const stop = await quests.watch(["sq030_dam_meetup_done"], ({ name, value }) => console.log(name, value));
    await quests.setFact("sq030_dam_meetup_done", 1); // the watcher logs it