Action Table

A complete listing of Coronium ChatterBox actions:

Action Name Description Scope
joinRoom Join a room. client
sendMessage Send a message to the room. room
sendWhisper Send a private message to a client. client
sendSystemMessage Send a system message to the room. room
changeName Change the client name. client
getRoomList Get a list of active rooms from the server. client
getId Get the client unique ID. client
getName Get the client name. client
disconnect Disconnect the client from the server. client

changeName

Change the client name.

Action Parameters

Parameters Description Type
name The new client name. String

Example

cb:changeName( 'Marco' )

See also: OnNameChange event.


disconnect

Disconnect the client from the server.

Action Parameters

This action has no parameters.

Example

cb:disconnect()

See also: OnClosed event.


getId

Get the clients unique identifier.

Action Parameters

This action has no parameters.

Example

local id = cb:getId()

getRoomList

Get a list of active rooms from the server.

Action Parameters

This action has no parameters.

Example

local name = cb:getRoomList()

See also: OnRoomList event.


getName

Get the clients name.

Action Parameters

This action has no parameters.

Example

local name = cb:getName()

joinRoom

Join a room.

Note

A client can only be connected to one room at a time. When joining a new room, the client will automatically leave the previous room.

Action Parameters

Parameters Description Type
room The room ID to join. String

Example

cb:joinRoom( 'GameOne' )

See also: OnJoined event.


sendMessage

Send a message to the room.

Warning

Do not use the reserved sequence // (two forward slashes) in your message body.

Important

The message body must be of type String.

Action Parameters

Parameters Description Type
message The message content. String

Example

cb:sendMessage( 'Hello people!' )

See also: OnMessage event.


sendSystemMessage

Send a system message to the room.

Warning

Payload data cannot contain \n (newline) characters.

Action Parameters

Parameters Description Type
action The system action ID. String
payload The action payload. Table

Example

cb:sendSystemMessage( 'player_turn', {turn = 1} )

See also: OnSystemMessage event.


sendWhisper

Send a private message to a client.

Warning

Do not use the reserved sequence // (two forward slashes) in your message body.

Important

The message body must be of type String.

Action Parameters

Parameters Description Type
message The message content. String
to_id The recipient ID. String

Example

cb:sendWhisper( 'Hello you!', 'b697869e-5e07-4a91-89bd-1c737123cae2' )

Note

You can obtain a recipient ID from the client list. See the OnClientList event.

See also: OnWhisper event.