ChatService
Dependency plugin to add services to the chat.
模組介紹 作者原文
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
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: