ChatService
Dependency plugin to add services to the chat.
About this mod Author’s original text
Chat Service Plugin
This unofficial TaleSpire plugin is a dependency plugin for creating local chat service functionality.
The plugin allows registering of key words with corresponding handlders to create functionality such
as whispers or dice rolling functionality.
Install
Use R2ModMan or similar installer to install this plugin.
Optional Dependency
Chat Service Plugin has a soft dependency on Radial UI plugin. If the deselect option is turned on in
the settings then Radial UI plugin is required. If the deselect option is turned off then Radial UI
plugin is not required.
Usage
Reference this dependency plugin in the parent plugin and then use the following syntax to add a chat
service:.Add(serviceKey, handler)
Where the service key is a string that must appear at the beginning of the chat message in order to trip
the corresponding handler.
Where hander is a function that takes in two string, the message content and the sender, and a source
which is a ChatSource enumeration indicating if the source if a GM message, player message or creature
message. The hanlder returns a string, the modified message or null. Returning null prevents the message
from being displayed.
An example of adding a inline handler for "/w" function would be:
chatMessgeServiceHandlers.Add("/w ", (chatMessage, sender, source)=> { Debug.Log(sender+" whispered "+chatMessage); });
Usage programatically
You can also use this function for sending messages to other clients without having the request triggered
by the user from the chat. This can be done by using the core TS function:
`ChatManager.SendChatMessage(message, sender)`
Where message is the content to be sent and should include the handling prefix.
Where sender is the NGuid of either a creature mini (CreatureId) or player (PlayerId).
For example, to use the above hander for "/w" assuming it is a whisper message to the GM:
`ChatManager.SendChatMessage("/w I pickpocket the person I am speaking to", LocalPlayer.Id.Value)`
Custom Headers
Messages whose content contains text in square brackets is treated as custom header messages. The message
must start with an opening square bracket, have some text, have an ending square bracket, and finally have
some content. Such messages will replace the usual character or player name in the chat message header with
the contents between the square brackets and limit the message content to the contents after the ending
square. For example:
[Bilbo]Is it time to eat yet?
Would create a chat message whose header would be "Bilbo" and message content would be "Is it time to eat yet?"
regardless of who sent the message.
Aliases
Aliases are an optional feature supported for any `/` services. To use aliases, in a File Access Plugin legal
location, create a JSON file called `Chat_Service_Aliases.json`. The contents of the file is a dictionary
of aliases and their value. For exmaple:
{
"rps": "cr RPS",
"draw": "cr DRAW"
}
In the above example, an alias of `rps is mapped to cr RPS. That means instead of having to type /cr RPS`
the user can just do `/rps. Similarly the user can just type /draw to execute /cr DRAW`. Note that the
alias configuration does not include the `/ character. Both the alias and the result assume a /` character.
Chat Logging
When turned on, chat logging writes all chat messages to an time stamped HTML file. This creates a log or
record of the session's chat for later review. Unlike the Log Chat plugin which only logs what the player was
able to see in terms of chat messages (e.g. not showing messages that were wispered to other people) this
log feature logs even messages that were not displayed in the player's chat (e.g. messages whispered to other
players).
When a message was not seen by the player due to a chat service (such as Chat Whisper) the log indicates the
chat service that was used. This detection is not perfect but good enough. If a custom header was used the
detection will identify the service and parameters. If a custom he
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
- For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
- Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.
Install locations vary a lot between mods — the bundled readme is the most reliable guide.
Install these first, or the mod will not work: