GetChatMessage

From Zandronum Wiki
This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.
This article documents an ACS function which is only available in development builds of Zandronum 3.2 and newer.

str GetChatMessage (int player, int offset)

str GetChatMessage (int player, int offset [, bool keepcolorcodes]) (development version 3.2-alpha and above only)

Usage

Returns the last chat message from a player, or the server via RCON. Up to 5 chat messages are stored into memory for each player, in order from last message to oldest message sent. Every time a player sends a new message, all stored messages are shifted by one, and any messages older than the last 5 messages sent are overwritten and deleted. You may use this in conjunction with the GAMEVENT_CHAT event script type to get a player's messages as soon as they're received.

NOTE: Private chat messages (i.e. those sent using sayto or sayto_idx) are not accounted for and will not be stored into memory, nor are they retrievable.

Parameters

  • player: The number of the player whose chat message you want to retrieve. If you want to retrieve any messages from the server, set this to -1 instead.
  • offset: Which chat message you want to retrieve. If you want the last message sent, set to to 0. If you want the oldest message still stored in memory, set this to 4.
  • keepcolorcodes: If true, then any colour codes in the message are preserved instead of removed completely. (development version 3.2-alpha and above only)

Return value

Returns the chat message as a string, with or without colour codes. If the player doesn't exist or if that player hadn't sent more messages than offset, it returns an empty string instead.

Examples

This article lists no examples, please add one.

See also