Skip to content

Using PromptProtocol.sendPromptToChat()

HeosPL edited this page Apr 5, 2025 · 3 revisions

📘 Using PromptProtocol.sendPromptToChat()

The PromptProtocol.sendPromptToChat() method allows you to insert a skill test prompt directly into the chat, without showing the dialog.

This is useful for:

Macros Monk’s Active Tiles (Run Code) Item buttons Triggers in other modules


✅ Syntax

PromptProtocol.sendPromptToChat({
  skill: "Athletics",          // (string) Must match a valid skill name
  dv: 15,                      // (number) Difficulty Value
  flavor: "While climbing",    // (optional string) Situation description
  hideDv: false                // (optional boolean) Hide DV from players
});

You can omit flavor and hideDv, and DV defaults to 15 if not provided.

👥 Actor resolution

The module automatically chooses the actor based on who clicks the prompt:

User Type Actor Used Player Their assigned character (game.user.character) GM The actor of the selected token on the scene (must select one) If no actor is found, the user is notified. 💡 Examples

🧪 Basic macro

PromptProtocol.sendPromptToChat({
  skill: "Perception",
  dv: 13,
  flavor: "Searching a dark alley",
  hideDv: false
});

🎭 Monk’s Active Tiles (Run Code)

PromptProtocol.sendPromptToChat({
  skill: "Stealth",
  dv: 17,
  flavor: "Avoiding cameras",
  hideDv: true
});

🛠 Notes

  • PromptProtocol is available globally from init, so you can safely call it from macros or other tools that run early.
  • This method only creates the prompt — users still click it to perform the actual roll.
  • Skill name must match exactly (case-sensitive) what exists on the actors' sheets.

Got more ideas or need a more advanced setup (multi-prompt, whisper, pre-rolled test)? Open an issue or start a discussion. 👊