Skip to content

Chat and Map

Needs the internal running and needs_internal = true in script_info.

chat.send(text [, all_chat])   -> seq | nil
chat.ping(x, y, z [, ent])     -> seq | nil
chat.map_line(x, y [, first])  -> seq | nil

These act as you, and other players see them. Use them on a key press or an event, never every tick.

To read chat instead, subscribe to CCitadelUserMsg_ChatMsg on the Game Messages page.

chat.send(text [, all_chat])

Sends a message to team chat. Pass true as the second argument to send it to all chat.

  • The text is cut to 127 characters. Quotes and line breaks are removed.
  • One message per second, shared by every script. A call inside that second returns nil and sends nothing. The console says so, at most once every 5 seconds.
lua
chat.send("mid boss in 30")   -- team chat
chat.send("gg", true)          -- all chat

chat.ping(x, y, z [, ent])

Pings a spot in the world, the same as pinging it yourself. Pass an entity index as ent to ping that entity.

  • Four pings per second, shared by every script. Extra calls return nil.
  • ent is an entity index, such as row.index from entities.by_class. Do not pass p:entity_ptr(). That is not an entity index.
  • To ping an enemy player, internal.ping on the Pings page is simpler.
lua
local me = local_player()
if me then
    local pos = me:get_position()
    chat.ping(pos.x, pos.y, pos.z)   -- ping where you stand
end

chat.map_line(x, y [, first])

Draws on the minimap, the same as drawing on it yourself. A line is a series of points. Call it with first = true for the first point, then once for each point after that. x and y are whole numbers on the minimap.

There is no per second limit, but every point uses a place in the queue below, so send a long line over several ticks.

Returns nil when

  1. needs_internal = true is missing from script_info.
  2. The internal is not running.
  3. 16 requests are already waiting, across chat.* and convar.* together.
  4. chat.send or chat.ping was called again too soon.

A number means the request was queued. convar.result(seq) returns true once it has gone out.