NWNX:EE  8193.36.12
Chat

Readme

Allows chat events to be captured, skipped, and manual chat messages to be dispatched.

Environment Variables

Variable Name Value Notes
NWNX_CHAT_CHAT_SCRIPT string Set the nwscript that receives all the chat messages

Files

file  nwnx_chat.nss
 

Functions

int NWNX_Chat_SendMessage (int channel, string message, object sender=OBJECT_SELF, object target=OBJECT_INVALID)
 Sends a chat message. More...
 
void NWNX_Chat_RegisterChatScript (string script)
 Registers the script which receives all chat messages. More...
 
void NWNX_Chat_SkipMessage ()
 Skips a chat message. More...
 
int NWNX_Chat_GetChannel ()
 Gets the chat channel. More...
 
string NWNX_Chat_GetMessage ()
 Gets the message. More...
 
object NWNX_Chat_GetSender ()
 Gets the sender of the message. More...
 
object NWNX_Chat_GetTarget ()
 Gets the target of the message. More...
 
void NWNX_Chat_SetChatHearingDistance (float distance, object listener=OBJECT_INVALID, int channel=NWNX_CHAT_CHANNEL_PLAYER_TALK)
 Sets the distance with which the player hears talks or whispers. More...
 
float NWNX_Chat_GetChatHearingDistance (object listener=OBJECT_INVALID, int channel=NWNX_CHAT_CHANNEL_PLAYER_TALK)
 Gets the distance with which the player hears talks or whisper. More...
 

Function Documentation

◆ NWNX_Chat_SendMessage()

int NWNX_Chat_SendMessage ( int  channel,
string  message,
object  sender = OBJECT_SELF,
object  target = OBJECT_INVALID 
)

Sends a chat message.

Remarks
If no target is provided, then it broadcasts to all eligible targets.
Parameters
channelThe channel to send the message.
messageThe message to send.
senderThe sender of the message.
targetThe receiver of the message.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 81 of file nwnx_chat.nss.

◆ NWNX_Chat_RegisterChatScript()

void NWNX_Chat_RegisterChatScript ( string  script)

Registers the script which receives all chat messages.

Note
If a script was previously registered, this one will take over.
Parameters
scriptThe script name to handle the chat events.

Definition at line 93 of file nwnx_chat.nss.

◆ NWNX_Chat_SkipMessage()

void NWNX_Chat_SkipMessage ( )

Skips a chat message.

Note
Must be called from a chat or system script handler.

Definition at line 101 of file nwnx_chat.nss.

◆ NWNX_Chat_GetChannel()

int NWNX_Chat_GetChannel ( )

Gets the chat channel.

Note
Must be called from a chat or system script handler.
Returns
The channel the message is sent.

Definition at line 108 of file nwnx_chat.nss.

◆ NWNX_Chat_GetMessage()

string NWNX_Chat_GetMessage ( )

Gets the message.

Note
Must be called from a chat or system script handler.
Returns
The message sent.

Definition at line 116 of file nwnx_chat.nss.

◆ NWNX_Chat_GetSender()

object NWNX_Chat_GetSender ( )

Gets the sender of the message.

Note
Must be called from a chat or system script handler.
Returns
The object sending the message.

Definition at line 124 of file nwnx_chat.nss.

◆ NWNX_Chat_GetTarget()

object NWNX_Chat_GetTarget ( )

Gets the target of the message.

Note
Must be called from an chat or system script handler.
Returns
The target of the message or OBJECT_INVALID if no target.

Definition at line 132 of file nwnx_chat.nss.

◆ NWNX_Chat_SetChatHearingDistance()

void NWNX_Chat_SetChatHearingDistance ( float  distance,
object  listener = OBJECT_INVALID,
int  channel = NWNX_CHAT_CHANNEL_PLAYER_TALK 
)

Sets the distance with which the player hears talks or whispers.

Remarks
Per player settings override server wide.
Parameters
distanceThe distance in meters.
listenerThe listener, if OBJECT_INVALID then it will be set server wide.
channelThe channel to modify the distance heard. Only applicable for talk and whisper.

Definition at line 140 of file nwnx_chat.nss.

◆ NWNX_Chat_GetChatHearingDistance()

float NWNX_Chat_GetChatHearingDistance ( object  listener = OBJECT_INVALID,
int  channel = NWNX_CHAT_CHANNEL_PLAYER_TALK 
)

Gets the distance with which the player hears talks or whisper.

Parameters
listenerThe listener, if OBJECT_INVALID then will return server wide setting.
channelThe channel. Only applicable for talk and whisper.

Definition at line 150 of file nwnx_chat.nss.

Variable Documentation

◆ NWNX_CHAT_CHANNEL_PLAYER_TALK

const int NWNX_CHAT_CHANNEL_PLAYER_TALK = 1

Definition at line 14 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_PLAYER_SHOUT

const int NWNX_CHAT_CHANNEL_PLAYER_SHOUT = 2

Definition at line 15 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_PLAYER_WHISPER

const int NWNX_CHAT_CHANNEL_PLAYER_WHISPER = 3

Definition at line 16 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_PLAYER_TELL

const int NWNX_CHAT_CHANNEL_PLAYER_TELL = 4

Definition at line 17 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_SERVER_MSG

const int NWNX_CHAT_CHANNEL_SERVER_MSG = 5

Definition at line 18 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_PLAYER_PARTY

const int NWNX_CHAT_CHANNEL_PLAYER_PARTY = 6

Definition at line 19 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_PLAYER_DM

const int NWNX_CHAT_CHANNEL_PLAYER_DM = 14

Definition at line 20 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_DM_TALK

const int NWNX_CHAT_CHANNEL_DM_TALK = 17

Definition at line 21 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_DM_SHOUT

const int NWNX_CHAT_CHANNEL_DM_SHOUT = 18

Definition at line 22 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_DM_WHISPER

const int NWNX_CHAT_CHANNEL_DM_WHISPER = 19

Definition at line 23 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_DM_TELL

const int NWNX_CHAT_CHANNEL_DM_TELL = 20

Definition at line 24 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_DM_PARTY

const int NWNX_CHAT_CHANNEL_DM_PARTY = 22

Definition at line 25 of file nwnx_chat.nss.

◆ NWNX_CHAT_CHANNEL_DM_DM

const int NWNX_CHAT_CHANNEL_DM_DM = 30

Definition at line 26 of file nwnx_chat.nss.