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 | nilThese 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 bytes, which is fewer characters for non-English text. Quotes and line breaks are removed. A backslash (
\) can stop the message from sending, so leave it out. - One message per second, shared by every script. A call inside that second returns
niland sends nothing. The console says so, at most once every 5 seconds.
chat.send("mid boss in 30") -- team chat
chat.send("gg", true) -- all chatchat.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. entis an entity index, such asrow.indexfromentities.by_class. Do not passp:entity_ptr(). That is not an entity index.- To ping an enemy player,
internal.pingon the Pings page is simpler.
local me = local_player()
if me then
local pos = me:get_position()
chat.ping(pos.x, pos.y, pos.z) -- ping where you stand
endchat.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
needs_internal = trueis missing fromscript_info.- The internal is not running.
- 16 requests are already waiting, across
chat.*andconvar.*together. chat.sendorchat.pingwas called again too soon.
A number means the request was queued. convar.result(seq) returns nil while it waits, true once it has gone out, and false if it could not be sent. Only the most recent answers are kept, so read it within a few ticks.