API & Macros
Visual Novel Maker exposes a public API on game.modules.get("visual-novel-maker").api. You can use this API in Foundry macros, other modules, or the browser console to control VN features programmatically.
Accessing the API
const vnm = game.modules.get("visual-novel-maker")?.api;
The API is available after the ready hook fires. Always check that the module is active before calling methods.
API Reference
Interaction Control
| Method |
Description |
startDialogue(journalId, opts?) |
Start a scripted interaction from the given journal entry. Optional opts can include { startNodeId: "nodeId" } to start from a specific node. |
startExamination(journalId) |
Start an examination-type interaction from the given journal entry. |
endDialogue() |
End the currently running interaction and close the overlay. |
isActive() |
Returns true if the VN overlay is currently open. |
getCurrentMode() |
Returns the current overlay mode: "script", "live", or null. |
Character Staging
| Method |
Description |
addCharacterToStage(actor) |
Add an actor to the VN stage. Takes a Foundry Actor document. |
Flag Management
| Method |
Description |
getFlagValue(key) |
Get the value of a runtime flag. |
setFlagValue(key, value) |
Set a runtime flag. |
getAllFlags() |
Returns an object of all current flags. |
clearFlags() |
Clears all runtime flags. |
Prompt Bubble
| Method |
Description |
showPrompt(data) |
Show a prompt bubble. data should include { tokenId, journalId, interactionType, promptText, promptIcon, regionId }. |
hidePrompt(regionId) |
Hide a specific prompt bubble by region ID. |
hideAllPrompts() |
Hide all visible prompt bubbles. |
Interaction Data
| Method |
Description |
getInteractionData(journalId) |
Get the raw interaction data stored on a journal entry. |
setInteractionData(journalId, value) |
Set interaction data on a journal entry. |
Integration Checks
| Method |
Description |
cutinAvailable() |
Returns true if Cinematic Cut-ins is installed and active. |
unboxingAvailable() |
Returns true if Unboxing the Mystery is installed and active. |
UI Control
| Method |
Description |
openDirector() |
Open the Live Director panel (GM only). |
interactNearbyNPC() |
Trigger the F-key interaction logic (find and interact with the nearest NPC). |