Skip to content

Chat

Lines in the chat box. The mod says lines to everyone or to some players, with a coloured label, and decides who sees each line a player says.

Every player has the channel all. The mod gives them more, such as team or a private reply channel, and Shift+Tab goes round them. A line is never the mod’s to change: it routes it or stops it.

print writes to the server’s console instead, which players never see.

On the server say(text, { to?, label?, color? }?)

Writes a line of up to 150 bytes into the chat boxes of the players to lists, or of everyone.

Every line reaches each player it is for, in order with the rest of what they are told. A label is up to 16 bytes.

NameTypeWhat it is
textstring | number | SecretNeeded.
optionstable?A table of the options below. It, and each option, may be left out.
to({Player | number})?The players who see it; everyone without.
labelstring?A tag before the line, as a channel's.
colorstring?The colour of the label, or of the whole line without one, as CSS writes it.
Fails
  • a value of the wrong type
  • an option it does not have
say("Round 1: survive!")

To whisper to a player in red, labelled as the server

Section titled “To whisper to a player in red, labelled as the server”
say("You are out of lives", { to = { p }, label = "Server", color = "#ff4040" })
On the server p:set_channel(name, { label, color? }?)

Gives a player a channel to say lines on, or changes the one they have; with nil, takes it away.

A name is up to 16 lowercase letters, digits and _, and a label up to 16 bytes. A player has 8 channels at most, all among them, which every player has first, labelled All, and the mod can neither change nor take away. They go round them with Shift+Tab in the order given, and lose them when they leave. Who sees a line said on a channel is the mod’s to say, with the said event.

NameTypeWhat it is
namestringNeeded.
channeltable?A table of the options below. It may be left out; given, it needs those marked needed.
labelstringWhat lines on it are tagged with, before the speaker's name. Needed.
colorstring?The label's colour, as CSS writes it.
Fails
  • a value of the wrong type
  • an option it does not have
  • a key it needs left out
p:set_channel("squad", { label = "Squad", color = "#7cff4d" })
p:set_channel("squad", nil)
On the server print(...values)

Prints a line to the server's console and log, each value as tostring shows it, a tab between them.

Players never see it: say writes to their chat. A secret’s text is hidden as <secret name>, wherever it is in the line.

NameTypeWhat it is
...valuesanyAny number of them.
Fails
  • a value of the wrong type
print("round", 3, "starts with", p.name)
On the server on("said", fn)
On a client on("said", fn)

A line was said in the chat, one a second a player, cleaned and cut to 150 bytes. On the server, what its handlers leave in to, label and color routes it, never back to the speaker; on a client, it is shown.

On the server

NameTypeWhat it is
e.playerPlayerWho said it.
e.textstringWhat they said.
e.channelstringThe channel they said it on.
e.to{Player | number}?Who is shown it, as players; set it to players or ids. Everyone for nil.
e.labelstring?What it shows before the line.
e.colorstring?The label's colour, as CSS #rrggbbaa.

On a client

NameTypeWhat it is
e.fromPlayer?Who said it; nil for the mod's own lines.
e.textstringWhat was said.
e.labelstring?What it shows before the line.
e.colorstring?The label's colour, as CSS #rrggbbaa.