Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 Click here to show Table of Contents

Inherits

windowcontrol

Context

windowinstance

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.

See Comm package for details on the chat message structure.

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>
    <name > ... </name>
    <offset > ... </offset>
  </modeframe>
</chatwindow>

<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.

recipients   (table)   
An integer indexed table containing strings specifying the user names of the desired recipients

onDiceLanded

function onDiceLanded(draginfo)

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)   
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

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

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.

throwDice

function throwDice(dragtype, dice, modifier, description, [customdata])

This function is 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.

Parameters

dragtype   (string)   
The type used for the dragdata object. A value of "dice" performs a normal die roll.

dice   (table)   
An integer indexed list of die types to add to the roll, similar in function to dragdata.setDieList.

modifier   (number)   
The modifier applied to the roll (see dragdata.setNumberData).

description   (string)   
The description string applied to the roll (see dragdata.setDescription).

customdata   (any)   [optional]
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.

Parameters

data   (table)   
See the dragdata object for a description of the table (same as dragdata.setData)

  • No labels