ChatType - Chessnut/NutScript GitHub Wiki

This structure is used to register a new chat-type.

Structure

  • canHear - A function that has the speaker and listener (both players) passed. Return true or false to determine if the chat message could be seen. This can also be a number to determine a range (in Source units) or omitted to always show.
  • color - This color property is only needed if used with onChatAdd, but determines the primary chat message color.
  • format - A string only needed if used with onChatAdd; determines the way a chat message is structure. For example, a message that says John Doe proclaims "Something" would have the format "%s proclaims \"%s\""
  • onChatAdd - A function that has the speaker (a player) and text (a string) passed. This should be used with chat.AddText to add the text to an actual chat box. You can use this however to have more colors within your chat type for example.
  • canSay - A function that returns a boolean to determine whether or not a specific chat type can be used.