ChatLua table
Choose player channels, send text, and build paced replies from visible messages.
Import this library with local chat = require("chat"). It is included in SDK
1.7.3 and in Auto Chat's Store package. Sending needs a chat-enabled Sharp client.
If unavailable, prepare your setup and update Sharp before starting automation.
For a ready-made window, download Auto Chat 2.2.0 from Scripts → Script Store, or follow its setup guide. Its optional AI writer can draft messages and generate enabled replies using a provider you configure.
Channels
chat.channels()
Returns a fresh list of {id, name, label} choices. IDs are 1 Nearby / Region,
2 Shout, 3 Race, 4 Guild, 5 Party, 6 Dungeon party, 7 Force, 8 Force alert,
9 Whisper and 10 Field event. Each call returns its own table.
chat.channel_label(channel)
Returns the display label for a player channel. Zero labels the listening choice “Any player channel”; it is not a send destination.
chat.valid_channel(channel [,allowAny])
Returns a boolean. Player channels are integers 1–10. Pass true as the second
argument to accept zero as a listening filter.
chat.valid_recipient(channel, serverId, characterId)
Whisper requires a server ID from 1 to 65535 and a positive 64-bit integer character ID. Other channels accept absent or zero IDs. Keep character IDs as Lua integers; converting through a floating-point number can lose precision.
Sending
chat.ready([channel])
Read-only check for chat capability and the current character session. Channel
defaults to 1. Returns true, or false, reason. Membership, rank and other
channel restrictions can still prevent a send.
chat.valid_text(text)
Checks UTF-8 wording before sending. Blank text, control characters, leading slash commands, malformed UTF-8, more than 768 bytes or 240 UTF-16 units fail.
chat.send(channel, text [,recipient])
Sends one configured message. Whisper needs a plain recipient table containing
integer server_id and character_id; other channels omit it. Returns true
for a local submission or nil, error. This does not confirm delivery.
Never replay a lost or uncertain request.
local chat = require("chat")
local function sendConfiguredMessage(channel, wording, recipient)
local ready, reason = chat.ready(channel)
if not ready then return nil, reason end
return chat.send(channel, wording, recipient)
endInvoke sending from a user action or a paced module tick. The library does not add timers or start automation on import. Guild, party, race, force and event restrictions remain enforced by the game.
Reading and replies
chat.snapshot()
Returns {context, local_name, messages} or nil, error while chat cannot be
read. Messages are ordered by time and contain id, time, channel, sender
and text. Exact identity, when available, adds server_id and character_id.
sender is the author, including for outgoing whispers.
local chat = require("chat")
local function capturePlayerMessages()
local snapshot, err = chat.snapshot()
if not snapshot then return nil, err end
return snapshot.messages, snapshot.context
endSnapshots cover visible entries the game has materialized. Hidden or missed messages are absent. Skip initial history, track message IDs, ignore your own messages and recent echoes, and pause after a context change. Apply a global send gap, per-player cooldown and reply expiry.
For a private reply, use the incoming message's exact IDs in the recipient table. If either ID is missing, skip it. A display name is not a recipient ID.
Auto Chat setup
Install Auto Chat from the Script Store. Its Overview leads to Messages and Replies. Message entries choose a channel, wording and repeat interval; Send now sends once. Reply entries choose a listening channel, phrase, answer and destination: same channel, Whisper to sender or a chosen channel.
Use the sample preview to check phrase matching without sending. Arrange reply priority, duplicate entries or undo a deletion. Overview switches turn messages and replies on independently. Save setup, then Start automation. Reloads always start paused. Activity reports local submissions and pauses, not delivery receipts. Your existing Nearby setup migrates without changing its audience.