This control defines the main chat window. The recommended location for it is in a desktop panel. Only one instance of
the control can exist, attempts to create more than one will fail.

The chat window contains several chatentry objects representing the entries in the chat buffer. The messages
added to the buffer can either be sent to other clients taking part in the session or used as local notification messages.
See addMessage and deliverMessage for details.

When chat entries are dragged from the chat window, the type, text and total of the message will be used. If no type specified for the original chat entry, then the type will either be string or number, depending on whether a total is displayed on the chat entry.

Definition

<chatwindow name="..."
>

<modeframe
>

<mode
>
...
</mode>

The mode that you want to assign a frame to.

<name
>
...
</name>

The bitmap frame resource name used for rendering the chat frame for this mode.

<offset
>
...
</offset>

A comma separated list of four numbers specifying the pixel margins applied to the chat frame when drawn

</modeframe>

</chatwindow>

Interface

addMessage

function addMessage(
messagedata
)

Add a new entry to the chat window history locally. The message is not delivered to other connected users, and the
onReceiveMessage event is not fired.

Parameters

messagedata (table)

A table containing information about the message. See the Comm package for details.

clear

function clear(
)

Clear the chat history for all connected users. If called as a client, has no effect.

deliverMessage

function deliverMessage(
messagedata
)

Add a new entry to the chat window, delivering it to clients (if acting as the host) or requesting the host to distribute it
to clients (if acting as a client).

This form of the function delivers the message to all connected clients.

Parameters

messagedata (table)

A table containing information about the message. See the Comm package for details.

deliverMessage

function deliverMessage(
messagedata, recipient
)

Add a new entry to the chat window, delivering it to clients (if acting as the host) or requesting the host to distribute it
to clients (if acting as a client).

This form of the function delivers the message to the specified recipient only.

Parameters

messagedata (table)

A table containing information about the message. See the Comm package for details.

recipient (string)

A string containing the user name of the desired recipient

deliverMessage

function deliverMessage(
messagedata, recipients
)

Add a new entry to the chat window, delivering it to clients (if acting as the host) or requesting the host to distribute it
to clients (if acting as a client).

This form of the function delivers the message to all the recipients specified as the second parameter.

Parameters

messagedata (table)

A table containing information about the message. See the Comm package for details.

If present, this function is called whenever a die roll has been made and all dice have landed and had the result numbers assigned.
For any custom dice, the custom value calculations have already been performed.

Parameters

draginfo (dragdata)

A dragdata reference containing information about the drag used to roll the dice.

Return values

(boolean)

If true, the message is not processed any further, omitting it from the chat history.

onDiceTotal

event
function onDiceTotal(
messagedata
)

If present, this function is called when a chat entry is added to the chat window.

Parameters

messagedata (table)

A table containing information about the message. See the Comm package for details.

Return values

(boolean)

Whether alternate total numeric value should be displayed, instead of the default total calculated by summing dice and modifier of chat entry.

(number)

alternate total numeric value for chat entry

onReceiveMessage

event
function onReceiveMessage(
messagedata
)

If present, this function is called whenever a message is delivered to the chat window as a result of sending
one over the network (i.e. it is not called when using addMessage).

Parameters

messagedata (table)

A table containing information about the message. See the Comm package for details.

Return values

(boolean)

If true, the message is not processed any further, omitting it from the chat history.

A custom value useful for e.g. storing special information about the roll required when the results are displayed (see
dragdata.setCustomData).

throwDice

function throwDice(
data
)

An alternate version of the function used to trigger a roll of the dice without direct UI actions. Technically, the roll is performed by creating a dragdata
object and triggering the action of the dice.