ChatBubbles

ChatBubbles

The Chat Bubble Class This application displays a temporary message sent from a particular Token in the active Scene. The message is displayed on the HUD layer just above the Token.

Constructor

new ChatBubbles()

Members

bubbles :Object

Track active Chat Bubbles

Type:
  • Object

container

A reference to the chat bubbles HTML container in which rendered bubbles should live

Methods

_getDuration(html) → {number}

Determine the length of time for which to display a chat bubble. Research suggests that average reading speed is 200 words per minute. Since these are short-form messages, we multiply reading speed by 1.5. Clamp the result between 1 second (minimum) and 20 seconds (maximum)

Parameters:
Name Type Description
html jQuery

The HTML message

Returns:

The number of milliseconds for which to display the message

Type
number

(async) say(token, message, emote) → {Promise.<void>}

Speak a message as a particular Token, displaying it as a chat bubble

Parameters:
Name Type Description
token Token

The speaking Token

message string

The spoken message text

emote boolean

Whether to style the speech bubble as an emote

Returns:

A Promise which resolves once the chat bubble has been created

Type
Promise.<void>