buttonpushertv

FVTT- Create Chat Message (v2)

Jun 20th, 2021
786
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Courtesy of @errational
  2. // Creates a chat message.
  3. //
  4. // Slightly modified from FVTT Community Macro version - I needed to add the line below to get it to work
  5. let controlledToken = canvas.tokens.controlled[0];
  6. const content = `<p>Monster attacks ${controlledToken.name}</p>`;
  7.  
  8. ChatMessage.create({
  9.   speaker: ChatMessage.getSpeaker(controlledToken),
  10.   content: content,
  11.   type: CONST.CHAT_MESSAGE_TYPES.OTHER
  12. });
RAW Paste Data