Repository navigation
API
dxcufgb edited this page Oct 30, 2026
·
1 revision
For macro and module authors.
const api = game.modules.get("dxcufgbs-screen-effects").api;
api.preview("poisoned", 4000); // show an effect for 4 seconds
api.refresh(); // re-check the conditions
api.effects; // the effect ids, in stacking order: "exhaustion", "poisoned", … "lowhp", "unconscious"Everything happens on the screen of the client that calls it; nothing is sent to other players. Any user may call it.
-
preview(id, ms = 4000)shows an effect on your own screen formsmilliseconds, whatever the conditions, even when it is turned off in Choose effects or Show screen effects is off. Ids not inapi.effectsare ignored. Exhaustion previews at level 4 and Unconscious as dying. -
refresh()re-checks the conditions (of the token whose effects you see) a moment later. The module already does this when tokens, actors, active effects, users, the scene or its settings change, so you only need it after a change it can't see.
The API is set during init. The effects are placed on screen at ready, so call preview from ready on. The module calls no hooks of its own and stores no flags. Make the integration optional:
Hooks.once("ready", () => {
const api = game.modules.get("dxcufgbs-screen-effects")?.active ? game.modules.get("dxcufgbs-screen-effects").api : null;
if (!api) return; // Dxcufgb's screen effects not installed or not enabled
api.preview("stunned", 2000);
});Add { "id": "dxcufgbs-screen-effects", "type": "module" } to relationships.recommends in your module.json.
Dxcufgb's Workshop: every Foundry VTT project, video and changelog in one place · Support on Ko-fi · MIT License
Using it
For module authors
Help