-
-
Notifications
You must be signed in to change notification settings - Fork 48
Macros
If you want to send a message using Polyglot, here's a few things you need to pay attention:
The message needs to be sent In Character, so it has to be of the type CONST.CHAT_MESSAGE_TYPES.IC
. It can also be OOC or WHISPER if you toggled the Scramble OOC Chat Messages setting.
You can append a lang
or language
key into the object parameter of the ChatMessage.create() function to make a message to be spoken in that language. The value can be either the key or the value of the of language (e.g. if you have a language set as "dwarf": "Dwarvish"
, you could use either).
ChatMessage.create({
user: game.userId,
speaker: ChatMessage.getSpeaker(),
content: "Hello world",
type: CONST.CHAT_MESSAGE_TYPES.IC, //2
language: "dwarvish"
})
This used to be canvas.hud.bubbles.say()
until V10 changed it.
If you want tokens to speak without sending chat messages, you need to send a language
key as part of the options
parameter.
let message = "Hello world"
let options = {
//other data
language: "dwarvish"
}
await canvas.hud.bubbles.broadcast(token, message, options);
Or this in case you aren't using emotes at all.
let message = "Hello world"
await canvas.hud.bubbles.broadcast(token, message, {language: "dwarvish"});