Link Search Menu Expand Document

Verified naming

Say Mask

The say mask is used to send server-invoked overhead chat for NPCs and Players alike.


Table of contents

Limitations

Bandwidth limit

There is no specific limit to the say mask itself, however, there is an indirect limit through the parent updating packet itself. As each packet can be up to 40,000 bytes in size, the theoretical bandwidth limitation of the say mask is 40,000 characters, minus the bandwidth necessary for the rest of the parent updating packet to function. Needless to say however, a 40,000 characters long string is too long to be fully seen on any reasonable resolution out there.

Chatbox Limit

This section only applies to players’ say mask, as NPC chat will never be shown in the chatbox through the mask itself. There are, however, scenarios where the message is additionally sent in chatbox, with the NPC’s name in front of the game message itself.

While the same bandwidth limit applies for both say masks, players’ say mask comes with a limitation in the chatbox. Namely, chatbox can only render messages that are up to 100 lines long. While messages that are longer than 100 lines do actually display above players’ heads, they will cause a significant lag spike in the client while trying to render it in the chatbox itself.

Rendering in Chatbox

As mentioned in the chatbox limit section, this only applies to players’ say mask.

By default, only messages which were said over your own character render in the chatbox. This means, if the game uses the say mask for another player, only their client will render the message in the chatbox. It is, however, possible to make the messages render in the chatboxes of every player who has you in their local player info block. This is done by using the ~ character in front of the message itself. The very first occurrence of this character is removed if that is the case.

Chat Icons & Ignore List

If the ~ character is used to forcibly show the message in the chatbox of every local player, no chat icons will render before the players’ name. Therefore, if the player is an ironman or a J-Mod, their specific chat icon will not be seen next to those messages, even though they still have the rank. In addition to this, ignore list is not used to filter out players messages who you’ve ignored listed.

Rendering Overhead

The messages rendered overhead are identical for both NPCs and players alike. However, the duration for which the overhead message remains visible for differs by 50%. For players, the duration of the overhead message is 150 client ticks, or three seconds. For NPCs however, the duration is only 100 client ticks, or two seconds.

Client Code

Below are refactored versions of the client code for the say mask for players and NPCs.

Player’s Say Mask

player.overheadChat = buffer.readStringCP1252();
if (player.overheadChat.charAt(0) == '~') {
    player.overheadChat = player.overheadChat.substring(1);
    World.sendGameMessage(2, player.name.getName(), player.overheadChat);
} else if (player == Client.localPlayer) {
    World.sendGameMessage(2, player.name.getName(), player.overheadChat);
}

player.overheadChatHidden = false;
player.overheadChatColour = 0;
player.overheadChatEffect = 0;
player.overheadChatTicksRemaining = 150;

NPC’s Say Mask

npc.overheadChat = buffer.readStringCP1252();
npc.overheadChatTicksRemaining = 100;

Media

Below is a demonstration of the server sending a 100-line long say mask for a player.

100 line long say


Below is a demonstration of a NPC using the say mask.

NPC say mask


Below is a two-part gif which demonstrates a message being sent without and with the ~ tilde character.

Tilde demonstration